mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 15:33:28 +00:00
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 <[email protected]> Cc: Alexey Budankov <[email protected]> Cc: Igor Lubashev <[email protected]> Cc: James Morris <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Suzuki Poulouse <[email protected]> Link: https://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
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 */
|