0001
0002 #ifndef __PERF_CAP_H
0003 #define __PERF_CAP_H
0004
0005 #include <stdbool.h>
0006 #include <linux/capability.h>
0007 #include <linux/compiler.h>
0008
0009 #ifdef HAVE_LIBCAP_SUPPORT
0010
0011 #include <sys/capability.h>
0012
0013 bool perf_cap__capable(cap_value_t cap);
0014
0015 #else
0016
0017 #include <unistd.h>
0018 #include <sys/types.h>
0019
0020 static inline bool perf_cap__capable(int cap __maybe_unused)
0021 {
0022 return geteuid() == 0;
0023 }
0024
0025 #endif
0026
0027
0028 #ifndef CAP_SYSLOG
0029 #define CAP_SYSLOG 34
0030 #endif
0031
0032 #ifndef CAP_PERFMON
0033 #define CAP_PERFMON 38
0034 #endif
0035
0036 #endif