Add DRD suppression patterns for races triggered by std::ostream
[valgrind.git] / memcheck / tests / linux / capget.c
blobce9b18b0b0167603e8763895afd82f9c94242ed6
1 #if defined(linux)
4 #include <stdio.h> /* printf() */
5 #include <unistd.h> /* syscall() */
6 #include <sys/syscall.h> /* __NR_capget */
7 #include <sys/types.h> /* uid_t */
8 #include <linux/capability.h> /* _LINUX_CAPABILITY_VERSION */
11 int main()
13 struct __user_cap_header_struct h;
14 struct __user_cap_data_struct d;
15 int syscall_result;
17 if (getuid() == 0)
18 fprintf(stderr, "Running as root\n");
19 h.version = _LINUX_CAPABILITY_VERSION;
20 h.pid = 0;
21 syscall_result = syscall(__NR_capget, &h, &d);
22 if (syscall_result >= 0)
24 fprintf(stderr,
25 "capget result:\n"
26 "effective %#x\n"
27 "permitted %#x\n"
28 "inheritable %#x\n",
29 d.effective,
30 d.permitted,
31 d.inheritable);
33 else
35 perror("capget");
37 return 0;
41 #else
44 #include <stdio.h>
46 int main()
48 fprintf(stderr, "This program is Linux-specific\n");
49 return 0;
53 #endif