From 82858a8e8f15943e8e670a4657f5dc711e9ea851 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 12 Mar 2009 21:31:57 +0000 Subject: nixio: add setsid() --- libs/nixio/src/process.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libs') 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} }; -- cgit v1.2.3