aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/parse-events.l
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-10-20 09:14:06 +0200
committerIngo Molnar <mingo@kernel.org>2017-10-20 09:14:06 +0200
commit275d34b82561e695339b782950d49c386169dae3 (patch)
tree0af1bd7c6cc6d7e9723cf25feb4e99e666d16736 /tools/perf/util/parse-events.l
parentMerge tag 'pm-4.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm (diff)
parentperf test shell trace+probe_libc_inet_pton.sh: Be compatible with Debian/Ubuntu (diff)
downloadlinux-dev-275d34b82561e695339b782950d49c386169dae3.tar.xz
linux-dev-275d34b82561e695339b782950d49c386169dae3.zip
Merge tag 'perf-urgent-for-mingo-4.14-20171019' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo: - Fix crash in perf_hpp__reset_output_field() (Jiri Olsa) - Fix eBPF file/vendor events ambiguity in event specification (Jiri Olsa) - Fix closing evsel fd in 'perf stat' (Jin Yao) - Make perf test shell trace+probe_libc_inet_pton.sh pass in Debian/Ubuntu (Li Zhijian) - Fix 'perf buildid-list --with-hits' crash when processing PERF_RECORD_NAMESPACE (Namhyung Kim) - Fix documentation for an inexistent option 'perf record -l' (Taeung Song) - Add long time reviewers to MAINTAINERS (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> 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.l17
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index c42edeac451f..dcfdafdc2f1c 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:
*