tracing: Add syscall tracepoints
[cascardo/linux.git] / include / trace / syscall.h
1 #ifndef _TRACE_SYSCALL_H
2 #define _TRACE_SYSCALL_H
3
4 #include <linux/tracepoint.h>
5
6 #include <asm/ptrace.h>
7
8
9 extern void syscall_regfunc(void);
10 extern void syscall_unregfunc(void);
11
12 DECLARE_TRACE_WITH_CALLBACK(syscall_enter,
13         TP_PROTO(struct pt_regs *regs, long id),
14         TP_ARGS(regs, id),
15         syscall_regfunc,
16         syscall_unregfunc
17 );
18
19 DECLARE_TRACE_WITH_CALLBACK(syscall_exit,
20         TP_PROTO(struct pt_regs *regs, long ret),
21         TP_ARGS(regs, ret),
22         syscall_regfunc,
23         syscall_unregfunc
24 );
25
26 /*
27  * A syscall entry in the ftrace syscalls array.
28  *
29  * @name: name of the syscall
30  * @nb_args: number of parameters it takes
31  * @types: list of types as strings
32  * @args: list of args as strings (args[i] matches types[i])
33  */
34 struct syscall_metadata {
35         const char      *name;
36         int             nb_args;
37         const char      **types;
38         const char      **args;
39 };
40
41 #ifdef CONFIG_FTRACE_SYSCALLS
42 extern struct syscall_metadata *syscall_nr_to_meta(int nr);
43 extern void start_ftrace_syscalls(void);
44 extern void stop_ftrace_syscalls(void);
45 extern void ftrace_syscall_enter(struct pt_regs *regs);
46 extern void ftrace_syscall_exit(struct pt_regs *regs);
47 #else
48 static inline void start_ftrace_syscalls(void)                  { }
49 static inline void stop_ftrace_syscalls(void)                   { }
50 static inline void ftrace_syscall_enter(struct pt_regs *regs)   { }
51 static inline void ftrace_syscall_exit(struct pt_regs *regs)    { }
52 #endif
53
54 #endif /* _TRACE_SYSCALL_H */