Add missing zstd.h to coregrind Makefile.am noinst_HEADERS
[valgrind.git] / memcheck / tests / linux / capget.c
blob4ebf2f4aefe7cc7c2a696ddcb572111e0790a125
1 #include "../../../config.h"
3 #if defined(linux) && !defined(MUSL_LIBC)
6 #include <stdio.h> /* printf() */
7 #include <unistd.h> /* syscall() */
8 #include <sys/syscall.h> /* __NR_capget */
9 #include <sys/types.h> /* uid_t */
10 #include <linux/capability.h> /* _LINUX_CAPABILITY_VERSION */
13 int main()
15 struct __user_cap_header_struct h;
16 struct __user_cap_data_struct d;
17 int syscall_result;
19 if (getuid() == 0)
20 fprintf(stderr, "Running as root\n");
21 h.version = _LINUX_CAPABILITY_VERSION;
22 h.pid = 0;
23 syscall_result = syscall(__NR_capget, &h, &d);
24 if (syscall_result >= 0)
26 fprintf(stderr,
27 "capget result:\n"
28 "effective %#x\n"
29 "permitted %#x\n"
30 "inheritable %#x\n",
31 d.effective,
32 d.permitted,
33 d.inheritable);
35 else
37 perror("capget");
39 return 0;
43 #else
46 #include <stdio.h>
48 int main()
50 fprintf(stderr, "This program is Linux with GNU libc specific\n");
51 return 0;
55 #endif