blob: df628404241af048352a44d735826b3effc48c14 [file] [log] [blame]
Frederic Weisbecker47788c52009-04-08 20:40:59 +02001#ifndef _TRACE_SYSCALL_H
2#define _TRACE_SYSCALL_H
3
Jason Barona871bd32009-08-10 16:52:31 -04004#include <linux/tracepoint.h>
Jason Baronfb34a082009-08-10 16:52:47 -04005#include <linux/unistd.h>
6#include <linux/ftrace_event.h>
Jason Barona871bd32009-08-10 16:52:31 -04007
Frederic Weisbecker47788c52009-04-08 20:40:59 +02008#include <asm/ptrace.h>
9
Jason Barona871bd32009-08-10 16:52:31 -040010
11extern void syscall_regfunc(void);
12extern void syscall_unregfunc(void);
13
14DECLARE_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
21DECLARE_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 Weisbecker47788c52009-04-08 20:40:59 +020028/*
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 Baron64c12e02009-08-10 16:52:53 -040035 * @enter_id: associated ftrace enter event id
36 * @exit_id: associated ftrace exit event id
Frederic Weisbecker47788c52009-04-08 20:40:59 +020037 */
38struct syscall_metadata {
39 const char *name;
40 int nb_args;
41 const char **types;
42 const char **args;
Jason Baron64c12e02009-08-10 16:52:53 -040043 int enter_id;
44 int exit_id;
Frederic Weisbecker47788c52009-04-08 20:40:59 +020045};
46
47#ifdef CONFIG_FTRACE_SYSCALLS
Frederic Weisbecker47788c52009-04-08 20:40:59 +020048extern struct syscall_metadata *syscall_nr_to_meta(int nr);
Jason Baronfb34a082009-08-10 16:52:47 -040049extern int syscall_name_to_nr(char *name);
Jason Baron64c12e02009-08-10 16:52:53 -040050void set_syscall_enter_id(int num, int id);
51void set_syscall_exit_id(int num, int id);
Jason Baronfb34a082009-08-10 16:52:47 -040052extern struct trace_event event_syscall_enter;
53extern struct trace_event event_syscall_exit;
54extern int reg_event_syscall_enter(void *ptr);
55extern void unreg_event_syscall_enter(void *ptr);
56extern int reg_event_syscall_exit(void *ptr);
57extern void unreg_event_syscall_exit(void *ptr);
Jason Baron64c12e02009-08-10 16:52:53 -040058enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
59enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
Frederic Weisbecker47788c52009-04-08 20:40:59 +020060#endif
61
62#endif /* _TRACE_SYSCALL_H */