diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2012-08-22 03:00:29 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-08-22 15:02:59 -0400 |
commit | bffddffde7f9bd093909235a25dbb806fe639dde (patch) | |
tree | 9e290ae4cddff7ae48fa20e1f3312ebcdd418ab4 /tools/lib/traceevent/event-parse.h | |
parent | fd34f0b26c9d0f3c3c5c5f83207efa6324cd19f7 (diff) |
tools lib traceevent: Introduce pevent_errno
Define and use error numbers for pevent_parse_event() and get rid of
die() and do_warning() calls. If the function returns non-zero value,
the caller can check the return code and do appropriate things.
I chose the error numbers to be negative not to clash with standard
errno, and as usual, 0 for success.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1345618831-9148-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/traceevent/event-parse.h')
-rw-r--r-- | tools/lib/traceevent/event-parse.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 5772ad8cb386..3c48229a7bce 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
@@ -345,6 +345,28 @@ enum pevent_flag { | |||
345 | PEVENT_NSEC_OUTPUT = 1, /* output in NSECS */ | 345 | PEVENT_NSEC_OUTPUT = 1, /* output in NSECS */ |
346 | }; | 346 | }; |
347 | 347 | ||
348 | enum pevent_errno { | ||
349 | PEVENT_ERRNO__SUCCESS = 0, | ||
350 | |||
351 | /* | ||
352 | * Choose an arbitrary negative big number not to clash with standard | ||
353 | * errno since SUS requires the errno has distinct positive values. | ||
354 | * See 'Issue 6' in the link below. | ||
355 | * | ||
356 | * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html | ||
357 | */ | ||
358 | __PEVENT_ERRNO__START = -100000, | ||
359 | |||
360 | PEVENT_ERRNO__MEM_ALLOC_FAILED = __PEVENT_ERRNO__START, | ||
361 | PEVENT_ERRNO__PARSE_EVENT_FAILED, | ||
362 | PEVENT_ERRNO__READ_ID_FAILED, | ||
363 | PEVENT_ERRNO__READ_FORMAT_FAILED, | ||
364 | PEVENT_ERRNO__READ_PRINT_FAILED, | ||
365 | PEVENT_ERRNO__OLD_FTRACE_ARG_FAILED, | ||
366 | |||
367 | __PEVENT_ERRNO__END, | ||
368 | }; | ||
369 | |||
348 | struct cmdline; | 370 | struct cmdline; |
349 | struct cmdline_list; | 371 | struct cmdline_list; |
350 | struct func_map; | 372 | struct func_map; |
@@ -509,8 +531,8 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | |||
509 | int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size, | 531 | int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size, |
510 | int long_size); | 532 | int long_size); |
511 | 533 | ||
512 | int pevent_parse_event(struct pevent *pevent, const char *buf, | 534 | enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf, |
513 | unsigned long size, const char *sys); | 535 | unsigned long size, const char *sys); |
514 | 536 | ||
515 | void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, | 537 | void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, |
516 | const char *name, struct pevent_record *record, | 538 | const char *name, struct pevent_record *record, |