* of __MAP starting at the third one) is in the same format as
* for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n>
*/
+#define __MAP0(m,...)
#define __MAP1(m,t,a) m(t,a)
#define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__)
#define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__)
__attribute__((section("_ftrace_events"))) \
*__event_exit_##sname = &event_exit_##sname;
-#define SYSCALL_METADATA(sname, nb) \
+#define SYSCALL_METADATA(sname, nb, ...) \
+ static const char *types_##sname[] = { \
+ __MAP(nb,__SC_STR_TDECL,__VA_ARGS__) \
+ }; \
+ static const char *args_##sname[] = { \
+ __MAP(nb,__SC_STR_ADECL,__VA_ARGS__) \
+ }; \
SYSCALL_TRACE_ENTER_EVENT(sname); \
SYSCALL_TRACE_EXIT_EVENT(sname); \
static struct syscall_metadata __used \
.name = "sys"#sname, \
.syscall_nr = -1, /* Filled in at boot */ \
.nb_args = nb, \
- .types = types_##sname, \
- .args = args_##sname, \
+ .types = nb ? types_##sname : NULL, \
+ .args = nb ? args_##sname : NULL, \
.enter_event = &event_enter_##sname, \
.exit_event = &event_exit_##sname, \
.enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
static struct syscall_metadata __used \
__attribute__((section("__syscalls_metadata"))) \
*__p_syscall_meta_##sname = &__syscall_meta_##sname;
+#else
+#define SYSCALL_METADATA(sname, nb, ...)
+#endif
#define SYSCALL_DEFINE0(sname) \
- SYSCALL_TRACE_ENTER_EVENT(_##sname); \
- SYSCALL_TRACE_EXIT_EVENT(_##sname); \
- static struct syscall_metadata __used \
- __syscall_meta__##sname = { \
- .name = "sys_"#sname, \
- .syscall_nr = -1, /* Filled in at boot */ \
- .nb_args = 0, \
- .enter_event = &event_enter__##sname, \
- .exit_event = &event_exit__##sname, \
- .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
- }; \
- static struct syscall_metadata __used \
- __attribute__((section("__syscalls_metadata"))) \
- *__p_syscall_meta_##sname = &__syscall_meta__##sname; \
+ SYSCALL_METADATA(_##sname, 0); \
asmlinkage long sys_##sname(void)
-#else
-#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
-#endif
#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
-#ifdef CONFIG_FTRACE_SYSCALLS
#define SYSCALL_DEFINEx(x, sname, ...) \
- static const char *types_##sname[] = { \
- __MAP(x,__SC_STR_TDECL,__VA_ARGS__) \
- }; \
- static const char *args_##sname[] = { \
- __MAP(x,__SC_STR_ADECL,__VA_ARGS__) \
- }; \
- SYSCALL_METADATA(sname, x); \
+ SYSCALL_METADATA(sname, x, __VA_ARGS__) \
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
-#else
-#define SYSCALL_DEFINEx(x, sname, ...) \
- __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
-#endif
-
-#define SYSCALL_DEFINE(name) static inline long SYSC_##name
#define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)
#define __SYSCALL_DEFINEx(x, name, ...) \