From: Steven Barth Date: Thu, 12 Mar 2009 21:31:57 +0000 (+0000) Subject: nixio: add setsid() X-Git-Tag: 0.9.0~602 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=82858a8e8f15943e8e670a4657f5dc711e9ea851;p=oweals%2Fluci.git nixio: add setsid() --- diff --git a/libs/nixio/src/process.c b/libs/nixio/src/process.c index 0d60ed190..65d620900 100644 --- a/libs/nixio/src/process.c +++ b/libs/nixio/src/process.c @@ -163,6 +163,17 @@ static int nixio_nice(lua_State *L) { } } +static int nixio_setsid(lua_State *L) { + pid_t pid = setsid(); + + if (pid == -1) { + return nixio__perror(L); + } else { + lua_pushinteger(L, pid); + return 1; + } +} + /* module table */ static const luaL_reg R[] = { @@ -176,6 +187,7 @@ static const luaL_reg R[] = { {"getgid", nixio_getgid}, {"setuid", nixio_setuid}, {"setgid", nixio_setgid}, + {"setsid", nixio_setsid}, {"signal", nixio_signal}, {NULL, NULL} };