Commit 5852b203 authored by Paul Mundt's avatar Paul Mundt

Merge branch 'sh/stable-updates'

parents 913df445 99222622
...@@ -291,31 +291,48 @@ struct syscall_metadata *syscall_nr_to_meta(int nr) ...@@ -291,31 +291,48 @@ struct syscall_metadata *syscall_nr_to_meta(int nr)
return syscalls_metadata[nr]; return syscalls_metadata[nr];
} }
void arch_init_ftrace_syscalls(void) int syscall_name_to_nr(char *name)
{
int i;
if (!syscalls_metadata)
return -1;
for (i = 0; i < NR_syscalls; i++)
if (syscalls_metadata[i])
if (!strcmp(syscalls_metadata[i]->name, name))
return i;
return -1;
}
void set_syscall_enter_id(int num, int id)
{
syscalls_metadata[num]->enter_id = id;
}
void set_syscall_exit_id(int num, int id)
{
syscalls_metadata[num]->exit_id = id;
}
static int __init arch_init_ftrace_syscalls(void)
{ {
int i; int i;
struct syscall_metadata *meta; struct syscall_metadata *meta;
unsigned long **psys_syscall_table = &sys_call_table; unsigned long **psys_syscall_table = &sys_call_table;
static atomic_t refs;
if (atomic_inc_return(&refs) != 1)
goto end;
syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
FTRACE_SYSCALL_MAX, GFP_KERNEL); FTRACE_SYSCALL_MAX, GFP_KERNEL);
if (!syscalls_metadata) { if (!syscalls_metadata) {
WARN_ON(1); WARN_ON(1);
return; return -ENOMEM;
} }
for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
meta = find_syscall_meta(psys_syscall_table[i]); meta = find_syscall_meta(psys_syscall_table[i]);
syscalls_metadata[i] = meta; syscalls_metadata[i] = meta;
} }
return;
/* Paranoid: avoid overflow */ return 0;
end:
atomic_dec(&refs);
} }
arch_initcall(arch_init_ftrace_syscalls);
#endif /* CONFIG_FTRACE_SYSCALLS */ #endif /* CONFIG_FTRACE_SYSCALLS */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment