Merge tag '6.9-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6
[linux-2.6-block.git] / tools / perf / util / cap.h
CommitLineData
c22e150e
IL
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __PERF_CAP_H
3#define __PERF_CAP_H
4
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
13bool perf_cap__capable(cap_value_t cap);
14
15#else
16
17#include <unistd.h>
18#include <sys/types.h>
19
20static inline bool perf_cap__capable(int cap __maybe_unused)
21{
22 return geteuid() == 0;
23}
24
25#endif /* HAVE_LIBCAP_SUPPORT */
26
083c1359
ACM
27/* For older systems */
28#ifndef CAP_SYSLOG
29#define CAP_SYSLOG 34
30#endif
31
6b3e0e2e
AB
32#ifndef CAP_PERFMON
33#define CAP_PERFMON 38
34#endif
35
c22e150e 36#endif /* __PERF_CAP_H */