Frederic Weisbecker | 47788c5 | 2009-04-08 20:40:59 +0200 | [diff] [blame] | 1 | #ifndef _TRACE_SYSCALL_H |
| 2 | #define _TRACE_SYSCALL_H |
| 3 | |
Jason Baron | a871bd3 | 2009-08-10 16:52:31 -0400 | [diff] [blame] | 4 | #include <linux/tracepoint.h> |
Jason Baron | fb34a08 | 2009-08-10 16:52:47 -0400 | [diff] [blame] | 5 | #include <linux/unistd.h> |
| 6 | #include <linux/ftrace_event.h> |
Jason Baron | a871bd3 | 2009-08-10 16:52:31 -0400 | [diff] [blame] | 7 | |
Frederic Weisbecker | 47788c5 | 2009-04-08 20:40:59 +0200 | [diff] [blame] | 8 | #include <asm/ptrace.h> |
| 9 | |
Jason Baron | a871bd3 | 2009-08-10 16:52:31 -0400 | [diff] [blame] | 10 | |
| 11 | extern void syscall_regfunc(void); |
| 12 | extern void syscall_unregfunc(void); |
| 13 | |
| 14 | DECLARE_TRACE_WITH_CALLBACK(syscall_enter, |
| 15 | TP_PROTO(struct pt_regs *regs, long id), |
| 16 | TP_ARGS(regs, id), |
| 17 | syscall_regfunc, |
| 18 | syscall_unregfunc |
| 19 | ); |
| 20 | |
| 21 | DECLARE_TRACE_WITH_CALLBACK(syscall_exit, |
| 22 | TP_PROTO(struct pt_regs *regs, long ret), |
| 23 | TP_ARGS(regs, ret), |
| 24 | syscall_regfunc, |
| 25 | syscall_unregfunc |
| 26 | ); |
| 27 | |
Frederic Weisbecker | 47788c5 | 2009-04-08 20:40:59 +0200 | [diff] [blame] | 28 | /* |
| 29 | * A syscall entry in the ftrace syscalls array. |
| 30 | * |
| 31 | * @name: name of the syscall |
| 32 | * @nb_args: number of parameters it takes |
| 33 | * @types: list of types as strings |
| 34 | * @args: list of args as strings (args[i] matches types[i]) |
Jason Baron | 64c12e0 | 2009-08-10 16:52:53 -0400 | [diff] [blame^] | 35 | * @enter_id: associated ftrace enter event id |
| 36 | * @exit_id: associated ftrace exit event id |
Frederic Weisbecker | 47788c5 | 2009-04-08 20:40:59 +0200 | [diff] [blame] | 37 | */ |
| 38 | struct syscall_metadata { |
| 39 | const char *name; |
| 40 | int nb_args; |
| 41 | const char **types; |
| 42 | const char **args; |
Jason Baron | 64c12e0 | 2009-08-10 16:52:53 -0400 | [diff] [blame^] | 43 | int enter_id; |
| 44 | int exit_id; |
Frederic Weisbecker | 47788c5 | 2009-04-08 20:40:59 +0200 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | #ifdef CONFIG_FTRACE_SYSCALLS |
Frederic Weisbecker | 47788c5 | 2009-04-08 20:40:59 +0200 | [diff] [blame] | 48 | extern struct syscall_metadata *syscall_nr_to_meta(int nr); |
Jason Baron | fb34a08 | 2009-08-10 16:52:47 -0400 | [diff] [blame] | 49 | extern int syscall_name_to_nr(char *name); |
Jason Baron | 64c12e0 | 2009-08-10 16:52:53 -0400 | [diff] [blame^] | 50 | void set_syscall_enter_id(int num, int id); |
| 51 | void set_syscall_exit_id(int num, int id); |
Jason Baron | fb34a08 | 2009-08-10 16:52:47 -0400 | [diff] [blame] | 52 | extern struct trace_event event_syscall_enter; |
| 53 | extern struct trace_event event_syscall_exit; |
| 54 | extern int reg_event_syscall_enter(void *ptr); |
| 55 | extern void unreg_event_syscall_enter(void *ptr); |
| 56 | extern int reg_event_syscall_exit(void *ptr); |
| 57 | extern void unreg_event_syscall_exit(void *ptr); |
Jason Baron | 64c12e0 | 2009-08-10 16:52:53 -0400 | [diff] [blame^] | 58 | enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags); |
| 59 | enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); |
Frederic Weisbecker | 47788c5 | 2009-04-08 20:40:59 +0200 | [diff] [blame] | 60 | #endif |
| 61 | |
| 62 | #endif /* _TRACE_SYSCALL_H */ |