static int init_enter_##sname(struct ftrace_event_call *call) \
{ \
int num, id; \
- num = syscall_name_to_nr("sys"#sname); \
+ num = __syscall_meta_##sname.syscall_nr; \
if (num < 0) \
return -ENOSYS; \
id = register_ftrace_event(&enter_syscall_print_##sname);\
static int init_exit_##sname(struct ftrace_event_call *call) \
{ \
int num, id; \
- num = syscall_name_to_nr("sys"#sname); \
+ num = __syscall_meta_##sname.syscall_nr; \
if (num < 0) \
return -ENOSYS; \
id = register_ftrace_event(&exit_syscall_print_##sname);\
* A syscall entry in the ftrace syscalls array.
*
* @name: name of the syscall
+ * @syscall_nr: number of the syscall
* @nb_args: number of parameters it takes
* @types: list of types as strings
* @args: list of args as strings (args[i] matches types[i])
*/
struct syscall_metadata {
const char *name;
+ int syscall_nr;
int nb_args;
const char **types;
const char **args;
#ifdef CONFIG_FTRACE_SYSCALLS
extern unsigned long arch_syscall_addr(int nr);
-extern int syscall_name_to_nr(const char *name);
extern int syscall_enter_format(struct ftrace_event_call *call,
struct trace_seq *s);
return syscalls_metadata[nr];
}
-int syscall_name_to_nr(const char *name)
+static int syscall_name_to_nr(const char *name)
{
int i;
{
int ret = 0;
int num;
- const char *name;
- name = ((struct syscall_metadata *)call->data)->name;
- num = syscall_name_to_nr(name);
+ num = ((struct syscall_metadata *)call->data)->syscall_nr;
if (num < 0 || num >= NR_syscalls)
return -ENOSYS;
mutex_lock(&syscall_trace_lock);
void unreg_event_syscall_enter(struct ftrace_event_call *call)
{
int num;
- const char *name;
- name = ((struct syscall_metadata *)call->data)->name;
- num = syscall_name_to_nr(name);
+ num = ((struct syscall_metadata *)call->data)->syscall_nr;
if (num < 0 || num >= NR_syscalls)
return;
mutex_lock(&syscall_trace_lock);
{
int ret = 0;
int num;
- const char *name;
- name = ((struct syscall_metadata *)call->data)->name;
- num = syscall_name_to_nr(name);
+ num = ((struct syscall_metadata *)call->data)->syscall_nr;
if (num < 0 || num >= NR_syscalls)
return -ENOSYS;
mutex_lock(&syscall_trace_lock);
void unreg_event_syscall_exit(struct ftrace_event_call *call)
{
int num;
- const char *name;
- name = ((struct syscall_metadata *)call->data)->name;
- num = syscall_name_to_nr(name);
+ num = ((struct syscall_metadata *)call->data)->syscall_nr;
if (num < 0 || num >= NR_syscalls)
return;
mutex_lock(&syscall_trace_lock);
for (i = 0; i < NR_syscalls; i++) {
addr = arch_syscall_addr(i);
meta = find_syscall_meta(addr);
+ if (!meta)
+ continue;
+
+ meta->syscall_nr = i;
syscalls_metadata[i] = meta;
}