13 static void do_setgroups(void *p)
17 int ret = __syscall(SYS_setgroups, c->count, c->list);
19 /* If one thread fails to set groups after another has already
20 * succeeded, forcibly killing the process is the only safe
21 * thing to do. State is inconsistent and dangerous. Use
22 * SIGKILL because it is uncatchable. */
24 __syscall(SYS_kill, __syscall(SYS_getpid), SIGKILL);
29 int setgroups(size_t count, const gid_t list[])
31 /* ret is initially nonzero so that failure of the first thread does not
32 * trigger the safety kill above. */
33 struct ctx c = { .count = count, .list = list, .ret = 1 };
34 __synccall(do_setgroups, &c);
35 return __syscall_ret(c.ret);