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
Showing the changes to kernel/trace (2 of 2 files). Show all
Unified · Split
| @@ -1394,8 +1394,13 @@ int perf_ftrace_event_register(struct trace_event_call *call, · 1393 unmodified lines | |||
| 1394 | 1394 | ||
| 1395 | #ifdef CONFIG_FTRACE_SYSCALLS | 1395 | #ifdef CONFIG_FTRACE_SYSCALLS |
| 1396 | void init_ftrace_syscalls(void); | 1396 | void init_ftrace_syscalls(void); |
| 1397 | const char *get_syscall_name(int syscall); | ||
| 1397 | #else | 1398 | #else |
| 1398 | static inline void init_ftrace_syscalls(void) { } | 1399 | static inline void init_ftrace_syscalls(void) { } |
| 1400 | static inline const char *get_syscall_name(int syscall) | ||
| 1401 | { | ||
| 1402 | return NULL; | ||
| 1403 | } | ||
| 1399 | #endif | 1404 | #endif |
| 1400 | 1405 | ||
| 1401 | #ifdef CONFIG_EVENT_TRACING | 1406 | #ifdef CONFIG_EVENT_TRACING |
| @@ -106,6 +106,17 @@ static struct syscall_metadata *syscall_nr_to_meta(int nr) · 105 unmodified lines | |||
| 106 | return syscalls_metadata[nr]; | 106 | return syscalls_metadata[nr]; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 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 | |||
| 109 | static enum print_line_t | 120 | static enum print_line_t |
| 110 | print_syscall_enter(struct trace_iterator *iter, int flags, | 121 | print_syscall_enter(struct trace_iterator *iter, int flags, |
| 111 | struct trace_event *event) | 122 | struct trace_event *event) |