aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/syscalls.h49
1 files changed, 15 insertions, 34 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 65c001f7fa0b..4147d700a293 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -87,6 +87,7 @@ struct sigaltstack;
87 * of __MAP starting at the third one) is in the same format as 87 * of __MAP starting at the third one) is in the same format as
88 * for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n> 88 * for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n>
89 */ 89 */
90#define __MAP0(m,...)
90#define __MAP1(m,t,a) m(t,a) 91#define __MAP1(m,t,a) m(t,a)
91#define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__) 92#define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__)
92#define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__) 93#define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__)
@@ -139,7 +140,13 @@ extern struct trace_event_functions exit_syscall_print_funcs;
139 __attribute__((section("_ftrace_events"))) \ 140 __attribute__((section("_ftrace_events"))) \
140 *__event_exit_##sname = &event_exit_##sname; 141 *__event_exit_##sname = &event_exit_##sname;
141 142
142#define SYSCALL_METADATA(sname, nb) \ 143#define SYSCALL_METADATA(sname, nb, ...) \
144 static const char *types_##sname[] = { \
145 __MAP(nb,__SC_STR_TDECL,__VA_ARGS__) \
146 }; \
147 static const char *args_##sname[] = { \
148 __MAP(nb,__SC_STR_ADECL,__VA_ARGS__) \
149 }; \
143 SYSCALL_TRACE_ENTER_EVENT(sname); \ 150 SYSCALL_TRACE_ENTER_EVENT(sname); \
144 SYSCALL_TRACE_EXIT_EVENT(sname); \ 151 SYSCALL_TRACE_EXIT_EVENT(sname); \
145 static struct syscall_metadata __used \ 152 static struct syscall_metadata __used \
@@ -147,8 +154,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
147 .name = "sys"#sname, \ 154 .name = "sys"#sname, \
148 .syscall_nr = -1, /* Filled in at boot */ \ 155 .syscall_nr = -1, /* Filled in at boot */ \
149 .nb_args = nb, \ 156 .nb_args = nb, \
150 .types = types_##sname, \ 157 .types = nb ? types_##sname : NULL, \
151 .args = args_##sname, \ 158 .args = nb ? args_##sname : NULL, \
152 .enter_event = &event_enter_##sname, \ 159 .enter_event = &event_enter_##sname, \
153 .exit_event = &event_exit_##sname, \ 160 .exit_event = &event_exit_##sname, \
154 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ 161 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
@@ -156,26 +163,13 @@ extern struct trace_event_functions exit_syscall_print_funcs;
156 static struct syscall_metadata __used \ 163 static struct syscall_metadata __used \
157 __attribute__((section("__syscalls_metadata"))) \ 164 __attribute__((section("__syscalls_metadata"))) \
158 *__p_syscall_meta_##sname = &__syscall_meta_##sname; 165 *__p_syscall_meta_##sname = &__syscall_meta_##sname;
166#else
167#define SYSCALL_METADATA(sname, nb, ...)
168#endif
159 169
160#define SYSCALL_DEFINE0(sname) \ 170#define SYSCALL_DEFINE0(sname) \
161 SYSCALL_TRACE_ENTER_EVENT(_##sname); \ 171 SYSCALL_METADATA(_##sname, 0); \
162 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
163 static struct syscall_metadata __used \
164 __syscall_meta__##sname = { \
165 .name = "sys_"#sname, \
166 .syscall_nr = -1, /* Filled in at boot */ \
167 .nb_args = 0, \
168 .enter_event = &event_enter__##sname, \
169 .exit_event = &event_exit__##sname, \
170 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
171 }; \
172 static struct syscall_metadata __used \
173 __attribute__((section("__syscalls_metadata"))) \
174 *__p_syscall_meta_##sname = &__syscall_meta__##sname; \
175 asmlinkage long sys_##sname(void) 172 asmlinkage long sys_##sname(void)
176#else
177#define SYSCALL_DEFINE0(name) asmlinkage long sys_##name(void)
178#endif
179 173
180#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 174#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
181#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) 175#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
@@ -184,22 +178,9 @@ extern struct trace_event_functions exit_syscall_print_funcs;
184#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__) 178#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
185#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) 179#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
186 180
187#ifdef CONFIG_FTRACE_SYSCALLS
188#define SYSCALL_DEFINEx(x, sname, ...) \ 181#define SYSCALL_DEFINEx(x, sname, ...) \
189 static const char *types_##sname[] = { \ 182 SYSCALL_METADATA(sname, x, __VA_ARGS__) \
190 __MAP(x,__SC_STR_TDECL,__VA_ARGS__) \
191 }; \
192 static const char *args_##sname[] = { \
193 __MAP(x,__SC_STR_ADECL,__VA_ARGS__) \
194 }; \
195 SYSCALL_METADATA(sname, x); \
196 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__) 183 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
197#else
198#define SYSCALL_DEFINEx(x, sname, ...) \
199 __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
200#endif
201
202#define SYSCALL_DEFINE(name) static inline long SYSC_##name
203 184
204#define __PROTECT(...) asmlinkage_protect(__VA_ARGS__) 185#define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)
205#define __SYSCALL_DEFINEx(x, name, ...) \ 186#define __SYSCALL_DEFINEx(x, name, ...) \