mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 22:51:35 +00:00
083c1359b0
Some of the systems I test don't have that define, provide it conditionally since we'll use it in the kptr_restrict checks in the next patch. Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Igor Lubashev <ilubashe@akamai.com> Cc: James Morris <jmorris@namei.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Link: https://lkml.kernel.org/n/tip-dcize2v6jjab7tds5ngz97dk@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
33 lines
535 B
C
33 lines
535 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __PERF_CAP_H
|
|
#define __PERF_CAP_H
|
|
|
|
#include <stdbool.h>
|
|
#include <linux/capability.h>
|
|
#include <linux/compiler.h>
|
|
|
|
#ifdef HAVE_LIBCAP_SUPPORT
|
|
|
|
#include <sys/capability.h>
|
|
|
|
bool perf_cap__capable(cap_value_t cap);
|
|
|
|
#else
|
|
|
|
#include <unistd.h>
|
|
#include <sys/types.h>
|
|
|
|
static inline bool perf_cap__capable(int cap __maybe_unused)
|
|
{
|
|
return geteuid() == 0;
|
|
}
|
|
|
|
#endif /* HAVE_LIBCAP_SUPPORT */
|
|
|
|
/* For older systems */
|
|
#ifndef CAP_SYSLOG
|
|
#define CAP_SYSLOG 34
|
|
#endif
|
|
|
|
#endif /* __PERF_CAP_H */
|