summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/src/process.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-03-12 21:31:57 +0000
committerSteven Barth <steven@midlink.org>2009-03-12 21:31:57 +0000
commit82858a8e8f15943e8e670a4657f5dc711e9ea851 (patch)
tree3be57788296b68a29a983e5cdee2528de90a949a /libs/nixio/src/process.c
parent2c7a30708d2c31da64ab23fc07f44f94c1e8b8d7 (diff)
nixio: add setsid()
Diffstat (limited to 'libs/nixio/src/process.c')
-rw-r--r--libs/nixio/src/process.c12
1 files changed, 12 insertions, 0 deletions
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}
};