diff options
author | 2017-10-20 11:02:05 +0200 | |
---|---|---|
committer | 2017-10-20 11:02:05 +0200 | |
commit | ca4b9c3b743da39a6e0756a5c68edb35f6fc5e53 (patch) | |
tree | 95ce0819f92e25bc4d768ab13cee1f385a83a7b2 /tools/perf/util/parse-events.l | |
parent | kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT=y (diff) | |
parent | Merge tag 'perf-urgent-for-mingo-4.14-20171019' of git://git.kernel.org/pub/s... (diff) | |
download | linux-ca4b9c3b743da39a6e0756a5c68edb35f6fc5e53.tar.gz linux-ca4b9c3b743da39a6e0756a5c68edb35f6fc5e53.tar.bz2 linux-ca4b9c3b743da39a6e0756a5c68edb35f6fc5e53.zip |
Merge branch 'perf/urgent' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/parse-events.l')
-rw-r--r-- | tools/perf/util/parse-events.l | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index ea2426daf7e8..38a42bdf1492 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -8,6 +8,9 @@ %{ #include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include "../perf.h" #include "parse-events.h" #include "parse-events-bison.h" @@ -53,9 +56,8 @@ static int str(yyscan_t scanner, int token) return token; } -static bool isbpf(yyscan_t scanner) +static bool isbpf_suffix(char *text) { - char *text = parse_events_get_text(scanner); int len = strlen(text); if (len < 2) @@ -68,6 +70,17 @@ static bool isbpf(yyscan_t scanner) return false; } +static bool isbpf(yyscan_t scanner) +{ + char *text = parse_events_get_text(scanner); + struct stat st; + + if (!isbpf_suffix(text)) + return false; + + return stat(text, &st) == 0; +} + /* * This function is called when the parser gets two kind of input: * |