Skip to content

Commit

Permalink
tracing: Add get_syscall_name()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Masami Hiramatsu <[email protected]>
Reviewed-by: Namhyung Kim <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
tzanussi authored and rostedt committed Mar 8, 2016
1 parent c4a5923 commit dbfeaa7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,13 @@ int perf_ftrace_event_register(struct trace_event_call *call,

#ifdef CONFIG_FTRACE_SYSCALLS
void init_ftrace_syscalls(void);
const char *get_syscall_name(int syscall);
#else
static inline void init_ftrace_syscalls(void) { }
static inline const char *get_syscall_name(int syscall)
{
return NULL;
}
#endif

#ifdef CONFIG_EVENT_TRACING
Expand Down
11 changes: 11 additions & 0 deletions kernel/trace/trace_syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ static struct syscall_metadata *syscall_nr_to_meta(int nr)
return syscalls_metadata[nr];
}

const char *get_syscall_name(int syscall)
{
struct syscall_metadata *entry;

entry = syscall_nr_to_meta(syscall);
if (!entry)
return NULL;

return entry->name;
}

static enum print_line_t
print_syscall_enter(struct trace_iterator *iter, int flags,
struct trace_event *event)
Expand Down

0 comments on commit dbfeaa7

Please sign in to comment.