diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-09-10 19:09:23 -0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-09-10 19:09:23 -0400 |
commit | 8f8ffe2485bcaa890800681451d380779cea06af (patch) | |
tree | 1d2ef3a27f1cab9a2b9014f4b75886a96a1ae8db /kernel/trace/trace_syscalls.c | |
parent | 70069577323e6f72b845166724f34b9858134437 (diff) | |
parent | d28daf923ac5e4a0d7cecebae56f3e339189366b (diff) |
Merge commit 'tracing/core' into tracing/kprobes
Conflicts:
kernel/trace/trace_export.c
kernel/trace/trace_kprobe.c
Merge reason: This topic branch lacks an important
build fix in tracing/core:
0dd7b74787eaf7858c6c573353a83c3e2766e674:
tracing: Fix double CPP substitution in TRACE_EVENT_FN
that prevents from multiple tracepoint headers inclusion crashes.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'kernel/trace/trace_syscalls.c')
-rw-r--r-- | kernel/trace/trace_syscalls.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index e7c676e50a7f..dfc55fed2099 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -11,8 +11,8 @@ | |||
11 | static DEFINE_MUTEX(syscall_trace_lock); | 11 | static DEFINE_MUTEX(syscall_trace_lock); |
12 | static int sys_refcount_enter; | 12 | static int sys_refcount_enter; |
13 | static int sys_refcount_exit; | 13 | static int sys_refcount_exit; |
14 | static DECLARE_BITMAP(enabled_enter_syscalls, FTRACE_SYSCALL_MAX); | 14 | static DECLARE_BITMAP(enabled_enter_syscalls, NR_syscalls); |
15 | static DECLARE_BITMAP(enabled_exit_syscalls, FTRACE_SYSCALL_MAX); | 15 | static DECLARE_BITMAP(enabled_exit_syscalls, NR_syscalls); |
16 | 16 | ||
17 | enum print_line_t | 17 | enum print_line_t |
18 | print_syscall_enter(struct trace_iterator *iter, int flags) | 18 | print_syscall_enter(struct trace_iterator *iter, int flags) |
@@ -223,10 +223,13 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) | |||
223 | struct syscall_trace_enter *entry; | 223 | struct syscall_trace_enter *entry; |
224 | struct syscall_metadata *sys_data; | 224 | struct syscall_metadata *sys_data; |
225 | struct ring_buffer_event *event; | 225 | struct ring_buffer_event *event; |
226 | struct ring_buffer *buffer; | ||
226 | int size; | 227 | int size; |
227 | int syscall_nr; | 228 | int syscall_nr; |
228 | 229 | ||
229 | syscall_nr = syscall_get_nr(current, regs); | 230 | syscall_nr = syscall_get_nr(current, regs); |
231 | if (syscall_nr < 0) | ||
232 | return; | ||
230 | if (!test_bit(syscall_nr, enabled_enter_syscalls)) | 233 | if (!test_bit(syscall_nr, enabled_enter_syscalls)) |
231 | return; | 234 | return; |
232 | 235 | ||
@@ -236,8 +239,8 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) | |||
236 | 239 | ||
237 | size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; | 240 | size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args; |
238 | 241 | ||
239 | event = trace_current_buffer_lock_reserve(sys_data->enter_id, size, | 242 | event = trace_current_buffer_lock_reserve(&buffer, sys_data->enter_id, |
240 | 0, 0); | 243 | size, 0, 0); |
241 | if (!event) | 244 | if (!event) |
242 | return; | 245 | return; |
243 | 246 | ||
@@ -245,8 +248,9 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) | |||
245 | entry->nr = syscall_nr; | 248 | entry->nr = syscall_nr; |
246 | syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args); | 249 | syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args); |
247 | 250 | ||
248 | if (!filter_current_check_discard(sys_data->enter_event, entry, event)) | 251 | if (!filter_current_check_discard(buffer, sys_data->enter_event, |
249 | trace_current_buffer_unlock_commit(event, 0, 0); | 252 | entry, event)) |
253 | trace_current_buffer_unlock_commit(buffer, event, 0, 0); | ||
250 | } | 254 | } |
251 | 255 | ||
252 | void ftrace_syscall_exit(struct pt_regs *regs, long ret) | 256 | void ftrace_syscall_exit(struct pt_regs *regs, long ret) |
@@ -254,9 +258,12 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret) | |||
254 | struct syscall_trace_exit *entry; | 258 | struct syscall_trace_exit *entry; |
255 | struct syscall_metadata *sys_data; | 259 | struct syscall_metadata *sys_data; |
256 | struct ring_buffer_event *event; | 260 | struct ring_buffer_event *event; |
261 | struct ring_buffer *buffer; | ||
257 | int syscall_nr; | 262 | int syscall_nr; |
258 | 263 | ||
259 | syscall_nr = syscall_get_nr(current, regs); | 264 | syscall_nr = syscall_get_nr(current, regs); |
265 | if (syscall_nr < 0) | ||
266 | return; | ||
260 | if (!test_bit(syscall_nr, enabled_exit_syscalls)) | 267 | if (!test_bit(syscall_nr, enabled_exit_syscalls)) |
261 | return; | 268 | return; |
262 | 269 | ||
@@ -264,7 +271,7 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret) | |||
264 | if (!sys_data) | 271 | if (!sys_data) |
265 | return; | 272 | return; |
266 | 273 | ||
267 | event = trace_current_buffer_lock_reserve(sys_data->exit_id, | 274 | event = trace_current_buffer_lock_reserve(&buffer, sys_data->exit_id, |
268 | sizeof(*entry), 0, 0); | 275 | sizeof(*entry), 0, 0); |
269 | if (!event) | 276 | if (!event) |
270 | return; | 277 | return; |
@@ -273,8 +280,9 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret) | |||
273 | entry->nr = syscall_nr; | 280 | entry->nr = syscall_nr; |
274 | entry->ret = syscall_get_return_value(current, regs); | 281 | entry->ret = syscall_get_return_value(current, regs); |
275 | 282 | ||
276 | if (!filter_current_check_discard(sys_data->exit_event, entry, event)) | 283 | if (!filter_current_check_discard(buffer, sys_data->exit_event, |
277 | trace_current_buffer_unlock_commit(event, 0, 0); | 284 | entry, event)) |
285 | trace_current_buffer_unlock_commit(buffer, event, 0, 0); | ||
278 | } | 286 | } |
279 | 287 | ||
280 | int reg_event_syscall_enter(struct ftrace_event_call *call) | 288 | int reg_event_syscall_enter(struct ftrace_event_call *call) |
@@ -285,7 +293,7 @@ int reg_event_syscall_enter(struct ftrace_event_call *call) | |||
285 | 293 | ||
286 | name = (char *)call->data; | 294 | name = (char *)call->data; |
287 | num = syscall_name_to_nr(name); | 295 | num = syscall_name_to_nr(name); |
288 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 296 | if (num < 0 || num >= NR_syscalls) |
289 | return -ENOSYS; | 297 | return -ENOSYS; |
290 | mutex_lock(&syscall_trace_lock); | 298 | mutex_lock(&syscall_trace_lock); |
291 | if (!sys_refcount_enter) | 299 | if (!sys_refcount_enter) |
@@ -308,7 +316,7 @@ void unreg_event_syscall_enter(struct ftrace_event_call *call) | |||
308 | 316 | ||
309 | name = (char *)call->data; | 317 | name = (char *)call->data; |
310 | num = syscall_name_to_nr(name); | 318 | num = syscall_name_to_nr(name); |
311 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 319 | if (num < 0 || num >= NR_syscalls) |
312 | return; | 320 | return; |
313 | mutex_lock(&syscall_trace_lock); | 321 | mutex_lock(&syscall_trace_lock); |
314 | sys_refcount_enter--; | 322 | sys_refcount_enter--; |
@@ -326,7 +334,7 @@ int reg_event_syscall_exit(struct ftrace_event_call *call) | |||
326 | 334 | ||
327 | name = call->data; | 335 | name = call->data; |
328 | num = syscall_name_to_nr(name); | 336 | num = syscall_name_to_nr(name); |
329 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 337 | if (num < 0 || num >= NR_syscalls) |
330 | return -ENOSYS; | 338 | return -ENOSYS; |
331 | mutex_lock(&syscall_trace_lock); | 339 | mutex_lock(&syscall_trace_lock); |
332 | if (!sys_refcount_exit) | 340 | if (!sys_refcount_exit) |
@@ -349,7 +357,7 @@ void unreg_event_syscall_exit(struct ftrace_event_call *call) | |||
349 | 357 | ||
350 | name = call->data; | 358 | name = call->data; |
351 | num = syscall_name_to_nr(name); | 359 | num = syscall_name_to_nr(name); |
352 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 360 | if (num < 0 || num >= NR_syscalls) |
353 | return; | 361 | return; |
354 | mutex_lock(&syscall_trace_lock); | 362 | mutex_lock(&syscall_trace_lock); |
355 | sys_refcount_exit--; | 363 | sys_refcount_exit--; |
@@ -369,8 +377,8 @@ struct trace_event event_syscall_exit = { | |||
369 | 377 | ||
370 | #ifdef CONFIG_EVENT_PROFILE | 378 | #ifdef CONFIG_EVENT_PROFILE |
371 | 379 | ||
372 | static DECLARE_BITMAP(enabled_prof_enter_syscalls, FTRACE_SYSCALL_MAX); | 380 | static DECLARE_BITMAP(enabled_prof_enter_syscalls, NR_syscalls); |
373 | static DECLARE_BITMAP(enabled_prof_exit_syscalls, FTRACE_SYSCALL_MAX); | 381 | static DECLARE_BITMAP(enabled_prof_exit_syscalls, NR_syscalls); |
374 | static int sys_prof_refcount_enter; | 382 | static int sys_prof_refcount_enter; |
375 | static int sys_prof_refcount_exit; | 383 | static int sys_prof_refcount_exit; |
376 | 384 | ||
@@ -416,7 +424,7 @@ int reg_prof_syscall_enter(char *name) | |||
416 | int num; | 424 | int num; |
417 | 425 | ||
418 | num = syscall_name_to_nr(name); | 426 | num = syscall_name_to_nr(name); |
419 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 427 | if (num < 0 || num >= NR_syscalls) |
420 | return -ENOSYS; | 428 | return -ENOSYS; |
421 | 429 | ||
422 | mutex_lock(&syscall_trace_lock); | 430 | mutex_lock(&syscall_trace_lock); |
@@ -438,7 +446,7 @@ void unreg_prof_syscall_enter(char *name) | |||
438 | int num; | 446 | int num; |
439 | 447 | ||
440 | num = syscall_name_to_nr(name); | 448 | num = syscall_name_to_nr(name); |
441 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 449 | if (num < 0 || num >= NR_syscalls) |
442 | return; | 450 | return; |
443 | 451 | ||
444 | mutex_lock(&syscall_trace_lock); | 452 | mutex_lock(&syscall_trace_lock); |
@@ -477,7 +485,7 @@ int reg_prof_syscall_exit(char *name) | |||
477 | int num; | 485 | int num; |
478 | 486 | ||
479 | num = syscall_name_to_nr(name); | 487 | num = syscall_name_to_nr(name); |
480 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 488 | if (num < 0 || num >= NR_syscalls) |
481 | return -ENOSYS; | 489 | return -ENOSYS; |
482 | 490 | ||
483 | mutex_lock(&syscall_trace_lock); | 491 | mutex_lock(&syscall_trace_lock); |
@@ -499,7 +507,7 @@ void unreg_prof_syscall_exit(char *name) | |||
499 | int num; | 507 | int num; |
500 | 508 | ||
501 | num = syscall_name_to_nr(name); | 509 | num = syscall_name_to_nr(name); |
502 | if (num < 0 || num >= FTRACE_SYSCALL_MAX) | 510 | if (num < 0 || num >= NR_syscalls) |
503 | return; | 511 | return; |
504 | 512 | ||
505 | mutex_lock(&syscall_trace_lock); | 513 | mutex_lock(&syscall_trace_lock); |