1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __PERF_CAP_H 2 #ifndef __PERF_CAP_H 3 #define __PERF_CAP_H 3 #define __PERF_CAP_H 4 4 5 #include <stdbool.h> 5 #include <stdbool.h> >> 6 #include <linux/capability.h> >> 7 #include <linux/compiler.h> >> 8 >> 9 #ifdef HAVE_LIBCAP_SUPPORT >> 10 >> 11 #include <sys/capability.h> >> 12 >> 13 bool perf_cap__capable(cap_value_t cap); >> 14 >> 15 #else >> 16 >> 17 #include <unistd.h> >> 18 #include <sys/types.h> >> 19 >> 20 static inline bool perf_cap__capable(int cap __maybe_unused) >> 21 { >> 22 return geteuid() == 0; >> 23 } >> 24 >> 25 #endif /* HAVE_LIBCAP_SUPPORT */ 6 26 7 /* For older systems */ 27 /* For older systems */ 8 #ifndef CAP_SYSLOG 28 #ifndef CAP_SYSLOG 9 #define CAP_SYSLOG 34 29 #define CAP_SYSLOG 34 10 #endif 30 #endif 11 << 12 #ifndef CAP_PERFMON << 13 #define CAP_PERFMON 38 << 14 #endif << 15 << 16 /* Query if a capability is supported, used_ro << 17 bool perf_cap__capable(int cap, bool *used_roo << 18 31 19 #endif /* __PERF_CAP_H */ 32 #endif /* __PERF_CAP_H */ 20 33
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.