aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-08-19 03:53:05 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-19 09:02:23 -0400
commit10a5b66f625904ad5a2867cf7a28073e1236ff32 (patch)
tree165c3d0f480e2862d3d97f3f3ceecad9c1cdc8b8
parente6971969c331caa5c3c88cbd1be4f465b3355452 (diff)
tracing/syscalls: Add fields format for exit events
Add "format" file for syscall exit events: # cat events/syscalls/sys_exit_open/format name: sys_exit_open ID: 344 format: field:unsigned short common_type; offset:0; size:2; field:unsigned char common_flags; offset:2; size:1; field:unsigned char common_preempt_count; offset:3; size:1; field:int common_pid; offset:4; size:4; field:int common_tgid; offset:8; size:4; field:int nr; offset:12; size:4; field:unsigned long ret; offset:16; size:4; Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Jason Baron <jbaron@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4A8BAF61.3060307@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--include/trace/syscall.h6
-rw-r--r--kernel/trace/trace_syscalls.c18
3 files changed, 23 insertions, 4 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 87d06c173ddc..8d57f77794ee 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -189,7 +189,7 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *event_call) \
189 .system = "syscalls", \ 189 .system = "syscalls", \
190 .event = &event_syscall_enter, \ 190 .event = &event_syscall_enter, \
191 .raw_init = init_enter_##sname, \ 191 .raw_init = init_enter_##sname, \
192 .show_format = ftrace_format_syscall, \ 192 .show_format = syscall_enter_format, \
193 .regfunc = reg_event_syscall_enter, \ 193 .regfunc = reg_event_syscall_enter, \
194 .unregfunc = unreg_event_syscall_enter, \ 194 .unregfunc = unreg_event_syscall_enter, \
195 .data = "sys"#sname, \ 195 .data = "sys"#sname, \
@@ -225,6 +225,7 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *event_call) \
225 .system = "syscalls", \ 225 .system = "syscalls", \
226 .event = &event_syscall_exit, \ 226 .event = &event_syscall_exit, \
227 .raw_init = init_exit_##sname, \ 227 .raw_init = init_exit_##sname, \
228 .show_format = syscall_exit_format, \
228 .regfunc = reg_event_syscall_exit, \ 229 .regfunc = reg_event_syscall_exit, \
229 .unregfunc = unreg_event_syscall_exit, \ 230 .unregfunc = unreg_event_syscall_exit, \
230 .data = "sys"#sname, \ 231 .data = "sys"#sname, \
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index 0cb03625edd9..5ce85d75d31b 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -55,8 +55,10 @@ extern int reg_event_syscall_enter(void *ptr);
55extern void unreg_event_syscall_enter(void *ptr); 55extern void unreg_event_syscall_enter(void *ptr);
56extern int reg_event_syscall_exit(void *ptr); 56extern int reg_event_syscall_exit(void *ptr);
57extern void unreg_event_syscall_exit(void *ptr); 57extern void unreg_event_syscall_exit(void *ptr);
58extern int 58extern int syscall_enter_format(struct ftrace_event_call *call,
59ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s); 59 struct trace_seq *s);
60extern int syscall_exit_format(struct ftrace_event_call *call,
61 struct trace_seq *s);
60enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags); 62enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
61enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); 63enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
62#endif 64#endif
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index d10daf0922b5..7336b6c265d7 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -97,7 +97,7 @@ extern char *__bad_type_size(void);
97 __bad_type_size() : \ 97 __bad_type_size() : \
98 #type, #name, offsetof(typeof(trace), name), sizeof(trace.name) 98 #type, #name, offsetof(typeof(trace), name), sizeof(trace.name)
99 99
100int ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s) 100int syscall_enter_format(struct ftrace_event_call *call, struct trace_seq *s)
101{ 101{
102 int i; 102 int i;
103 int nr; 103 int nr;
@@ -149,6 +149,22 @@ int ftrace_format_syscall(struct ftrace_event_call *call, struct trace_seq *s)
149 return ret; 149 return ret;
150} 150}
151 151
152int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s)
153{
154 int ret;
155 struct syscall_trace_exit trace;
156
157 ret = trace_seq_printf(s,
158 "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
159 "\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n",
160 SYSCALL_FIELD(int, nr),
161 SYSCALL_FIELD(unsigned long, ret));
162 if (!ret)
163 return 0;
164
165 return trace_seq_printf(s, "\nprint fmt: \"0x%%lx\", REC->ret\n");
166}
167
152void ftrace_syscall_enter(struct pt_regs *regs, long id) 168void ftrace_syscall_enter(struct pt_regs *regs, long id)
153{ 169{
154 struct syscall_trace_enter *entry; 170 struct syscall_trace_enter *entry;