diff options
author | Steven Barth <steven@midlink.org> | 2009-03-12 21:31:57 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-03-12 21:31:57 +0000 |
commit | 82858a8e8f15943e8e670a4657f5dc711e9ea851 (patch) | |
tree | 3be57788296b68a29a983e5cdee2528de90a949a | |
parent | 2c7a30708d2c31da64ab23fc07f44f94c1e8b8d7 (diff) |
nixio: add setsid()
-rw-r--r-- | libs/nixio/src/process.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/nixio/src/process.c b/libs/nixio/src/process.c index 0d60ed1905..65d6209008 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} }; |