diff options
| author | Josh Stone <jistone@redhat.com> | 2009-08-24 17:43:14 -0400 |
|---|---|---|
| committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-08-25 18:41:48 -0400 |
| commit | 1c569f0264ea629c10bbab471dd0626ce4d3f19f (patch) | |
| tree | 00fcbf85a7318c568f468518c3aa665a200c871e /include/trace | |
| parent | 97419875865859fd2403e66266c02ce028e2f5ab (diff) | |
tracing: Create generic syscall TRACE_EVENTs
This converts the syscall_enter/exit tracepoints into TRACE_EVENTs, so
you can have generic ftrace events that capture all system calls with
arguments and return values. These generic events are also renamed to
sys_enter/exit, so they're more closely aligned to the specific
sys_enter_foo events.
Signed-off-by: Josh Stone <jistone@redhat.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Jiaying Zhang <jiayingz@google.com>
Cc: Martin Bligh <mbligh@google.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
LKML-Reference: <1251150194-1713-5-git-send-email-jistone@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'include/trace')
| -rw-r--r-- | include/trace/events/syscalls.h | 70 | ||||
| -rw-r--r-- | include/trace/syscall.h | 17 |
2 files changed, 70 insertions, 17 deletions
diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h new file mode 100644 index 000000000000..397dff2dbd5a --- /dev/null +++ b/include/trace/events/syscalls.h | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | #undef TRACE_SYSTEM | ||
| 2 | #define TRACE_SYSTEM syscalls | ||
| 3 | |||
| 4 | #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 5 | #define _TRACE_EVENTS_SYSCALLS_H | ||
| 6 | |||
| 7 | #include <linux/tracepoint.h> | ||
| 8 | |||
| 9 | #include <asm/ptrace.h> | ||
| 10 | #include <asm/syscall.h> | ||
| 11 | |||
| 12 | |||
| 13 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS | ||
| 14 | |||
| 15 | extern void syscall_regfunc(void); | ||
| 16 | extern void syscall_unregfunc(void); | ||
| 17 | |||
| 18 | TRACE_EVENT_FN(sys_enter, | ||
| 19 | |||
| 20 | TP_PROTO(struct pt_regs *regs, long id), | ||
| 21 | |||
| 22 | TP_ARGS(regs, id), | ||
| 23 | |||
| 24 | TP_STRUCT__entry( | ||
| 25 | __field( long, id ) | ||
| 26 | __array( unsigned long, args, 6 ) | ||
| 27 | ), | ||
| 28 | |||
| 29 | TP_fast_assign( | ||
| 30 | __entry->id = id; | ||
| 31 | syscall_get_arguments(current, regs, 0, 6, __entry->args); | ||
| 32 | ), | ||
| 33 | |||
| 34 | TP_printk("NR %ld (%lx, %lx, %lx, %lx, %lx, %lx)", | ||
| 35 | __entry->id, | ||
| 36 | __entry->args[0], __entry->args[1], __entry->args[2], | ||
| 37 | __entry->args[3], __entry->args[4], __entry->args[5]), | ||
| 38 | |||
| 39 | syscall_regfunc, syscall_unregfunc | ||
| 40 | ); | ||
| 41 | |||
| 42 | TRACE_EVENT_FN(sys_exit, | ||
| 43 | |||
| 44 | TP_PROTO(struct pt_regs *regs, long ret), | ||
| 45 | |||
| 46 | TP_ARGS(regs, ret), | ||
| 47 | |||
| 48 | TP_STRUCT__entry( | ||
| 49 | __field( long, id ) | ||
| 50 | __field( long, ret ) | ||
| 51 | ), | ||
| 52 | |||
| 53 | TP_fast_assign( | ||
| 54 | __entry->id = syscall_get_nr(current, regs); | ||
| 55 | __entry->ret = ret; | ||
| 56 | ), | ||
| 57 | |||
| 58 | TP_printk("NR %ld = %ld", | ||
| 59 | __entry->id, __entry->ret), | ||
| 60 | |||
| 61 | syscall_regfunc, syscall_unregfunc | ||
| 62 | ); | ||
| 63 | |||
| 64 | #endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */ | ||
| 65 | |||
| 66 | #endif /* _TRACE_EVENTS_SYSCALLS_H */ | ||
| 67 | |||
| 68 | /* This part must be outside protection */ | ||
| 69 | #include <trace/define_trace.h> | ||
| 70 | |||
diff --git a/include/trace/syscall.h b/include/trace/syscall.h index 4e1943001854..5dc283ba5ae0 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h | |||
| @@ -8,23 +8,6 @@ | |||
| 8 | #include <asm/ptrace.h> | 8 | #include <asm/ptrace.h> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS | ||
| 12 | |||
| 13 | extern void syscall_regfunc(void); | ||
| 14 | extern void syscall_unregfunc(void); | ||
| 15 | |||
| 16 | DECLARE_TRACE(syscall_enter, | ||
| 17 | TP_PROTO(struct pt_regs *regs, long id), | ||
| 18 | TP_ARGS(regs, id) | ||
| 19 | ); | ||
| 20 | |||
| 21 | DECLARE_TRACE(syscall_exit, | ||
| 22 | TP_PROTO(struct pt_regs *regs, long ret), | ||
| 23 | TP_ARGS(regs, ret) | ||
| 24 | ); | ||
| 25 | |||
| 26 | #endif | ||
| 27 | |||
| 28 | /* | 11 | /* |
| 29 | * A syscall entry in the ftrace syscalls array. | 12 | * A syscall entry in the ftrace syscalls array. |
| 30 | * | 13 | * |
