2 * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 * Copyright 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
5 * Dump syscall metadata to console.
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/list.h>
14 #include <linux/err.h>
15 #include <linux/slab.h>
16 #include <linux/kallsyms.h>
17 #include <linux/dcache.h>
18 #include <linux/ftrace_event.h>
19 #include <trace/syscall.h>
21 #ifndef CONFIG_FTRACE_SYSCALLS
22 #error "You need to set CONFIG_FTRACE_SYSCALLS=y"
25 #ifndef CONFIG_KALLSYMS_ALL
26 #error "You need to set CONFIG_KALLSYMS_ALL=y"
29 static struct syscall_metadata
**__start_syscalls_metadata
;
30 static struct syscall_metadata
**__stop_syscalls_metadata
;
33 struct syscall_metadata
*find_syscall_meta(unsigned long syscall
)
35 struct syscall_metadata
**iter
;
37 for (iter
= __start_syscalls_metadata
;
38 iter
< __stop_syscalls_metadata
; iter
++) {
39 if ((*iter
)->syscall_nr
== syscall
)
47 struct syscall_metadata
*meta
;
50 __start_syscalls_metadata
= (void *) kallsyms_lookup_name("__start_syscalls_metadata");
51 __stop_syscalls_metadata
= (void *) kallsyms_lookup_name("__stop_syscalls_metadata");
53 for (i
= 0; i
< NR_syscalls
; i
++) {
56 meta
= find_syscall_meta(i
);
59 printk("syscall %s nr %d nbargs %d ",
60 meta
->name
, meta
->syscall_nr
, meta
->nb_args
);
62 for (j
= 0; j
< meta
->nb_args
; j
++) {
65 printk("%s", meta
->types
[j
]);
69 for (j
= 0; j
< meta
->nb_args
; j
++) {
72 printk("%s", meta
->args
[j
]);
81 void cleanup_module(void)
85 MODULE_LICENSE("GPL");