aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/syscalls.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/syscalls.h')
-rw-r--r--include/linux/syscalls.h81
1 files changed, 18 insertions, 63 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a990ace1a838..bc70c5810fec 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -25,6 +25,7 @@ struct linux_dirent64;
25struct list_head; 25struct list_head;
26struct msgbuf; 26struct msgbuf;
27struct msghdr; 27struct msghdr;
28struct mmsghdr;
28struct msqid_ds; 29struct msqid_ds;
29struct new_utsname; 30struct new_utsname;
30struct nfsctl_arg; 31struct nfsctl_arg;
@@ -99,37 +100,16 @@ struct perf_event_attr;
99#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) 100#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
100 101
101#ifdef CONFIG_EVENT_PROFILE 102#ifdef CONFIG_EVENT_PROFILE
102#define TRACE_SYS_ENTER_PROFILE(sname) \
103static int prof_sysenter_enable_##sname(void) \
104{ \
105 return reg_prof_syscall_enter("sys"#sname); \
106} \
107 \
108static void prof_sysenter_disable_##sname(void) \
109{ \
110 unreg_prof_syscall_enter("sys"#sname); \
111}
112
113#define TRACE_SYS_EXIT_PROFILE(sname) \
114static int prof_sysexit_enable_##sname(void) \
115{ \
116 return reg_prof_syscall_exit("sys"#sname); \
117} \
118 \
119static void prof_sysexit_disable_##sname(void) \
120{ \
121 unreg_prof_syscall_exit("sys"#sname); \
122}
123 103
124#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ 104#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
125 .profile_count = ATOMIC_INIT(-1), \ 105 .profile_count = ATOMIC_INIT(-1), \
126 .profile_enable = prof_sysenter_enable_##sname, \ 106 .profile_enable = prof_sysenter_enable, \
127 .profile_disable = prof_sysenter_disable_##sname, 107 .profile_disable = prof_sysenter_disable,
128 108
129#define TRACE_SYS_EXIT_PROFILE_INIT(sname) \ 109#define TRACE_SYS_EXIT_PROFILE_INIT(sname) \
130 .profile_count = ATOMIC_INIT(-1), \ 110 .profile_count = ATOMIC_INIT(-1), \
131 .profile_enable = prof_sysexit_enable_##sname, \ 111 .profile_enable = prof_sysexit_enable, \
132 .profile_disable = prof_sysexit_disable_##sname, 112 .profile_disable = prof_sysexit_disable,
133#else 113#else
134#define TRACE_SYS_ENTER_PROFILE(sname) 114#define TRACE_SYS_ENTER_PROFILE(sname)
135#define TRACE_SYS_ENTER_PROFILE_INIT(sname) 115#define TRACE_SYS_ENTER_PROFILE_INIT(sname)
@@ -153,74 +133,46 @@ static void prof_sysexit_disable_##sname(void) \
153#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) 133#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
154 134
155#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 135#define SYSCALL_TRACE_ENTER_EVENT(sname) \
136 static const struct syscall_metadata __syscall_meta_##sname; \
156 static struct ftrace_event_call event_enter_##sname; \ 137 static struct ftrace_event_call event_enter_##sname; \
157 struct trace_event enter_syscall_print_##sname = { \ 138 static struct trace_event enter_syscall_print_##sname = { \
158 .trace = print_syscall_enter, \ 139 .trace = print_syscall_enter, \
159 }; \ 140 }; \
160 static int init_enter_##sname(void) \
161 { \
162 int num, id; \
163 num = syscall_name_to_nr("sys"#sname); \
164 if (num < 0) \
165 return -ENOSYS; \
166 id = register_ftrace_event(&enter_syscall_print_##sname);\
167 if (!id) \
168 return -ENODEV; \
169 event_enter_##sname.id = id; \
170 set_syscall_enter_id(num, id); \
171 INIT_LIST_HEAD(&event_enter_##sname.fields); \
172 return 0; \
173 } \
174 TRACE_SYS_ENTER_PROFILE(sname); \
175 static struct ftrace_event_call __used \ 141 static struct ftrace_event_call __used \
176 __attribute__((__aligned__(4))) \ 142 __attribute__((__aligned__(4))) \
177 __attribute__((section("_ftrace_events"))) \ 143 __attribute__((section("_ftrace_events"))) \
178 event_enter_##sname = { \ 144 event_enter_##sname = { \
179 .name = "sys_enter"#sname, \ 145 .name = "sys_enter"#sname, \
180 .system = "syscalls", \ 146 .system = "syscalls", \
181 .event = &event_syscall_enter, \ 147 .event = &enter_syscall_print_##sname, \
182 .raw_init = init_enter_##sname, \ 148 .raw_init = init_syscall_trace, \
183 .show_format = syscall_enter_format, \ 149 .show_format = syscall_enter_format, \
184 .define_fields = syscall_enter_define_fields, \ 150 .define_fields = syscall_enter_define_fields, \
185 .regfunc = reg_event_syscall_enter, \ 151 .regfunc = reg_event_syscall_enter, \
186 .unregfunc = unreg_event_syscall_enter, \ 152 .unregfunc = unreg_event_syscall_enter, \
187 .data = "sys"#sname, \ 153 .data = (void *)&__syscall_meta_##sname,\
188 TRACE_SYS_ENTER_PROFILE_INIT(sname) \ 154 TRACE_SYS_ENTER_PROFILE_INIT(sname) \
189 } 155 }
190 156
191#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 157#define SYSCALL_TRACE_EXIT_EVENT(sname) \
158 static const struct syscall_metadata __syscall_meta_##sname; \
192 static struct ftrace_event_call event_exit_##sname; \ 159 static struct ftrace_event_call event_exit_##sname; \
193 struct trace_event exit_syscall_print_##sname = { \ 160 static struct trace_event exit_syscall_print_##sname = { \
194 .trace = print_syscall_exit, \ 161 .trace = print_syscall_exit, \
195 }; \ 162 }; \
196 static int init_exit_##sname(void) \
197 { \
198 int num, id; \
199 num = syscall_name_to_nr("sys"#sname); \
200 if (num < 0) \
201 return -ENOSYS; \
202 id = register_ftrace_event(&exit_syscall_print_##sname);\
203 if (!id) \
204 return -ENODEV; \
205 event_exit_##sname.id = id; \
206 set_syscall_exit_id(num, id); \
207 INIT_LIST_HEAD(&event_exit_##sname.fields); \
208 return 0; \
209 } \
210 TRACE_SYS_EXIT_PROFILE(sname); \
211 static struct ftrace_event_call __used \ 163 static struct ftrace_event_call __used \
212 __attribute__((__aligned__(4))) \ 164 __attribute__((__aligned__(4))) \
213 __attribute__((section("_ftrace_events"))) \ 165 __attribute__((section("_ftrace_events"))) \
214 event_exit_##sname = { \ 166 event_exit_##sname = { \
215 .name = "sys_exit"#sname, \ 167 .name = "sys_exit"#sname, \
216 .system = "syscalls", \ 168 .system = "syscalls", \
217 .event = &event_syscall_exit, \ 169 .event = &exit_syscall_print_##sname, \
218 .raw_init = init_exit_##sname, \ 170 .raw_init = init_syscall_trace, \
219 .show_format = syscall_exit_format, \ 171 .show_format = syscall_exit_format, \
220 .define_fields = syscall_exit_define_fields, \ 172 .define_fields = syscall_exit_define_fields, \
221 .regfunc = reg_event_syscall_exit, \ 173 .regfunc = reg_event_syscall_exit, \
222 .unregfunc = unreg_event_syscall_exit, \ 174 .unregfunc = unreg_event_syscall_exit, \
223 .data = "sys"#sname, \ 175 .data = (void *)&__syscall_meta_##sname,\
224 TRACE_SYS_EXIT_PROFILE_INIT(sname) \ 176 TRACE_SYS_EXIT_PROFILE_INIT(sname) \
225 } 177 }
226 178
@@ -677,6 +629,9 @@ asmlinkage long sys_recv(int, void __user *, size_t, unsigned);
677asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned, 629asmlinkage long sys_recvfrom(int, void __user *, size_t, unsigned,
678 struct sockaddr __user *, int __user *); 630 struct sockaddr __user *, int __user *);
679asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags); 631asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned flags);
632asmlinkage long sys_recvmmsg(int fd, struct mmsghdr __user *msg,
633 unsigned int vlen, unsigned flags,
634 struct timespec __user *timeout);
680asmlinkage long sys_socket(int, int, int); 635asmlinkage long sys_socket(int, int, int);
681asmlinkage long sys_socketpair(int, int, int, int __user *); 636asmlinkage long sys_socketpair(int, int, int, int __user *);
682asmlinkage long sys_socketcall(int call, unsigned long __user *args); 637asmlinkage long sys_socketcall(int call, unsigned long __user *args);