blob: 5dc283ba5ae07dd14fe29a0cee8611c7a0a7e937 [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
Frederic Weisbecker47788c52009-04-08 20:40:59 +020011/*
12 * A syscall entry in the ftrace syscalls array.
13 *
14 * @name: name of the syscall
15 * @nb_args: number of parameters it takes
16 * @types: list of types as strings
17 * @args: list of args as strings (args[i] matches types[i])
Jason Baron64c12e02009-08-10 16:52:53 -040018 * @enter_id: associated ftrace enter event id
19 * @exit_id: associated ftrace exit event id
Li Zefan540b7b82009-08-19 15:54:51 +080020 * @enter_event: associated syscall_enter trace event
21 * @exit_event: associated syscall_exit trace event
Frederic Weisbecker47788c52009-04-08 20:40:59 +020022 */
23struct syscall_metadata {
24 const char *name;
25 int nb_args;
26 const char **types;
27 const char **args;
Jason Baron64c12e02009-08-10 16:52:53 -040028 int enter_id;
29 int exit_id;
Li Zefan540b7b82009-08-19 15:54:51 +080030
31 struct ftrace_event_call *enter_event;
32 struct ftrace_event_call *exit_event;
Frederic Weisbecker47788c52009-04-08 20:40:59 +020033};
34
35#ifdef CONFIG_FTRACE_SYSCALLS
Frederic Weisbecker47788c52009-04-08 20:40:59 +020036extern struct syscall_metadata *syscall_nr_to_meta(int nr);
Jason Baronfb34a082009-08-10 16:52:47 -040037extern int syscall_name_to_nr(char *name);
Jason Baron64c12e02009-08-10 16:52:53 -040038void set_syscall_enter_id(int num, int id);
39void set_syscall_exit_id(int num, int id);
Jason Baronfb34a082009-08-10 16:52:47 -040040extern struct trace_event event_syscall_enter;
41extern struct trace_event event_syscall_exit;
42extern int reg_event_syscall_enter(void *ptr);
43extern void unreg_event_syscall_enter(void *ptr);
44extern int reg_event_syscall_exit(void *ptr);
45extern void unreg_event_syscall_exit(void *ptr);
Li Zefan10a5b662009-08-19 15:53:05 +080046extern int syscall_enter_format(struct ftrace_event_call *call,
47 struct trace_seq *s);
48extern int syscall_exit_format(struct ftrace_event_call *call,
49 struct trace_seq *s);
Li Zefan540b7b82009-08-19 15:54:51 +080050extern int syscall_enter_define_fields(struct ftrace_event_call *call);
51extern int syscall_exit_define_fields(struct ftrace_event_call *call);
Jason Baron64c12e02009-08-10 16:52:53 -040052enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags);
53enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags);
Frederic Weisbecker47788c52009-04-08 20:40:59 +020054#endif
Jason Baronf4b5ffc2009-08-10 16:53:02 -040055#ifdef CONFIG_EVENT_PROFILE
56int reg_prof_syscall_enter(char *name);
57void unreg_prof_syscall_enter(char *name);
58int reg_prof_syscall_exit(char *name);
59void unreg_prof_syscall_exit(char *name);
60
61#endif
Frederic Weisbecker47788c52009-04-08 20:40:59 +020062
63#endif /* _TRACE_SYSCALL_H */