Commit 4539f077 authored by Li Zefan's avatar Li Zefan Committed by Ingo Molnar

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: default avatarMasami Hiramatsu <mhiramat@redhat.com>
Signed-off-by: default avatarLi 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: default avatarIngo Molnar <mingo@elte.hu>
parent 540b7b8d
...@@ -46,15 +46,22 @@ print_syscall_enter(struct trace_iterator *iter, int flags) ...@@ -46,15 +46,22 @@ print_syscall_enter(struct trace_iterator *iter, int flags)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
/* parameter values */ /* parameter values */
ret = trace_seq_printf(s, "%s: %lx%s ", entry->args[i], ret = trace_seq_printf(s, "%s: %lx%s", entry->args[i],
trace->args[i], trace->args[i],
i == entry->nb_args - 1 ? ")" : ","); i == entry->nb_args - 1 ? "" : ", ");
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
} }
ret = trace_seq_putc(s, ')');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
end: end:
trace_seq_printf(s, "\n"); ret = trace_seq_putc(s, '\n');
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED; return TRACE_TYPE_HANDLED;
} }
...@@ -129,24 +136,24 @@ int syscall_enter_format(struct ftrace_event_call *call, struct trace_seq *s) ...@@ -129,24 +136,24 @@ int syscall_enter_format(struct ftrace_event_call *call, struct trace_seq *s)
offset += sizeof(unsigned long); offset += sizeof(unsigned long);
} }
trace_seq_printf(s, "\nprint fmt: \""); trace_seq_puts(s, "\nprint fmt: \"");
for (i = 0; i < entry->nb_args; i++) { for (i = 0; i < entry->nb_args; i++) {
ret = trace_seq_printf(s, "%s: 0x%%0%zulx%s", entry->args[i], ret = trace_seq_printf(s, "%s: 0x%%0%zulx%s", entry->args[i],
sizeof(unsigned long), sizeof(unsigned long),
i == entry->nb_args - 1 ? "\", " : ", "); i == entry->nb_args - 1 ? "" : ", ");
if (!ret) if (!ret)
return 0; return 0;
} }
trace_seq_putc(s, '"');
for (i = 0; i < entry->nb_args; i++) { for (i = 0; i < entry->nb_args; i++) {
ret = trace_seq_printf(s, "((unsigned long)(REC->%s))%s", ret = trace_seq_printf(s, ", ((unsigned long)(REC->%s))",
entry->args[i], entry->args[i]);
i == entry->nb_args - 1 ? "\n" : ", ");
if (!ret) if (!ret)
return 0; return 0;
} }
return ret; return trace_seq_putc(s, '\n');
} }
int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s) int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment