Commit-ID: eeac19a7efa150231e4a6bb110d6f27500bcc8ce Gitweb: http://git.kernel.org/tip/eeac19a7efa150231e4a6bb110d6f27500bcc8ce Author: Jason Baron <jbaron@xxxxxxxxxx> AuthorDate: Mon, 10 Aug 2009 16:52:13 -0400 Committer: Frederic Weisbecker <fweisbec@xxxxxxxxx> CommitDate: Tue, 11 Aug 2009 20:35:25 +0200 tracing: Map syscall name to number Add a new function to support translating a syscall name to number at runtime. This allows the syscall event tracer to map syscall names to number. Signed-off-by: Jason Baron <jbaron@xxxxxxxxxx> Cc: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx> Cc: Jiaying Zhang <jiayingz@xxxxxxxxxx> Cc: Martin Bligh <mbligh@xxxxxxxxxx> Cc: Li Zefan <lizf@xxxxxxxxxxxxxx> Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx> Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx> --- arch/x86/kernel/ftrace.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 8e96634..afb31d7 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -500,6 +500,22 @@ struct syscall_metadata *syscall_nr_to_meta(int nr) return syscalls_metadata[nr]; } +int syscall_name_to_nr(char *name) +{ + int i; + + if (!syscalls_metadata) + return -1; + + for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { + if (syscalls_metadata[i]) { + if (!strcmp(syscalls_metadata[i]->name, name)) + return i; + } + } + return -1; +} + void arch_init_ftrace_syscalls(void) { int i; -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |