1 #ifdef HAVE_CONFIG_H
2 # include "config.h"
3 #endif
4 #include <assert.h>
5 #include <stdlib.h>
6 #include <unistd.h>
7 #include <sys/syscall.h>
8
9 int
main(void)10 main(void)
11 {
12 #if defined(__NR_getuid32) \
13 && defined(__NR_setuid32) \
14 && defined(__NR_getresuid32) \
15 && defined(__NR_setreuid32) \
16 && defined(__NR_setresuid32) \
17 && defined(__NR_fchown32) \
18 && defined(__NR_getgroups32)
19 int r, e, s;
20 int size;
21 int *list = 0;
22
23 r = syscall(__NR_getuid32);
24 assert(syscall(__NR_setuid32, r) == 0);
25 assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
26 assert(syscall(__NR_setreuid32, -1, -1L) == 0);
27 assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
28 assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
29 assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
30 assert(list = calloc(size + 1, sizeof(*list)));
31 assert(syscall(__NR_getgroups32, size, list) == size);
32 return 0;
33 #else
34 return 77;
35 #endif
36 }
37