5 #include "pthread_impl.h"
12 static void do_setxid(void *p
)
16 int ret
= -__syscall(c
->nr
, c
->id
, c
->eid
, c
->sid
);
18 /* If one thread fails to set ids after another has already
19 * succeeded, forcibly killing the process is the only safe
20 * thing to do. State is inconsistent and dangerous. Use
21 * SIGKILL because it is uncatchable. */
23 __syscall(SYS_kill
, __syscall(SYS_getpid
), SIGKILL
);
28 int __setxid(int nr
, int id
, int eid
, int sid
)
30 /* err is initially nonzero so that failure of the first thread does not
31 * trigger the safety kill above. */
32 struct ctx c
= { .nr
= nr
, .id
= id
, .eid
= eid
, .sid
= sid
, .err
= -1 };
33 __synccall(do_setxid
, &c
);
35 if (c
.err
>0) errno
= c
.err
;