Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
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 /* HAVE_LIBCAP_SUPPORT */
0026 
0027 /* For older systems */
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 /* __PERF_CAP_H */