diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-08-20 04:13:35 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-20 06:12:22 -0400 |
commit | 4539f07701b3f743580d19dc5d655fb8d21b0a3c (patch) | |
tree | 15bb4504cda47f4e5281831eccd91b51dcd4b095 /kernel/trace | |
parent | 540b7b8d65575c80162f2a0f38e1d313c92a6042 (diff) |
tracing/syscalls: Fix the output of syscalls with no arguments
Before:
# echo 1 > events/syscalls/sys_enter_sync/enable
# cat events/syscalls/sys_enter_sync/format
...
field:int nr; offset:12; size:4;
print fmt: "# sync
# cat trace
...
sync-8950 [000] 2366.087670: sys_sync(
After:
# echo 1 > events/syscalls/sys_enter_sync/enable
# cat events/syscalls/sys_enter_sync/format
...
field:int nr; offset:12; size:4;
print fmt: ""
# sync
# cat trace
sync-2134 [001] 136.780735: sys_sync()
Reported-by: Masami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
LKML-Reference: <4A8D05AF.20103@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace_syscalls.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 28e4dae4af21..46c1b977a2cb 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -46,15 +46,22 @@ print_syscall_enter(struct trace_iterator *iter, int flags) | |||
46 | return TRACE_TYPE_PARTIAL_LINE; | 46 | return TRACE_TYPE_PARTIAL_LINE; |
47 | } | 47 | } |
48 | /* parameter values */ | 48 | /* parameter values */ |
49 | ret = trace_seq_printf(s, "%s: %lx%s ", entry->args[i], | 49 | ret = trace_seq_printf(s, "%s: %lx%s", entry->args[i], |
50 | trace->args[i], | 50 | trace->args[i], |
51 | i == entry->nb_args - 1 ? ")" : ","); | 51 | i == entry->nb_args - 1 ? "" : ", "); |
52 | if (!ret) | 52 | if (!ret) |
53 | return TRACE_TYPE_PARTIAL_LINE; | 53 | return TRACE_TYPE_PARTIAL_LINE; |
54 | } | 54 | } |
55 | 55 | ||
56 | ret = trace_seq_putc(s, ')'); | ||
57 | if (!ret) | ||
58 | return TRACE_TYPE_PARTIAL_LINE; | ||
59 | |||
56 | end: | 60 | end: |
57 | trace_seq_printf(s, "\n"); | 61 | ret = trace_seq_putc(s, '\n'); |
62 | if (!ret) | ||
63 | return TRACE_TYPE_PARTIAL_LINE; | ||
64 | |||
58 | return TRACE_TYPE_HANDLED; | 65 | return TRACE_TYPE_HANDLED; |
59 | } | 66 | } |
60 | 67 | ||
@@ -129,24 +136,24 @@ int syscall_enter_format(struct ftrace_event_call *call, struct trace_seq *s) | |||
129 | offset += sizeof(unsigned long); | 136 | offset += sizeof(unsigned long); |
130 | } | 137 | } |
131 | 138 | ||
132 | trace_seq_printf(s, "\nprint fmt: \""); | 139 | trace_seq_puts(s, "\nprint fmt: \""); |
133 | for (i = 0; i < entry->nb_args; i++) { | 140 | for (i = 0; i < entry->nb_args; i++) { |
134 | ret = trace_seq_printf(s, "%s: 0x%%0%zulx%s", entry->args[i], | 141 | ret = trace_seq_printf(s, "%s: 0x%%0%zulx%s", entry->args[i], |
135 | sizeof(unsigned long), | 142 | sizeof(unsigned long), |
136 | i == entry->nb_args - 1 ? "\", " : ", "); | 143 | i == entry->nb_args - 1 ? "" : ", "); |
137 | if (!ret) | 144 | if (!ret) |
138 | return 0; | 145 | return 0; |
139 | } | 146 | } |
147 | trace_seq_putc(s, '"'); | ||
140 | 148 | ||
141 | for (i = 0; i < entry->nb_args; i++) { | 149 | for (i = 0; i < entry->nb_args; i++) { |
142 | ret = trace_seq_printf(s, "((unsigned long)(REC->%s))%s", | 150 | ret = trace_seq_printf(s, ", ((unsigned long)(REC->%s))", |
143 | entry->args[i], | 151 | entry->args[i]); |
144 | i == entry->nb_args - 1 ? "\n" : ", "); | ||
145 | if (!ret) | 152 | if (!ret) |
146 | return 0; | 153 | return 0; |
147 | } | 154 | } |
148 | 155 | ||
149 | return ret; | 156 | return trace_seq_putc(s, '\n'); |
150 | } | 157 | } |
151 | 158 | ||
152 | int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s) | 159 | int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s) |