diff options
-rw-r--r-- | kernel/trace/trace_events.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index d57a772981c1..cdcc3aed76fd 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/ctype.h> | 14 | #include <linux/ctype.h> |
15 | 15 | ||
16 | #include "trace.h" | 16 | #include "trace_output.h" |
17 | 17 | ||
18 | #define TRACE_SYSTEM "TRACE_SYSTEM" | 18 | #define TRACE_SYSTEM "TRACE_SYSTEM" |
19 | 19 | ||
@@ -447,6 +447,28 @@ event_available_types_read(struct file *filp, char __user *ubuf, size_t cnt, | |||
447 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); | 447 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); |
448 | } | 448 | } |
449 | 449 | ||
450 | #undef FIELD | ||
451 | #define FIELD(type, name) \ | ||
452 | #type, #name, offsetof(typeof(field), name), sizeof(field.name) | ||
453 | |||
454 | static int trace_write_header(struct trace_seq *s) | ||
455 | { | ||
456 | struct trace_entry field; | ||
457 | |||
458 | /* struct trace_entry */ | ||
459 | return trace_seq_printf(s, | ||
460 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
461 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
462 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
463 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
464 | "\tfield:%s %s;\toffset:%lu;\tsize:%lu;\n" | ||
465 | "\n", | ||
466 | FIELD(unsigned char, type), | ||
467 | FIELD(unsigned char, flags), | ||
468 | FIELD(unsigned char, preempt_count), | ||
469 | FIELD(int, pid), | ||
470 | FIELD(int, tgid)); | ||
471 | } | ||
450 | static ssize_t | 472 | static ssize_t |
451 | event_format_read(struct file *filp, char __user *ubuf, size_t cnt, | 473 | event_format_read(struct file *filp, char __user *ubuf, size_t cnt, |
452 | loff_t *ppos) | 474 | loff_t *ppos) |
@@ -465,6 +487,9 @@ event_format_read(struct file *filp, char __user *ubuf, size_t cnt, | |||
465 | if (*ppos) | 487 | if (*ppos) |
466 | return 0; | 488 | return 0; |
467 | 489 | ||
490 | /* If this fails, so will the show_format. */ | ||
491 | trace_write_header(s); | ||
492 | |||
468 | r = call->show_format(s); | 493 | r = call->show_format(s); |
469 | if (!r) { | 494 | if (!r) { |
470 | /* | 495 | /* |