aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2009-12-01 03:23:47 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-01 11:33:29 -0500
commitc252f65793874b56d50395ab604db465ce688665 (patch)
tree30bc32361d2b368679910270ec4e99e841fa099b /kernel/trace
parentfcc19438dda38dacc8c144e2db3ebc6b9fd4f8b8 (diff)
trace_syscalls: Add syscall_nr field to struct syscall_metadata
Add syscall_nr field to struct syscall_metadata, it helps us to get syscall number easier. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Acked-by: Jason Baron <jbaron@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4B14D293.6090800@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_syscalls.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 27eb18d69222..144cc14d8551 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -51,7 +51,7 @@ static struct syscall_metadata *syscall_nr_to_meta(int nr)
51 return syscalls_metadata[nr]; 51 return syscalls_metadata[nr];
52} 52}
53 53
54int syscall_name_to_nr(const char *name) 54static int syscall_name_to_nr(const char *name)
55{ 55{
56 int i; 56 int i;
57 57
@@ -342,10 +342,8 @@ int reg_event_syscall_enter(struct ftrace_event_call *call)
342{ 342{
343 int ret = 0; 343 int ret = 0;
344 int num; 344 int num;
345 const char *name;
346 345
347 name = ((struct syscall_metadata *)call->data)->name; 346 num = ((struct syscall_metadata *)call->data)->syscall_nr;
348 num = syscall_name_to_nr(name);
349 if (num < 0 || num >= NR_syscalls) 347 if (num < 0 || num >= NR_syscalls)
350 return -ENOSYS; 348 return -ENOSYS;
351 mutex_lock(&syscall_trace_lock); 349 mutex_lock(&syscall_trace_lock);
@@ -365,10 +363,8 @@ int reg_event_syscall_enter(struct ftrace_event_call *call)
365void unreg_event_syscall_enter(struct ftrace_event_call *call) 363void unreg_event_syscall_enter(struct ftrace_event_call *call)
366{ 364{
367 int num; 365 int num;
368 const char *name;
369 366
370 name = ((struct syscall_metadata *)call->data)->name; 367 num = ((struct syscall_metadata *)call->data)->syscall_nr;
371 num = syscall_name_to_nr(name);
372 if (num < 0 || num >= NR_syscalls) 368 if (num < 0 || num >= NR_syscalls)
373 return; 369 return;
374 mutex_lock(&syscall_trace_lock); 370 mutex_lock(&syscall_trace_lock);
@@ -383,10 +379,8 @@ int reg_event_syscall_exit(struct ftrace_event_call *call)
383{ 379{
384 int ret = 0; 380 int ret = 0;
385 int num; 381 int num;
386 const char *name;
387 382
388 name = ((struct syscall_metadata *)call->data)->name; 383 num = ((struct syscall_metadata *)call->data)->syscall_nr;
389 num = syscall_name_to_nr(name);
390 if (num < 0 || num >= NR_syscalls) 384 if (num < 0 || num >= NR_syscalls)
391 return -ENOSYS; 385 return -ENOSYS;
392 mutex_lock(&syscall_trace_lock); 386 mutex_lock(&syscall_trace_lock);
@@ -406,10 +400,8 @@ int reg_event_syscall_exit(struct ftrace_event_call *call)
406void unreg_event_syscall_exit(struct ftrace_event_call *call) 400void unreg_event_syscall_exit(struct ftrace_event_call *call)
407{ 401{
408 int num; 402 int num;
409 const char *name;
410 403
411 name = ((struct syscall_metadata *)call->data)->name; 404 num = ((struct syscall_metadata *)call->data)->syscall_nr;
412 num = syscall_name_to_nr(name);
413 if (num < 0 || num >= NR_syscalls) 405 if (num < 0 || num >= NR_syscalls)
414 return; 406 return;
415 mutex_lock(&syscall_trace_lock); 407 mutex_lock(&syscall_trace_lock);
@@ -436,6 +428,10 @@ int __init init_ftrace_syscalls(void)
436 for (i = 0; i < NR_syscalls; i++) { 428 for (i = 0; i < NR_syscalls; i++) {
437 addr = arch_syscall_addr(i); 429 addr = arch_syscall_addr(i);
438 meta = find_syscall_meta(addr); 430 meta = find_syscall_meta(addr);
431 if (!meta)
432 continue;
433
434 meta->syscall_nr = i;
439 syscalls_metadata[i] = meta; 435 syscalls_metadata[i] = meta;
440 } 436 }
441 437