diff options
Diffstat (limited to 'tools/perf/util/util.c')
-rw-r--r-- | tools/perf/util/util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 9c3c97697387..6fd130a5d8f2 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -16,10 +16,12 @@ | |||
16 | #include <string.h> | 16 | #include <string.h> |
17 | #include <errno.h> | 17 | #include <errno.h> |
18 | #include <limits.h> | 18 | #include <limits.h> |
19 | #include <linux/capability.h> | ||
19 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
20 | #include <linux/log2.h> | 21 | #include <linux/log2.h> |
21 | #include <linux/time64.h> | 22 | #include <linux/time64.h> |
22 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | #include "cap.h" | ||
23 | #include "strlist.h" | 25 | #include "strlist.h" |
24 | #include "string2.h" | 26 | #include "string2.h" |
25 | 27 | ||
@@ -403,6 +405,13 @@ int perf_event_paranoid(void) | |||
403 | 405 | ||
404 | return value; | 406 | return value; |
405 | } | 407 | } |
408 | |||
409 | bool perf_event_paranoid_check(int max_level) | ||
410 | { | ||
411 | return perf_cap__capable(CAP_SYS_ADMIN) || | ||
412 | perf_event_paranoid() <= max_level; | ||
413 | } | ||
414 | |||
406 | static int | 415 | static int |
407 | fetch_ubuntu_kernel_version(unsigned int *puint) | 416 | fetch_ubuntu_kernel_version(unsigned int *puint) |
408 | { | 417 | { |