Commit | Line | Data |
---|---|---|
47788c58 FW |
1 | #ifndef _TRACE_SYSCALL_H |
2 | #define _TRACE_SYSCALL_H | |
3 | ||
a871bd33 | 4 | #include <linux/tracepoint.h> |
fb34a08c JB |
5 | #include <linux/unistd.h> |
6 | #include <linux/ftrace_event.h> | |
a871bd33 | 7 | |
47788c58 FW |
8 | #include <asm/ptrace.h> |
9 | ||
a871bd33 | 10 | |
3d27d8cb JS |
11 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS |
12 | ||
a871bd33 JB |
13 | extern void syscall_regfunc(void); |
14 | extern void syscall_unregfunc(void); | |
15 | ||
16 | DECLARE_TRACE_WITH_CALLBACK(syscall_enter, | |
17 | TP_PROTO(struct pt_regs *regs, long id), | |
18 | TP_ARGS(regs, id), | |
19 | syscall_regfunc, | |
20 | syscall_unregfunc | |
21 | ); | |
22 | ||
23 | DECLARE_TRACE_WITH_CALLBACK(syscall_exit, | |
24 | TP_PROTO(struct pt_regs *regs, long ret), | |
25 | TP_ARGS(regs, ret), | |
26 | syscall_regfunc, | |
27 | syscall_unregfunc | |
28 | ); | |
29 | ||
3d27d8cb JS |
30 | #endif |
31 | ||
47788c58 FW |
32 | /* |
33 | * A syscall entry in the ftrace syscalls array. | |
34 | * | |
35 | * @name: name of the syscall | |
36 | * @nb_args: number of parameters it takes | |
37 | * @types: list of types as strings | |
38 | * @args: list of args as strings (args[i] matches types[i]) | |
64c12e04 JB |
39 | * @enter_id: associated ftrace enter event id |
40 | * @exit_id: associated ftrace exit event id | |
540b7b8d LZ |
41 | * @enter_event: associated syscall_enter trace event |
42 | * @exit_event: associated syscall_exit trace event | |
47788c58 FW |
43 | */ |
44 | struct syscall_metadata { | |
45 | const char *name; | |
46 | int nb_args; | |
47 | const char **types; | |
48 | const char **args; | |
64c12e04 JB |
49 | int enter_id; |
50 | int exit_id; | |
540b7b8d LZ |
51 | |
52 | struct ftrace_event_call *enter_event; | |
53 | struct ftrace_event_call *exit_event; | |
47788c58 FW |
54 | }; |
55 | ||
56 | #ifdef CONFIG_FTRACE_SYSCALLS | |
47788c58 | 57 | extern struct syscall_metadata *syscall_nr_to_meta(int nr); |
fb34a08c | 58 | extern int syscall_name_to_nr(char *name); |
64c12e04 JB |
59 | void set_syscall_enter_id(int num, int id); |
60 | void set_syscall_exit_id(int num, int id); | |
fb34a08c JB |
61 | extern struct trace_event event_syscall_enter; |
62 | extern struct trace_event event_syscall_exit; | |
63 | extern int reg_event_syscall_enter(void *ptr); | |
64 | extern void unreg_event_syscall_enter(void *ptr); | |
65 | extern int reg_event_syscall_exit(void *ptr); | |
66 | extern void unreg_event_syscall_exit(void *ptr); | |
10a5b66f LZ |
67 | extern int syscall_enter_format(struct ftrace_event_call *call, |
68 | struct trace_seq *s); | |
69 | extern int syscall_exit_format(struct ftrace_event_call *call, | |
70 | struct trace_seq *s); | |
540b7b8d LZ |
71 | extern int syscall_enter_define_fields(struct ftrace_event_call *call); |
72 | extern int syscall_exit_define_fields(struct ftrace_event_call *call); | |
64c12e04 JB |
73 | enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags); |
74 | enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); | |
f4b5ffcc JB |
75 | #endif |
76 | #ifdef CONFIG_EVENT_PROFILE | |
77 | int reg_prof_syscall_enter(char *name); | |
78 | void unreg_prof_syscall_enter(char *name); | |
79 | int reg_prof_syscall_exit(char *name); | |
80 | void unreg_prof_syscall_exit(char *name); | |
81 | ||
47788c58 FW |
82 | #endif |
83 | ||
84 | #endif /* _TRACE_SYSCALL_H */ |