WIP FPC-III support
[linux/fpc-iii.git] / tools / perf / util / cap.h
blobae52878c0b2e69d976159f0e83a65978c2c7f7df
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_CAP_H
3 #define __PERF_CAP_H
5 #include <stdbool.h>
6 #include <linux/capability.h>
7 #include <linux/compiler.h>
9 #ifdef HAVE_LIBCAP_SUPPORT
11 #include <sys/capability.h>
13 bool perf_cap__capable(cap_value_t cap);
15 #else
17 #include <unistd.h>
18 #include <sys/types.h>
20 static inline bool perf_cap__capable(int cap __maybe_unused)
22 return geteuid() == 0;
25 #endif /* HAVE_LIBCAP_SUPPORT */
27 /* For older systems */
28 #ifndef CAP_SYSLOG
29 #define CAP_SYSLOG 34
30 #endif
32 #ifndef CAP_PERFMON
33 #define CAP_PERFMON 38
34 #endif
36 #endif /* __PERF_CAP_H */