leak-tree.stderr.exp2 leak-tree.stderr.exp64 \
leak-regroot.vgtest leak-regroot.stderr.exp \
leakotron.vgtest leakotron.stdout.exp leakotron.stderr.exp \
+ linux-capget linux-capget.stderr.exp \
linux-syslog-syscall linux-syslog-syscall.stderr.exp \
linux-syscalls-2007 linux-syscalls-2007.stderr.exp \
linux-timerfd-syscall linux-timerfd-syscall.stderr.exp \
file_locking \
fprw fwrite hello inits inline \
leak-0 leak-cycle leak-pool leak-tree leak-regroot leakotron \
+ linux-capget \
linux-syslog-syscall \
linux-syscalls-2007 \
linux-timerfd-syscall \
--- /dev/null
+#if defined(linux)
+
+
+#include <stdio.h> /* printf() */
+#include <unistd.h> /* syscall() */
+#include <sys/syscall.h> /* __NR_capget */
+#include <linux/capability.h> /* _LINUX_CAPABILITY_VERSION */
+
+
+int main()
+{
+ struct __user_cap_header_struct h;
+ struct __user_cap_data_struct d;
+ int syscall_result;
+
+ h.version = _LINUX_CAPABILITY_VERSION;
+ h.pid = 0;
+ syscall_result = syscall(__NR_capget, &h, &d);
+ if (syscall_result >= 0)
+ {
+ fprintf(stderr,
+ "capget result:\n"
+ "effective %#x\n"
+ "permitted %#x\n"
+ "inheritable %#x\n",
+ d.effective,
+ d.permitted,
+ d.inheritable);
+ }
+ else
+ {
+ perror("capget");
+ }
+ return 0;
+}
+
+
+#else
+
+
+#include <stdio.h>
+
+int main()
+{
+ fprintf(stderr, "This program is Linux-specific\n");
+ return 0;
+}
+
+
+#endif
--- /dev/null
+
+capget result:
+effective 0
+permitted 0
+inheritable 0
+
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+malloc/free: in use at exit: ... bytes in ... blocks.
+malloc/free: ... allocs, ... frees, ... bytes allocated.
+For a detailed leak analysis, rerun with: --leak-check=yes
+For counts of detected errors, rerun with: -v
--- /dev/null
+prog: linux-capget
+stderr_filter: filter_allocs