diff options
Diffstat (limited to 'libs/nixio')
-rw-r--r-- | libs/nixio/src/nixio.c | 35 | ||||
-rw-r--r-- | libs/nixio/src/process.c | 14 |
2 files changed, 48 insertions, 1 deletions
diff --git a/libs/nixio/src/nixio.c b/libs/nixio/src/nixio.c index d433ba4fd2..1338371689 100644 --- a/libs/nixio/src/nixio.c +++ b/libs/nixio/src/nixio.c @@ -130,7 +130,7 @@ LUALIB_API int luaopen_nixio(lua_State *L) { lua_setfield(L, -2, "version"); /* some constants */ - lua_createtable(L, 0, 16); + lua_createtable(L, 0, 49); NIXIO_PUSH_CONSTANT(EACCES); NIXIO_PUSH_CONSTANT(EINTR); @@ -140,6 +140,33 @@ LUALIB_API int luaopen_nixio(lua_State *L) { NIXIO_PUSH_CONSTANT(EAGAIN); NIXIO_PUSH_CONSTANT(ENOMEM); NIXIO_PUSH_CONSTANT(ENOENT); + NIXIO_PUSH_CONSTANT(ECHILD); + NIXIO_PUSH_CONSTANT(EIO); + NIXIO_PUSH_CONSTANT(EBADF); + NIXIO_PUSH_CONSTANT(EFAULT); + NIXIO_PUSH_CONSTANT(EFBIG); + NIXIO_PUSH_CONSTANT(ENOSPC); + NIXIO_PUSH_CONSTANT(EPIPE); + NIXIO_PUSH_CONSTANT(ESPIPE); + NIXIO_PUSH_CONSTANT(EISDIR); + NIXIO_PUSH_CONSTANT(EPERM); + NIXIO_PUSH_CONSTANT(EEXIST); + NIXIO_PUSH_CONSTANT(ELOOP); + NIXIO_PUSH_CONSTANT(EMFILE); + NIXIO_PUSH_CONSTANT(ENAMETOOLONG); + NIXIO_PUSH_CONSTANT(ENFILE); + NIXIO_PUSH_CONSTANT(ENODEV); + NIXIO_PUSH_CONSTANT(ENOTDIR); + NIXIO_PUSH_CONSTANT(ENXIO); + NIXIO_PUSH_CONSTANT(EOVERFLOW); + NIXIO_PUSH_CONSTANT(EROFS); + NIXIO_PUSH_CONSTANT(ETXTBSY); + NIXIO_PUSH_CONSTANT(EAFNOSUPPORT); + NIXIO_PUSH_CONSTANT(ENOBUFS); + NIXIO_PUSH_CONSTANT(EPROTONOSUPPORT); + NIXIO_PUSH_CONSTANT(ENOPROTOOPT); + NIXIO_PUSH_CONSTANT(EBUSY); + NIXIO_PUSH_CONSTANT(ESRCH); NIXIO_PUSH_CONSTANT(SIGALRM); NIXIO_PUSH_CONSTANT(SIGINT); NIXIO_PUSH_CONSTANT(SIGTERM); @@ -148,6 +175,12 @@ LUALIB_API int luaopen_nixio(lua_State *L) { NIXIO_PUSH_CONSTANT(SIGSTOP); NIXIO_PUSH_CONSTANT(SIGCONT); NIXIO_PUSH_CONSTANT(SIGSEGV); + NIXIO_PUSH_CONSTANT(SIGCHLD); + NIXIO_PUSH_CONSTANT(SIGQUIT); + NIXIO_PUSH_CONSTANT(SIGUSR1); + NIXIO_PUSH_CONSTANT(SIGUSR2); + NIXIO_PUSH_CONSTANT(SIGPOLL); + NIXIO_PUSH_CONSTANT(SIGURG); lua_setfield(L, -2, "const"); diff --git a/libs/nixio/src/process.c b/libs/nixio/src/process.c index 69f19b7ac1..af44484dad 100644 --- a/libs/nixio/src/process.c +++ b/libs/nixio/src/process.c @@ -36,6 +36,19 @@ static int nixio_fork(lua_State *L) { } } +static int nixio_signal(lua_State *L) { + int sig = luaL_checkinteger(L, 1); + const char *val = luaL_checkstring(L, 2); + + if (!strcmp(val, "ign") || !strcmp(val, "ignore")) { + return nixio__pstatus(L, signal(sig, SIG_IGN) != SIG_ERR); + } else if (!strcmp(val, "dfl") || !strcmp(val, "default")) { + return nixio__pstatus(L, signal(sig, SIG_DFL) != SIG_ERR); + } else { + return luaL_argerror(L, 2, "supported values: ign, dfl"); + } +} + static int nixio_wait(lua_State *L) { pid_t pidin = luaL_optinteger(L, 1, -1), pidout; int options = 0, status; @@ -148,6 +161,7 @@ static const luaL_reg R[] = { {"getgid", nixio_getgid}, {"setuid", nixio_setuid}, {"setgid", nixio_setgid}, + {"signal", nixio_signal}, {NULL, NULL} }; |