Skip to content

Commit dbfeaa7

Browse files
tzanussirostedt
authored andcommitted
tracing: Add get_syscall_name()
Add a utility function to grab the syscall name from the syscall metadata, given a syscall id. Link: http://lkml.kernel.org/r/be26a8dfe3f15e16a837799f1c1e2b4d62742843.1449767187.git.tom.zanussi@linux.intel.com Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent c4a5923 commit dbfeaa7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

kernel/trace/trace.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,8 +1394,13 @@ int perf_ftrace_event_register(struct trace_event_call *call,
13941394

13951395
#ifdef CONFIG_FTRACE_SYSCALLS
13961396
void init_ftrace_syscalls(void);
1397+
const char *get_syscall_name(int syscall);
13971398
#else
13981399
static inline void init_ftrace_syscalls(void) { }
1400+
static inline const char *get_syscall_name(int syscall)
1401+
{
1402+
return NULL;
1403+
}
13991404
#endif
14001405

14011406
#ifdef CONFIG_EVENT_TRACING

kernel/trace/trace_syscalls.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,17 @@ static struct syscall_metadata *syscall_nr_to_meta(int nr)
106106
return syscalls_metadata[nr];
107107
}
108108

109+
const char *get_syscall_name(int syscall)
110+
{
111+
struct syscall_metadata *entry;
112+
113+
entry = syscall_nr_to_meta(syscall);
114+
if (!entry)
115+
return NULL;
116+
117+
return entry->name;
118+
}
119+
109120
static enum print_line_t
110121
print_syscall_enter(struct trace_iterator *iter, int flags,
111122
struct trace_event *event)

0 commit comments

Comments
 (0)