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