7 #include <sys/syscall.h>
12 #if (defined __NR_getuid || defined __NR_getxuid) \
13 && defined(__NR_setuid) \
14 && defined(__NR_getresuid) \
15 && defined(__NR_setreuid) \
16 && defined(__NR_setresuid) \
17 && defined(__NR_fchown) \
18 && defined(__NR_getgroups)
24 # define __NR_getuid __NR_getxuid
26 uid = syscall(__NR_getuid);
27 assert(syscall(__NR_setuid, uid) == 0);
30 * uids returned by getresuid should be ignored
31 * to avoid 16bit vs 32bit issues.
34 assert(syscall(__NR_getresuid, &r, &e, &s) == 0);
36 assert(syscall(__NR_setreuid, -1, -1L) == 0);
37 assert(syscall(__NR_setresuid, uid, -1, -1L) == 0);
38 assert(syscall(__NR_fchown, 1, -1, -1L) == 0);
39 assert((size = syscall(__NR_getgroups, 0, list)) >= 0);
40 assert(list = calloc(size + 1, sizeof(*list)));
41 assert(syscall(__NR_getgroups, size, list) == size);