summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richardipsum@fastmail.co.uk>2018-06-22 21:36:20 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2018-06-26 16:55:46 +0100
commitbdb36f7e85505a3104b07ffc628b086408f296f5 (patch)
treeb5a88f0ff66908e3846806816443e56affd9f7c1
parent82324d028766094593f10ff9e17b38b266c96864 (diff)
downloadluxio-bdb36f7e85505a3104b07ffc628b086408f296f5.tar.bz2
Bind setpgid(2)
-rw-r--r--luxio.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/luxio.c b/luxio.c
index ceba085..5013106 100644
--- a/luxio.c
+++ b/luxio.c
@@ -759,7 +759,28 @@ luxio_setsid(lua_State *L)
return 1;
}
-/* TODO: setpgid() 4.3.3 */
+
+
+static int
+luxio_setpgid(lua_State *L)
+{
+ pid_t pid, pgid;
+ int r;
+
+ pid = luaL_checkinteger(L, 1);
+ pgid = luaL_checkinteger(L, 2);
+
+ r = setpgid(pid, pgid);
+
+ lua_pushinteger(L, r);
+
+ if (r < 0) {
+ lua_pushinteger(L, errno);
+ return 2;
+ }
+
+ return 1;
+}
/*** System identification.
@section sysident
@@ -4489,6 +4510,7 @@ luxio_functions[] = {
{ "setuid", luxio_setuid },
{ "setgid", luxio_setgid },
{ "setsid", luxio_setsid },
+ { "setpgid", luxio_setpgid },
{ "getlogin", luxio_getlogin },
{ "uname", luxio_uname },