diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-09-07 04:38:06 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-15 08:48:33 -0400 |
commit | 8dd2a1317eba2c207632dcb19adb7cb746861652 (patch) | |
tree | 15d062f65152a883e2dd459f397bbcf5b1cffe68 /tools/perf/builtin-trace.c | |
parent | e2f9f8ea6a54e252e3a94a5c2321f673b5b97360 (diff) |
perf evsel: Propagate error info from tp_format
Propagate error info from tp_format via ERR_PTR to get it all the way
down to the parse-event.c tracepoint adding routines. Following
functions now return pointer with encoded error:
- tp_format
- trace_event__tp_format
- perf_evsel__newtp_idx
- perf_evsel__newtp
This affects several other places in perf, that cannot use pointer check
anymore, but must utilize the err.h interface, when getting error
information from above functions list.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Link: http://lkml.kernel.org/r/1441615087-13886-5-git-send-email-jolsa@kernel.org
[ Add two missing ERR_PTR() and one IS_ERR() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 215653274102..93b80f12f35e 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <sys/mman.h> | 39 | #include <sys/mman.h> |
40 | #include <linux/futex.h> | 40 | #include <linux/futex.h> |
41 | #include <linux/err.h> | ||
41 | 42 | ||
42 | /* For older distros: */ | 43 | /* For older distros: */ |
43 | #ifndef MAP_STACK | 44 | #ifndef MAP_STACK |
@@ -245,13 +246,14 @@ static struct perf_evsel *perf_evsel__syscall_newtp(const char *direction, void | |||
245 | struct perf_evsel *evsel = perf_evsel__newtp("raw_syscalls", direction); | 246 | struct perf_evsel *evsel = perf_evsel__newtp("raw_syscalls", direction); |
246 | 247 | ||
247 | /* older kernel (e.g., RHEL6) use syscalls:{enter,exit} */ | 248 | /* older kernel (e.g., RHEL6) use syscalls:{enter,exit} */ |
248 | if (evsel == NULL) | 249 | if (IS_ERR(evsel)) |
249 | evsel = perf_evsel__newtp("syscalls", direction); | 250 | evsel = perf_evsel__newtp("syscalls", direction); |
250 | 251 | ||
251 | if (evsel) { | 252 | if (IS_ERR(evsel)) |
252 | if (perf_evsel__init_syscall_tp(evsel, handler)) | 253 | return NULL; |
253 | goto out_delete; | 254 | |
254 | } | 255 | if (perf_evsel__init_syscall_tp(evsel, handler)) |
256 | goto out_delete; | ||
255 | 257 | ||
256 | return evsel; | 258 | return evsel; |
257 | 259 | ||
@@ -1705,12 +1707,12 @@ static int trace__read_syscall_info(struct trace *trace, int id) | |||
1705 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name); | 1707 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name); |
1706 | sc->tp_format = trace_event__tp_format("syscalls", tp_name); | 1708 | sc->tp_format = trace_event__tp_format("syscalls", tp_name); |
1707 | 1709 | ||
1708 | if (sc->tp_format == NULL && sc->fmt && sc->fmt->alias) { | 1710 | if (IS_ERR(sc->tp_format) && sc->fmt && sc->fmt->alias) { |
1709 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->fmt->alias); | 1711 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->fmt->alias); |
1710 | sc->tp_format = trace_event__tp_format("syscalls", tp_name); | 1712 | sc->tp_format = trace_event__tp_format("syscalls", tp_name); |
1711 | } | 1713 | } |
1712 | 1714 | ||
1713 | if (sc->tp_format == NULL) | 1715 | if (IS_ERR(sc->tp_format)) |
1714 | return -1; | 1716 | return -1; |
1715 | 1717 | ||
1716 | sc->args = sc->tp_format->format.fields; | 1718 | sc->args = sc->tp_format->format.fields; |
@@ -2390,7 +2392,8 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp); | |||
2390 | static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) | 2392 | static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) |
2391 | { | 2393 | { |
2392 | struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); | 2394 | struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); |
2393 | if (evsel == NULL) | 2395 | |
2396 | if (IS_ERR(evsel)) | ||
2394 | return false; | 2397 | return false; |
2395 | 2398 | ||
2396 | if (perf_evsel__field(evsel, "pathname") == NULL) { | 2399 | if (perf_evsel__field(evsel, "pathname") == NULL) { |