Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) */ |
6314c2d3 | 2 | |
e42e81fd MD |
3 | #ifndef CREATE_SYSCALL_TABLE |
4 | ||
769ad370 MD |
5 | #define OVERRIDE_32_execve |
6 | #define OVERRIDE_64_execve | |
cb3ef14c | 7 | SC_LTTNG_TRACEPOINT_EVENT(execve, |
e17f92ba MD |
8 | TP_PROTO(sc_exit(long ret,) const char *filename, char *const *argv, char *const *envp), |
9 | TP_ARGS(sc_exit(ret,) filename, argv, envp), | |
57ede728 MD |
10 | TP_FIELDS(sc_exit(ctf_integer(long, ret, ret)) |
11 | sc_in(ctf_user_string(filename, filename)) | |
12 | sc_in(ctf_integer_hex(char *const *, argv, argv)) | |
13 | sc_in(ctf_integer_hex(char *const *, envp, envp)) | |
14 | ) | |
e42e81fd MD |
15 | ) |
16 | ||
f56826ae MJ |
17 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
18 | ||
d775625e GB |
19 | /* |
20 | * Clone()'s `flags` field has two parts: | |
21 | * 1. exit signal: the least significant byte of the `unsigned long` is | |
22 | * the signal the kernel must send to the parent process on child | |
23 | * exit, | |
24 | * 2. clone options: the remaining bytes of the `unsigned long` is used a | |
25 | * bitwise flag for the clone options. | |
26 | */ | |
27 | #define CLONE_EXIT_SIGNAL_FLAG_RESERVED_BITS 8 | |
28 | #define LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(x) ((x) >> CLONE_EXIT_SIGNAL_FLAG_RESERVED_BITS) | |
29 | ||
30 | SC_LTTNG_TRACEPOINT_ENUM(lttng_clone_exit_signal_flags, | |
31 | TP_ENUM_VALUES( | |
32 | ctf_enum_value("SIGHUP", SIGHUP) | |
33 | ctf_enum_value("SIGINT", SIGINT) | |
34 | ctf_enum_value("SIGQUIT", SIGQUIT) | |
35 | ctf_enum_value("SIGILL", SIGILL) | |
36 | ctf_enum_value("SIGTRAP", SIGTRAP) | |
37 | ctf_enum_value("SIGABRT", SIGABRT) | |
38 | ctf_enum_value("SIGIOT", SIGIOT) | |
39 | ctf_enum_value("SIGBUS", SIGBUS) | |
40 | #ifdef SIGEMT | |
41 | ctf_enum_value("SIGEMT", SIGEMT) | |
42 | #endif /* #ifdef SIGEMT */ | |
43 | ctf_enum_value("SIGFPE", SIGFPE) | |
44 | ctf_enum_value("SIGKILL", SIGKILL) | |
45 | ctf_enum_value("SIGUSR1", SIGUSR1) | |
46 | ctf_enum_value("SIGSEGV", SIGSEGV) | |
47 | ctf_enum_value("SIGUSR2", SIGUSR2) | |
48 | ctf_enum_value("SIGPIPE", SIGPIPE) | |
49 | ctf_enum_value("SIGALRM", SIGALRM) | |
50 | ctf_enum_value("SIGTERM", SIGTERM) | |
51 | #ifdef SIGSTKFLT | |
52 | ctf_enum_value("SIGSTKFLT", SIGSTKFLT) | |
53 | #endif /* #ifdef SIGSTKFLT */ | |
54 | ctf_enum_value("SIGCHLD", SIGCHLD) | |
55 | #ifdef SIGCLD | |
56 | ctf_enum_value("SIGCLD", SIGCLD) | |
57 | #endif /* #ifdef SIGCLD */ | |
58 | ctf_enum_value("SIGCONT", SIGCONT) | |
59 | ctf_enum_value("SIGSTOP", SIGSTOP) | |
60 | ctf_enum_value("SIGTSTP", SIGTSTP) | |
61 | ctf_enum_value("SIGTTIN", SIGTTIN) | |
62 | ctf_enum_value("SIGTTOU", SIGTTOU) | |
63 | ctf_enum_value("SIGURG", SIGURG) | |
64 | ctf_enum_value("SIGXCPU", SIGXCPU) | |
65 | ctf_enum_value("SIGXFSZ", SIGXFSZ) | |
66 | ctf_enum_value("SIGVTALR", SIGVTALRM) | |
67 | ctf_enum_value("SIGPROF", SIGPROF) | |
68 | ctf_enum_value("SIGWINCH", SIGWINCH) | |
69 | ctf_enum_value("SIGIO", SIGIO) | |
70 | ctf_enum_value("SIGPOLL", SIGPOLL) | |
71 | ctf_enum_value("SIGPWR", SIGPWR) | |
72 | #ifdef SIGINFO | |
73 | ctf_enum_value("SIGINFO", SIGINFO) | |
74 | #endif /* #ifdef SIGINFO */ | |
75 | #ifdef SIGLOST | |
76 | ctf_enum_value("SIGLOST", SIGLOST) | |
77 | #endif /* #ifdef SIGLOST */ | |
78 | ctf_enum_value("SIGSYS", SIGSYS) | |
79 | #ifdef SIGUNUSED | |
80 | ctf_enum_value("SIGUNUSED", SIGUNUSED) | |
81 | #endif /* #ifdef SIGUNUSED */ | |
82 | ) | |
83 | ) | |
84 | ||
85 | SC_LTTNG_TRACEPOINT_ENUM(lttng_clone_option_flags, | |
86 | TP_ENUM_VALUES( | |
87 | ctf_enum_value("CLONE_CHILD_CLEARTID", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_CHILD_CLEARTID)) | |
88 | ctf_enum_value("CLONE_CHILD_SETTID", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_CHILD_SETTID)) | |
5f4c791e | 89 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,5,0)) |
d775625e | 90 | ctf_enum_value("CLONE_CLEAR_SIGHAND", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_CLEAR_SIGHAND)) |
5f4c791e | 91 | #endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,5,0)) */ |
d775625e GB |
92 | ctf_enum_value("CLONE_DETACHED", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_DETACHED)) |
93 | ctf_enum_value("CLONE_FILES", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_FILES)) | |
94 | ctf_enum_value("CLONE_FS", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_FS)) | |
95 | ctf_enum_value("CLONE_IO", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_IO)) | |
5f4c791e | 96 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) |
d775625e | 97 | ctf_enum_value("CLONE_NEWCGROUP", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_NEWCGROUP)) |
5f4c791e | 98 | #endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) */ |
d775625e GB |
99 | ctf_enum_value("CLONE_NEWIPC", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_NEWIPC)) |
100 | ctf_enum_value("CLONE_NEWNET", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_NEWNET)) | |
101 | ctf_enum_value("CLONE_NEWNS", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_NEWNS)) | |
102 | ctf_enum_value("CLONE_NEWPID", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_NEWPID)) | |
103 | ctf_enum_value("CLONE_NEWUSER", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_NEWUSER)) | |
104 | ctf_enum_value("CLONE_NEWUTS", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_NEWUTS)) | |
105 | ctf_enum_value("CLONE_PARENT", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_PARENT)) | |
106 | ctf_enum_value("CLONE_PARENT_SETTID", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_PARENT_SETTID)) | |
5f4c791e | 107 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,2,0)) |
d775625e | 108 | ctf_enum_value("CLONE_PIDFD", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_PIDFD)) |
5f4c791e | 109 | #endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,2,0)) */ |
d775625e GB |
110 | ctf_enum_value("CLONE_PTRACE", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_PTRACE)) |
111 | ctf_enum_value("CLONE_SETTLS", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_SETTLS)) | |
112 | ctf_enum_value("CLONE_SIGHAND", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_SIGHAND)) | |
113 | ctf_enum_value("CLONE_SYSVSEM", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_SYSVSEM)) | |
114 | ctf_enum_value("CLONE_THREAD", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_THREAD)) | |
115 | ctf_enum_value("CLONE_UNTRACED", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_UNTRACED)) | |
116 | ctf_enum_value("CLONE_VFORK", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_VFORK)) | |
117 | ctf_enum_value("CLONE_VM", LTTNG_CLONE_OPTIONS_FLAGS_TO_CTF(CLONE_VM)) | |
118 | ) | |
119 | ) | |
120 | ||
121 | #define LTTNG_CLONE_FLAGS_EXIT_SIGNAL \ | |
437d5aa5 MD |
122 | lttng_kernel_static_event_field("exit_signal", \ |
123 | lttng_kernel_static_type_enum(&__enum_lttng_clone_exit_signal_flags, \ | |
124 | lttng_kernel_static_type_integer(CLONE_EXIT_SIGNAL_FLAG_RESERVED_BITS, \ | |
125 | 1, 0, __BYTE_ORDER, 16)), \ | |
4697aac7 | 126 | false, false) |
d775625e GB |
127 | |
128 | #define LTTNG_CLONE_FLAGS_OPTIONS \ | |
437d5aa5 MD |
129 | lttng_kernel_static_event_field("options", \ |
130 | lttng_kernel_static_type_enum(&__enum_lttng_clone_option_flags, \ | |
131 | lttng_kernel_static_type_integer( \ | |
132 | sizeof(unsigned long) * CHAR_BIT - CLONE_EXIT_SIGNAL_FLAG_RESERVED_BITS, \ | |
133 | 1, 0, __BYTE_ORDER, 16)), \ | |
4697aac7 | 134 | false, false) |
d775625e GB |
135 | |
136 | #if (__BYTE_ORDER == __LITTLE_ENDIAN) | |
137 | #define LTTNG_CLONE_FLAGS \ | |
437d5aa5 | 138 | lttng_kernel_static_event_field_array( \ |
d775625e | 139 | [0] = LTTNG_CLONE_FLAGS_EXIT_SIGNAL, \ |
437d5aa5 MD |
140 | [1] = LTTNG_CLONE_FLAGS_OPTIONS, \ |
141 | ) | |
d775625e GB |
142 | #else |
143 | #define LTTNG_CLONE_FLAGS \ | |
437d5aa5 | 144 | lttng_kernel_static_event_field_array( \ |
d775625e | 145 | [0] = LTTNG_CLONE_FLAGS_OPTIONS, \ |
437d5aa5 MD |
146 | [1] = LTTNG_CLONE_FLAGS_EXIT_SIGNAL, \ |
147 | ) | |
d775625e GB |
148 | #endif |
149 | ||
f56826ae | 150 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ |
d775625e | 151 | |
769ad370 MD |
152 | #define OVERRIDE_32_clone |
153 | #define OVERRIDE_64_clone | |
cb3ef14c | 154 | SC_LTTNG_TRACEPOINT_EVENT(clone, |
e17f92ba | 155 | TP_PROTO(sc_exit(long ret,) unsigned long clone_flags, unsigned long newsp, |
ba21566b | 156 | void __user *parent_tid, |
b5aa4b6a | 157 | void __user *child_tid), |
e17f92ba | 158 | TP_ARGS(sc_exit(ret,) clone_flags, newsp, parent_tid, child_tid), |
57ede728 MD |
159 | TP_FIELDS( |
160 | sc_exit(ctf_integer(long, ret, ret)) | |
d775625e | 161 | sc_in( |
f56826ae | 162 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
d775625e GB |
163 | ctf_custom_field( |
164 | ctf_custom_type( | |
437d5aa5 | 165 | lttng_kernel_static_type_struct(2, LTTNG_CLONE_FLAGS, lttng_alignof(unsigned long) * CHAR_BIT) |
d775625e GB |
166 | ), |
167 | flags, | |
168 | ctf_custom_code( | |
d1f63533 | 169 | ctf_integer_type(unsigned long, clone_flags) |
d775625e GB |
170 | ) |
171 | ) | |
f56826ae MJ |
172 | #else |
173 | ctf_integer_hex(unsigned long, flags, clone_flags) | |
174 | #endif | |
d775625e | 175 | ) |
57ede728 MD |
176 | sc_in(ctf_integer_hex(unsigned long, newsp, newsp)) |
177 | sc_in(ctf_integer_hex(void *, parent_tid, parent_tid)) | |
178 | sc_in(ctf_integer_hex(void *, child_tid, child_tid)) | |
179 | ) | |
ba21566b MD |
180 | ) |
181 | ||
b5aa4b6a | 182 | /* present in 32, missing in 64 due to old kernel headers */ |
644d6e9c MD |
183 | #define OVERRIDE_32_getcpu |
184 | #define OVERRIDE_64_getcpu | |
cb3ef14c | 185 | SC_LTTNG_TRACEPOINT_EVENT(getcpu, |
e17f92ba MD |
186 | TP_PROTO(sc_exit(long ret,) unsigned __user *cpup, unsigned __user *nodep, void *tcache), |
187 | TP_ARGS(sc_exit(ret,) cpup, nodep, tcache), | |
57ede728 MD |
188 | TP_FIELDS( |
189 | sc_exit(ctf_integer(long, ret, ret)) | |
190 | sc_out(ctf_integer_hex(unsigned *, cpup, cpup)) | |
191 | sc_out(ctf_integer_hex(unsigned *, nodep, nodep)) | |
192 | sc_inout(ctf_integer_hex(void *, tcache, tcache)) | |
193 | ) | |
b5aa4b6a MD |
194 | ) |
195 | ||
2335796b MJ |
196 | /* |
197 | * Override 'pipe2' to set the output field 'fildes' to an array of 2 integers | |
198 | * instead of the default integer pointer. | |
199 | */ | |
af44bd3a MD |
200 | #define OVERRIDE_32_pipe2 |
201 | #define OVERRIDE_64_pipe2 | |
cb3ef14c | 202 | SC_LTTNG_TRACEPOINT_EVENT(pipe2, |
af44bd3a MD |
203 | TP_PROTO(sc_exit(long ret,) int * fildes, int flags), |
204 | TP_ARGS(sc_exit(ret,) fildes, flags), | |
57ede728 MD |
205 | TP_FIELDS(sc_exit(ctf_integer(long, ret, ret)) |
206 | sc_out(ctf_user_array(int, fildes, fildes, 2)) | |
207 | sc_in(ctf_integer(int, flags, flags)) | |
208 | ) | |
af44bd3a MD |
209 | ) |
210 | ||
29751f7c JD |
211 | #define LTTNG_SYSCALL_SELECT_locvar \ |
212 | unsigned long *fds_in, *fds_out, *fds_ex; \ | |
213 | unsigned long nr_bytes, nr_ulong; \ | |
214 | uint8_t overflow; | |
215 | ||
216 | #define LTTNG_SYSCALL_SELECT_code_pre \ | |
217 | sc_inout( \ | |
218 | { \ | |
219 | int err; \ | |
220 | unsigned int n_in_bytes; \ | |
221 | \ | |
222 | tp_locvar->fds_in = NULL; \ | |
223 | tp_locvar->fds_out = NULL; \ | |
224 | tp_locvar->fds_ex = NULL; \ | |
225 | tp_locvar->overflow = 0; \ | |
226 | \ | |
227 | sc_out( \ | |
228 | if (ret <= 0) \ | |
229 | goto error; \ | |
230 | ) \ | |
231 | \ | |
232 | if (n <= 0) \ | |
233 | goto error; \ | |
234 | \ | |
235 | /* On error or bogus input, don't copy anything. */ \ | |
236 | if (n >__FD_SETSIZE) \ | |
237 | goto error; \ | |
238 | \ | |
239 | n_in_bytes = DIV_ROUND_UP((unsigned int) n, BITS_PER_BYTE); \ | |
240 | \ | |
241 | /* \ | |
242 | * Limit atomic memory allocation to one page, since n \ | |
243 | * is limited to 1024 and the smallest page size on Linux \ | |
244 | * is 4k, this should not happen, don't try to make it work. \ | |
245 | */ \ | |
246 | if (n_in_bytes > PAGE_SIZE) { \ | |
247 | WARN_ON_ONCE(1); \ | |
248 | /* Inform the user that we did not output everything. */ \ | |
249 | tp_locvar->overflow = 1; \ | |
250 | goto error; \ | |
251 | } else { \ | |
252 | tp_locvar->nr_bytes = n_in_bytes; \ | |
253 | tp_locvar->nr_ulong = DIV_ROUND_UP(n_in_bytes, \ | |
254 | sizeof(unsigned long)); \ | |
255 | } \ | |
256 | \ | |
257 | if (inp) { \ | |
ec85ce1d JD |
258 | tp_locvar->fds_in = lttng_tp_mempool_alloc( \ |
259 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
29751f7c JD |
260 | if (!tp_locvar->fds_in) \ |
261 | goto error; \ | |
262 | \ | |
263 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
264 | tp_locvar->fds_in, inp, \ | |
265 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
266 | if (err != 0) \ | |
267 | goto error; \ | |
268 | } \ | |
269 | if (outp) { \ | |
ec85ce1d JD |
270 | tp_locvar->fds_out = lttng_tp_mempool_alloc( \ |
271 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
29751f7c JD |
272 | if (!tp_locvar->fds_out) \ |
273 | goto error; \ | |
274 | \ | |
275 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
276 | tp_locvar->fds_out, outp, \ | |
277 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
278 | if (err != 0) \ | |
279 | goto error; \ | |
280 | } \ | |
281 | if (exp) { \ | |
ec85ce1d JD |
282 | tp_locvar->fds_ex = lttng_tp_mempool_alloc( \ |
283 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
29751f7c JD |
284 | if (!tp_locvar->fds_ex) \ |
285 | goto error; \ | |
286 | \ | |
287 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
288 | tp_locvar->fds_ex, exp, \ | |
289 | tp_locvar->nr_ulong * sizeof(unsigned long)); \ | |
290 | if (err != 0) \ | |
291 | goto error; \ | |
292 | } \ | |
293 | goto end; \ | |
294 | \ | |
295 | error: \ | |
296 | tp_locvar->nr_bytes = 0; \ | |
297 | tp_locvar->nr_ulong = 0; \ | |
298 | end: ; /* Label at end of compound statement. */ \ | |
299 | } \ | |
300 | ) | |
301 | ||
302 | #define LTTNG_SYSCALL_SELECT_fds_field_LE(name, input) \ | |
303 | ctf_custom_field( \ | |
304 | ctf_custom_type( \ | |
437d5aa5 | 305 | lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10) \ |
29751f7c | 306 | ), \ |
ceabb767 | 307 | _ ## name ## _length, \ |
29751f7c | 308 | ctf_custom_code( \ |
29751f7c JD |
309 | if (input) { \ |
310 | ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \ | |
311 | ctf_align(uint8_t) \ | |
312 | } else { \ | |
313 | ctf_integer_type(uint8_t, 0) \ | |
314 | ctf_align(uint8_t) \ | |
29751f7c | 315 | } \ |
ceabb767 MD |
316 | ) \ |
317 | ) \ | |
318 | ctf_custom_field( \ | |
319 | ctf_custom_type( \ | |
51ef4536 | 320 | lttng_kernel_static_type_sequence(NULL, \ |
437d5aa5 MD |
321 | lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 16), \ |
322 | 0, \ | |
323 | none) \ | |
ceabb767 MD |
324 | ), \ |
325 | name, \ | |
326 | ctf_custom_code( \ | |
327 | unsigned int src; \ | |
328 | unsigned int nr_bytes_out = 0; \ | |
329 | \ | |
330 | if (!input) \ | |
331 | goto skip_##name; \ | |
29751f7c JD |
332 | \ |
333 | for (src = 0; src < tp_locvar->nr_ulong; src++) { \ | |
334 | int dst; \ | |
335 | for (dst = 0; dst < sizeof(long); dst++) { \ | |
336 | if (nr_bytes_out++ >= tp_locvar->nr_bytes) { \ | |
337 | goto skip_##name; \ | |
338 | } \ | |
339 | ctf_user_integer_type(uint8_t, \ | |
340 | ((uint8_t __user *) (input->fds_bits + src))[dst]); \ | |
341 | } \ | |
342 | } \ | |
343 | skip_##name: ; \ | |
344 | ) \ | |
345 | ) | |
346 | ||
347 | #define LTTNG_SYSCALL_SELECT_fds_field_BE(name, input) \ | |
348 | ctf_custom_field( \ | |
349 | ctf_custom_type( \ | |
437d5aa5 | 350 | lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 10) \ |
29751f7c | 351 | ), \ |
ceabb767 | 352 | _ ## name ## _length, \ |
29751f7c | 353 | ctf_custom_code( \ |
29751f7c JD |
354 | if (input) { \ |
355 | ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \ | |
356 | ctf_align(uint8_t) \ | |
357 | } else { \ | |
358 | ctf_integer_type(uint8_t, 0) \ | |
359 | ctf_align(uint8_t) \ | |
29751f7c | 360 | } \ |
ceabb767 MD |
361 | ) \ |
362 | ) \ | |
363 | ctf_custom_field( \ | |
364 | ctf_custom_type( \ | |
51ef4536 | 365 | lttng_kernel_static_type_sequence(NULL, \ |
437d5aa5 MD |
366 | lttng_kernel_static_type_integer_from_type(uint8_t, __BYTE_ORDER, 16), \ |
367 | 0, \ | |
368 | none) \ | |
ceabb767 MD |
369 | ), \ |
370 | name, \ | |
371 | ctf_custom_code( \ | |
372 | unsigned int src, nr_bytes_out = 0; \ | |
373 | \ | |
374 | if (!input) \ | |
375 | goto skip_##name; \ | |
29751f7c JD |
376 | \ |
377 | for (src = 0; src < tp_locvar->nr_ulong; src++) { \ | |
378 | int dst; \ | |
379 | for (dst = sizeof(long); dst >= 0; dst--) { \ | |
380 | if (nr_bytes_out++ >= tp_locvar->nr_bytes) { \ | |
381 | goto skip_##name; \ | |
382 | } \ | |
383 | ctf_user_integer_type(uint8_t, \ | |
384 | ((uint8_t __user *) (input->fds_bits + src))[dst]); \ | |
385 | } \ | |
386 | } \ | |
387 | skip_##name: ; \ | |
388 | ) \ | |
389 | ) | |
390 | ||
391 | #define LTTNG_SYSCALL_SELECT_code_post \ | |
ec85ce1d JD |
392 | lttng_tp_mempool_free(tp_locvar->fds_in); \ |
393 | lttng_tp_mempool_free(tp_locvar->fds_out); \ | |
394 | lttng_tp_mempool_free(tp_locvar->fds_ex); | |
29751f7c | 395 | |
a6370148 | 396 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) |
92dd6990 MJ |
397 | /* |
398 | * Instead of extracting the user-space pointers of the 3 fd_set, | |
399 | * extract the bitmask of the FDs in the sets (in, out, ex) in the form | |
400 | * of an array of uint8_t (1024 FDs is the limit in the kernel). | |
401 | */ | |
29751f7c JD |
402 | #define OVERRIDE_32_select |
403 | #define OVERRIDE_64_select | |
404 | SC_LTTNG_TRACEPOINT_EVENT_CODE(select, | |
405 | TP_PROTO(sc_exit(long ret,) int n, fd_set __user *inp, fd_set __user *outp, | |
406 | fd_set __user *exp, struct timeval *tvp), | |
407 | TP_ARGS(sc_exit(ret,) n, inp, outp, exp, tvp), | |
408 | TP_locvar( | |
409 | LTTNG_SYSCALL_SELECT_locvar | |
410 | ), | |
411 | TP_code_pre( | |
412 | LTTNG_SYSCALL_SELECT_code_pre | |
413 | ), | |
414 | TP_FIELDS( | |
415 | sc_exit(ctf_integer(long, ret, ret)) | |
416 | sc_in(ctf_integer(int, n, n)) | |
417 | sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
418 | sc_inout(ctf_integer(struct timeval *, tvp, tvp)) | |
419 | ||
420 | sc_inout( | |
421 | #if (__BYTE_ORDER == __LITTLE_ENDIAN) | |
422 | LTTNG_SYSCALL_SELECT_fds_field_LE(readfds, inp) | |
423 | LTTNG_SYSCALL_SELECT_fds_field_LE(writefds, outp) | |
424 | LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds, exp) | |
425 | #else | |
426 | LTTNG_SYSCALL_SELECT_fds_field_BE(readfds, inp) | |
427 | LTTNG_SYSCALL_SELECT_fds_field_BE(writefds, outp) | |
428 | LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds, exp) | |
429 | #endif | |
430 | ) | |
431 | ), | |
432 | TP_code_post( | |
433 | LTTNG_SYSCALL_SELECT_code_post | |
434 | ) | |
435 | ) | |
639655f9 | 436 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */ |
29751f7c JD |
437 | |
438 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) | |
92dd6990 MJ |
439 | /* |
440 | * Instead of extracting the user-space pointers of the 3 fd_set, | |
441 | * extract the bitmask of the FDs in the sets (in, out, ex) in the form | |
442 | * of an array of uint8_t (1024 FDs is the limit in the kernel). | |
443 | */ | |
29751f7c JD |
444 | #define OVERRIDE_32_pselect6 |
445 | #define OVERRIDE_64_pselect6 | |
446 | SC_LTTNG_TRACEPOINT_EVENT_CODE(pselect6, | |
447 | TP_PROTO(sc_exit(long ret,) int n, fd_set __user * inp, fd_set __user * outp, | |
448 | fd_set __user * exp, struct timeval __user * tvp, void __user * sig), | |
449 | TP_ARGS(sc_exit(ret,) n, inp, outp, exp, tvp, sig), | |
450 | TP_locvar( | |
451 | LTTNG_SYSCALL_SELECT_locvar | |
452 | ), | |
453 | TP_code_pre( | |
454 | LTTNG_SYSCALL_SELECT_code_pre | |
455 | ), | |
456 | TP_FIELDS( | |
457 | sc_exit(ctf_integer(long, ret, ret)) | |
458 | sc_in(ctf_integer(int, n, n)) | |
459 | sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
460 | sc_inout(ctf_integer(struct timeval *, tvp, tvp)) | |
461 | sc_in(ctf_integer_hex(void *, sig, sig)) | |
462 | ||
463 | sc_inout( | |
464 | #if (__BYTE_ORDER == __LITTLE_ENDIAN) | |
465 | LTTNG_SYSCALL_SELECT_fds_field_LE(readfds, inp) | |
466 | LTTNG_SYSCALL_SELECT_fds_field_LE(writefds, outp) | |
467 | LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds, exp) | |
468 | #else | |
469 | LTTNG_SYSCALL_SELECT_fds_field_BE(readfds, inp) | |
470 | LTTNG_SYSCALL_SELECT_fds_field_BE(writefds, outp) | |
471 | LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds, exp) | |
472 | #endif | |
473 | ) | |
474 | ), | |
475 | TP_code_post( | |
476 | LTTNG_SYSCALL_SELECT_code_post | |
477 | ) | |
478 | ) | |
479 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
480 | ||
92dd6990 MJ |
481 | #if defined(CONFIG_X86_32) || defined(CONFIG_ARM) |
482 | /* | |
483 | * Instead of extracting the user-space pointers of the 3 fd_set, | |
484 | * extract the bitmask of the FDs in the sets (in, out, ex) in the form | |
485 | * of an array of uint8_t (1024 FDs is the limit in the kernel). | |
486 | */ | |
487 | #define OVERRIDE_32_pselect6_time32 | |
488 | SC_LTTNG_TRACEPOINT_EVENT_CODE(pselect6_time32, | |
489 | TP_PROTO(sc_exit(long ret,) int n, fd_set __user * inp, fd_set __user * outp, | |
490 | fd_set __user * exp, struct old_timespec32 __user * tvp, void __user * sig), | |
491 | TP_ARGS(sc_exit(ret,) n, inp, outp, exp, tvp, sig), | |
492 | TP_locvar( | |
493 | LTTNG_SYSCALL_SELECT_locvar | |
494 | ), | |
495 | TP_code_pre( | |
496 | LTTNG_SYSCALL_SELECT_code_pre | |
497 | ), | |
498 | TP_FIELDS( | |
499 | sc_exit(ctf_integer(long, ret, ret)) | |
500 | sc_in(ctf_integer(int, n, n)) | |
501 | sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
502 | sc_inout(ctf_integer(struct old_timespec32 *, tvp, tvp)) | |
503 | sc_in(ctf_integer_hex(void *, sig, sig)) | |
504 | ||
505 | sc_inout( | |
506 | #if (__BYTE_ORDER == __LITTLE_ENDIAN) | |
507 | LTTNG_SYSCALL_SELECT_fds_field_LE(readfds, inp) | |
508 | LTTNG_SYSCALL_SELECT_fds_field_LE(writefds, outp) | |
509 | LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds, exp) | |
510 | #else | |
511 | LTTNG_SYSCALL_SELECT_fds_field_BE(readfds, inp) | |
512 | LTTNG_SYSCALL_SELECT_fds_field_BE(writefds, outp) | |
513 | LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds, exp) | |
514 | #endif | |
515 | ) | |
516 | ), | |
517 | TP_code_post( | |
518 | LTTNG_SYSCALL_SELECT_code_post | |
519 | ) | |
520 | ) | |
521 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_ARM) */ | |
522 | ||
9857164a | 523 | #ifdef LTTNG_CREATE_FIELD_METADATA |
6a2ecd2e JD |
524 | #ifndef ONCE_LTTNG_TRACE_POLL_H |
525 | #define ONCE_LTTNG_TRACE_POLL_H | |
526 | ||
527 | #define LTTNG_POLL_NRFLAGS (POLLNVAL + 1) | |
528 | #define POLL_FLAGS_PADDING_SIZE (sizeof(uint8_t) * BITS_PER_BYTE) - \ | |
529 | ilog2(LTTNG_POLL_NRFLAGS - 1) | |
530 | ||
9857164a | 531 | #ifndef LTTNG_TRACEPOINT_TYPE_EXTERN |
6a2ecd2e JD |
532 | /* |
533 | * Only extract the values specified by iBCS2 for now. | |
534 | */ | |
437d5aa5 MD |
535 | static const struct lttng_kernel_event_field *lttng_pollfd_flag_fields[] = { |
536 | [ilog2(POLLIN)] = lttng_kernel_static_event_field("POLLIN", | |
537 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 538 | false, false), |
437d5aa5 MD |
539 | [ilog2(POLLPRI)] = lttng_kernel_static_event_field("POLLPRI", |
540 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 541 | false, false), |
437d5aa5 MD |
542 | [ilog2(POLLOUT)] = lttng_kernel_static_event_field("POLLOUT", |
543 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 544 | false, false), |
437d5aa5 MD |
545 | [ilog2(POLLERR)] = lttng_kernel_static_event_field("POLLERR", |
546 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 547 | false, false), |
437d5aa5 MD |
548 | [ilog2(POLLHUP)] = lttng_kernel_static_event_field("POLLHUP", |
549 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 550 | false, false), |
437d5aa5 MD |
551 | [ilog2(POLLNVAL)] = lttng_kernel_static_event_field("POLLNVAL", |
552 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 553 | false, false), |
437d5aa5 MD |
554 | [ilog2(LTTNG_POLL_NRFLAGS)] = lttng_kernel_static_event_field("padding", |
555 | lttng_kernel_static_type_integer(POLL_FLAGS_PADDING_SIZE, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 556 | false, false), |
6a2ecd2e JD |
557 | }; |
558 | ||
9857164a FD |
559 | static_assert(((ARRAY_SIZE(lttng_pollfd_flag_fields) - 1) + POLL_FLAGS_PADDING_SIZE) == sizeof(uint8_t) * BITS_PER_BYTE); |
560 | ||
561 | #endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */ | |
562 | ||
563 | LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_pollfd_flag_fields_struct), | |
c27937ce | 564 | PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_pollfd_flag_fields), lttng_pollfd_flag_fields, 0))) |
9857164a FD |
565 | |
566 | #ifndef LTTNG_TRACEPOINT_TYPE_EXTERN | |
437d5aa5 MD |
567 | static const struct lttng_kernel_event_field *lttng_pollfd_fields[] = { |
568 | [0] = lttng_kernel_static_event_field("fd", lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10), | |
4697aac7 | 569 | false, false), |
437d5aa5 | 570 | [1] = lttng_kernel_static_event_field("raw_events", lttng_kernel_static_type_integer_from_type(uint16_t, __BYTE_ORDER, 16), |
4697aac7 | 571 | false, false), |
437d5aa5 | 572 | [2] = lttng_kernel_static_event_field("events", |
9857164a | 573 | (const struct lttng_kernel_type_common *) <tng_pollfd_flag_fields_struct, |
4697aac7 | 574 | false, false), |
6a2ecd2e | 575 | }; |
9857164a FD |
576 | #endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */ |
577 | ||
578 | LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_pollfd_fields_struct), | |
579 | PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_pollfd_fields), lttng_pollfd_fields, 0))) | |
6a2ecd2e | 580 | |
6a2ecd2e | 581 | #endif /* ONCE_LTTNG_TRACE_POLL_H */ |
9857164a | 582 | #endif /* LTTNG_CREATE_FIELD_METADATA */ |
6a2ecd2e JD |
583 | |
584 | #define LTTNG_SYSCALL_POLL_locvar \ | |
585 | unsigned int fds_length, fds_max_len, alloc_fds; \ | |
586 | struct pollfd *fds; \ | |
587 | uint8_t overflow; | |
588 | ||
589 | #define LTTNG_SYSCALL_POLL_code_pre \ | |
6a2ecd2e JD |
590 | tp_locvar->fds = NULL; \ |
591 | tp_locvar->overflow = 0; \ | |
592 | \ | |
593 | sc_in( \ | |
594 | if (nfds > PAGE_SIZE / sizeof(struct pollfd)) { \ | |
595 | tp_locvar->fds_length = PAGE_SIZE / sizeof(struct pollfd); \ | |
596 | tp_locvar->fds_max_len = PAGE_SIZE / sizeof(struct pollfd); \ | |
597 | tp_locvar->overflow = 1; \ | |
598 | } else { \ | |
599 | tp_locvar->fds_length = nfds; \ | |
600 | tp_locvar->fds_max_len = nfds; \ | |
601 | } \ | |
602 | tp_locvar->alloc_fds = tp_locvar->fds_length * sizeof(struct pollfd); \ | |
603 | ) \ | |
604 | /* \ | |
605 | * On exit, the number of active FDs is determined by ret, \ | |
606 | * nfds stays the same as the entry, but we only want to \ | |
607 | * output the FDs that are relevant. \ | |
608 | */ \ | |
609 | sc_out( \ | |
610 | if (ret <= 0 || ret > nfds) \ | |
611 | goto error; \ | |
612 | \ | |
613 | if (nfds > PAGE_SIZE / sizeof(struct pollfd)) { \ | |
614 | tp_locvar->fds_length = PAGE_SIZE / sizeof(struct pollfd); \ | |
615 | tp_locvar->fds_max_len = PAGE_SIZE / sizeof(struct pollfd); \ | |
616 | tp_locvar->overflow = 1; \ | |
617 | } else { \ | |
618 | tp_locvar->fds_length = ret; \ | |
619 | tp_locvar->fds_max_len = nfds; \ | |
620 | } \ | |
621 | tp_locvar->alloc_fds = tp_locvar->fds_max_len * sizeof(struct pollfd); \ | |
622 | ) \ | |
623 | { \ | |
624 | int err; \ | |
625 | \ | |
ec85ce1d | 626 | tp_locvar->fds = lttng_tp_mempool_alloc(tp_locvar->alloc_fds); \ |
6a2ecd2e JD |
627 | if (!tp_locvar->fds) \ |
628 | goto error; \ | |
629 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
41a3cca2 | 630 | tp_locvar->fds, ufds, tp_locvar->alloc_fds); \ |
6a2ecd2e JD |
631 | if (err != 0) \ |
632 | goto error; \ | |
633 | } \ | |
634 | goto end; \ | |
635 | \ | |
636 | error: \ | |
637 | tp_locvar->fds_length = 0; \ | |
638 | tp_locvar->fds_max_len = 0; \ | |
639 | end: \ | |
640 | ; | |
641 | ||
642 | #define LTTNG_SYSCALL_POLL_fds_field \ | |
643 | sc_in( \ | |
644 | ctf_custom_field( \ | |
645 | ctf_custom_type( \ | |
437d5aa5 | 646 | lttng_kernel_static_type_sequence("fds_length", \ |
9857164a | 647 | (const struct lttng_kernel_type_common *) <tng_pollfd_fields_struct, \ |
437d5aa5 MD |
648 | 0, \ |
649 | none) \ | |
6a2ecd2e JD |
650 | ), \ |
651 | fds, \ | |
652 | ctf_custom_code( \ | |
653 | uint32_t i; \ | |
654 | \ | |
655 | ctf_align(int) /* Align on largest field in struct. */ \ | |
656 | for (i = 0; i < tp_locvar->fds_length; i++) { \ | |
657 | ctf_integer_type(int, tp_locvar->fds[i].fd) \ | |
658 | ctf_integer_type(short, tp_locvar->fds[i].events) \ | |
659 | ctf_integer_bitfield_type(uint8_t, \ | |
660 | (uint8_t) tp_locvar->fds[i].events) \ | |
661 | } \ | |
662 | ) \ | |
663 | ) \ | |
664 | ) \ | |
665 | sc_out( \ | |
666 | ctf_custom_field( \ | |
667 | ctf_custom_type( \ | |
437d5aa5 | 668 | lttng_kernel_static_type_sequence("fds_length", \ |
9857164a | 669 | (const struct lttng_kernel_type_common *) <tng_pollfd_fields_struct, \ |
437d5aa5 MD |
670 | 0, \ |
671 | none) \ | |
6a2ecd2e JD |
672 | ), \ |
673 | fds, \ | |
674 | ctf_custom_code( \ | |
675 | unsigned int i, nr = 0; \ | |
676 | \ | |
677 | ctf_align(int) /* Align on largest field in struct. */ \ | |
678 | /* \ | |
679 | * Iterate over the complete array, but only output \ | |
680 | * "ret" active FDs. \ | |
681 | */ \ | |
682 | for (i = 0; i < tp_locvar->fds_max_len; i++) { \ | |
683 | if (!tp_locvar->fds[i].revents) \ | |
684 | continue; \ | |
685 | if (nr++ >= tp_locvar->fds_length) \ | |
686 | break; \ | |
687 | ctf_integer_type(int, tp_locvar->fds[i].fd) \ | |
688 | ctf_integer_type(short, tp_locvar->fds[i].revents) \ | |
689 | ctf_integer_bitfield_type(uint8_t, \ | |
690 | (uint8_t) tp_locvar->fds[i].revents) \ | |
691 | } \ | |
692 | /* \ | |
693 | * If there is a discrepancy between ret and the \ | |
694 | * content of revents (e.g. caused by userspace corrupting \ | |
695 | * the array from a concurrent thread), we have to output \ | |
696 | * zeros to keep the trace readable. \ | |
697 | */ \ | |
698 | for (i = nr; i < tp_locvar->fds_length; i++) { \ | |
699 | ctf_integer_type(int, 0) \ | |
700 | ctf_integer_type(short, 0) \ | |
701 | ctf_integer_bitfield_type(uint8_t, 0) \ | |
702 | } \ | |
703 | ) \ | |
704 | ) \ | |
705 | ) | |
706 | ||
707 | #define LTTNG_SYSCALL_POLL_code_post \ | |
ec85ce1d | 708 | lttng_tp_mempool_free(tp_locvar->fds); |
6a2ecd2e | 709 | |
a6370148 | 710 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) |
92dd6990 MJ |
711 | /* |
712 | * Instead of printing the pointer address of the poll set, extract all the FDs | |
713 | * and flags from the poll set. For now, only output the standardized | |
714 | * set of events to limit the verbosity of the output, and also extract | |
715 | * the raw value. In the future, moving to CTF2 will allow hiding unset | |
716 | * fields and then allow extracting all the fields. | |
717 | */ | |
6a2ecd2e JD |
718 | #define OVERRIDE_32_poll |
719 | #define OVERRIDE_64_poll | |
720 | SC_LTTNG_TRACEPOINT_EVENT_CODE(poll, | |
721 | TP_PROTO(sc_exit(long ret,) struct pollfd __user * ufds, | |
722 | unsigned int nfds, int timeout_msecs), | |
723 | TP_ARGS(sc_exit(ret,) ufds, nfds, timeout_msecs), | |
724 | TP_locvar( | |
725 | LTTNG_SYSCALL_POLL_locvar | |
726 | ), | |
727 | TP_code_pre( | |
728 | LTTNG_SYSCALL_POLL_code_pre | |
729 | ), | |
730 | TP_FIELDS( | |
731 | sc_exit(ctf_integer(long, ret, ret)) | |
732 | sc_in(ctf_integer(int, timeout_msecs, timeout_msecs)) | |
733 | sc_inout(ctf_integer(unsigned int, nfds, nfds)) | |
734 | sc_inout(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
735 | sc_in(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
736 | LTTNG_SYSCALL_POLL_fds_field | |
737 | ), | |
738 | TP_code_post( | |
739 | LTTNG_SYSCALL_POLL_code_post | |
740 | ) | |
741 | ) | |
639655f9 | 742 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */ |
6a2ecd2e JD |
743 | |
744 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) | |
92dd6990 MJ |
745 | /* |
746 | * Instead of printing the pointer address of the poll set, extract all the FDs | |
747 | * and flags from the poll set. For now, only output the standardized | |
748 | * set of events to limit the verbosity of the output, and also extract | |
749 | * the raw value. In the future, moving to CTF2 will allow hiding unset | |
750 | * fields and then allow extracting all the fields. | |
751 | */ | |
6a2ecd2e JD |
752 | #define OVERRIDE_32_ppoll |
753 | #define OVERRIDE_64_ppoll | |
754 | SC_LTTNG_TRACEPOINT_EVENT_CODE(ppoll, | |
755 | TP_PROTO(sc_exit(long ret,) struct pollfd __user * ufds, | |
756 | unsigned int nfds, struct timespec * tsp, const sigset_t * sigmask, size_t sigsetsize), | |
757 | TP_ARGS(sc_exit(ret,) ufds, nfds, tsp, sigmask, sigsetsize), | |
758 | TP_locvar( | |
759 | LTTNG_SYSCALL_POLL_locvar | |
760 | ), | |
761 | TP_code_pre( | |
762 | LTTNG_SYSCALL_POLL_code_pre | |
763 | ), | |
764 | TP_FIELDS( | |
765 | sc_exit(ctf_integer(long, ret, ret)) | |
766 | sc_in(ctf_integer(struct timespec *, tsp, tsp)) | |
767 | sc_in(ctf_integer(const sigset_t *, sigmask, sigmask)) | |
768 | sc_in(ctf_integer(size_t, sigsetsize, sigsetsize)) | |
769 | sc_inout(ctf_integer(unsigned int, nfds, nfds)) | |
770 | sc_inout(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
771 | sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
772 | LTTNG_SYSCALL_POLL_fds_field | |
773 | ), | |
774 | TP_code_post( | |
775 | LTTNG_SYSCALL_POLL_code_post | |
776 | ) | |
777 | ) | |
778 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
779 | ||
92dd6990 MJ |
780 | #if defined(CONFIG_X86_32) || defined(CONFIG_ARM) |
781 | /* | |
782 | * Instead of printing the pointer address of the poll set, extract all the FDs | |
783 | * and flags from the poll set. For now, only output the standardized | |
784 | * set of events to limit the verbosity of the output, and also extract | |
785 | * the raw value. In the future, moving to CTF2 will allow hiding unset | |
786 | * fields and then allow extracting all the fields. | |
787 | */ | |
788 | #define OVERRIDE_32_ppoll_time32 | |
789 | SC_LTTNG_TRACEPOINT_EVENT_CODE(ppoll_time32, | |
790 | TP_PROTO(sc_exit(long ret,) struct pollfd __user * ufds, | |
791 | unsigned int nfds, struct old_timespec32 * tsp, const sigset_t * sigmask, size_t sigsetsize), | |
792 | TP_ARGS(sc_exit(ret,) ufds, nfds, tsp, sigmask, sigsetsize), | |
793 | TP_locvar( | |
794 | LTTNG_SYSCALL_POLL_locvar | |
795 | ), | |
796 | TP_code_pre( | |
797 | LTTNG_SYSCALL_POLL_code_pre | |
798 | ), | |
799 | TP_FIELDS( | |
800 | sc_exit(ctf_integer(long, ret, ret)) | |
801 | sc_in(ctf_integer(struct old_timespec32 *, tsp, tsp)) | |
802 | sc_in(ctf_integer(const sigset_t *, sigmask, sigmask)) | |
803 | sc_in(ctf_integer(size_t, sigsetsize, sigsetsize)) | |
804 | sc_inout(ctf_integer(unsigned int, nfds, nfds)) | |
805 | sc_inout(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
806 | sc_inout(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
807 | LTTNG_SYSCALL_POLL_fds_field | |
808 | ), | |
809 | TP_code_post( | |
810 | LTTNG_SYSCALL_POLL_code_post | |
811 | ) | |
812 | ) | |
813 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_ARM) */ | |
814 | ||
45e0ded1 JD |
815 | #include <linux/eventpoll.h> |
816 | ||
817 | SC_LTTNG_TRACEPOINT_ENUM(lttng_epoll_op, | |
818 | TP_ENUM_VALUES( | |
819 | ctf_enum_value("EPOLL_CTL_ADD", EPOLL_CTL_ADD) | |
820 | ctf_enum_value("EPOLL_CTL_DEL", EPOLL_CTL_DEL) | |
821 | ctf_enum_value("EPOLL_CTL_MOD", EPOLL_CTL_MOD) | |
822 | ) | |
823 | ) | |
824 | ||
9857164a FD |
825 | #ifdef LTTNG_CREATE_FIELD_METADATA |
826 | ||
45e0ded1 JD |
827 | #ifndef ONCE_LTTNG_TRACE_EPOLL_CTL_H |
828 | #define ONCE_LTTNG_TRACE_EPOLL_CTL_H | |
829 | ||
830 | #define LTTNG_EPOLL_NRFLAGS (POLLHUP + 1) | |
831 | #define EPOLL_FLAGS_PADDING_SIZE (sizeof(uint8_t) * BITS_PER_BYTE) - \ | |
832 | ilog2(LTTNG_EPOLL_NRFLAGS - 1) | |
833 | ||
9857164a | 834 | #ifndef LTTNG_TRACEPOINT_TYPE_EXTERN |
45e0ded1 JD |
835 | /* |
836 | * Only extract the values specified by iBCS2 for now. | |
837 | */ | |
437d5aa5 | 838 | static const struct lttng_kernel_event_field *lttng_epoll_ctl_events_fields[] = { |
45e0ded1 | 839 | /* 0x0001 */ |
437d5aa5 MD |
840 | [ilog2(POLLIN)] = lttng_kernel_static_event_field("EPOLLIN", |
841 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 842 | false, false), |
45e0ded1 | 843 | /* 0x0002 */ |
437d5aa5 MD |
844 | [ilog2(POLLPRI)] = lttng_kernel_static_event_field("EPOLLPRI", |
845 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 846 | false, false), |
45e0ded1 | 847 | /* 0x0004 */ |
437d5aa5 MD |
848 | [ilog2(POLLOUT)] = lttng_kernel_static_event_field("EPOLLOUT", |
849 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 850 | false, false), |
45e0ded1 | 851 | /* 0x0008 */ |
437d5aa5 MD |
852 | [ilog2(POLLERR)] = lttng_kernel_static_event_field("EPOLLERR", |
853 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 854 | false, false), |
45e0ded1 | 855 | /* 0x0010 */ |
437d5aa5 MD |
856 | [ilog2(POLLHUP)] = lttng_kernel_static_event_field("EPOLLHUP", |
857 | lttng_kernel_static_type_integer(1, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 858 | false, false), |
437d5aa5 MD |
859 | [ilog2(LTTNG_EPOLL_NRFLAGS)] = lttng_kernel_static_event_field("padding", |
860 | lttng_kernel_static_type_integer(EPOLL_FLAGS_PADDING_SIZE, 1, 0, __LITTLE_ENDIAN, 10), | |
4697aac7 | 861 | false, false), |
45e0ded1 | 862 | }; |
9857164a FD |
863 | #endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */ |
864 | ||
865 | LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_epoll_ctl_events_fields_struct), | |
866 | PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_epoll_ctl_events_fields), lttng_epoll_ctl_events_fields, 0))) | |
45e0ded1 | 867 | |
9857164a | 868 | #ifndef LTTNG_TRACEPOINT_TYPE_EXTERN |
437d5aa5 MD |
869 | static const struct lttng_kernel_event_field *lttng_epoll_data_fields[] = { |
870 | [0] = lttng_kernel_static_event_field("u64", | |
871 | lttng_kernel_static_type_integer_from_type(uint64_t, __BYTE_ORDER, 16), | |
4697aac7 | 872 | false, false), |
437d5aa5 MD |
873 | [1] = lttng_kernel_static_event_field("fd", |
874 | lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10), | |
4697aac7 | 875 | false, false), |
45e0ded1 | 876 | }; |
9857164a | 877 | #endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */ |
45e0ded1 | 878 | |
9857164a FD |
879 | LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_epoll_data_fields_struct), |
880 | PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_epoll_data_fields), lttng_epoll_data_fields, 0))) | |
881 | ||
882 | #ifndef LTTNG_TRACEPOINT_TYPE_EXTERN | |
437d5aa5 MD |
883 | static const struct lttng_kernel_event_field *epoll_ctl_fields[] = { |
884 | [0] = lttng_kernel_static_event_field("data_union", | |
9857164a | 885 | (const struct lttng_kernel_type_common *) <tng_epoll_data_fields_struct, |
4697aac7 | 886 | false, false), |
437d5aa5 MD |
887 | [1] = lttng_kernel_static_event_field("raw_events", |
888 | lttng_kernel_static_type_integer_from_type(uint32_t, __BYTE_ORDER, 16), | |
4697aac7 | 889 | false, false), |
437d5aa5 | 890 | [2] = lttng_kernel_static_event_field("events", |
9857164a | 891 | (const struct lttng_kernel_type_common *) <tng_epoll_ctl_events_fields_struct, |
4697aac7 | 892 | false, false), |
45e0ded1 | 893 | }; |
9857164a FD |
894 | #endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */ |
895 | ||
896 | LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct epoll_ctl_fields_struct), | |
897 | PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(epoll_ctl_fields), epoll_ctl_fields, 0))) | |
898 | ||
45e0ded1 | 899 | #endif /* ONCE_LTTNG_TRACE_EPOLL_CTL_H */ |
9857164a | 900 | #endif /* LTTNG_CREATE_FIELD_METADATA */ |
45e0ded1 JD |
901 | |
902 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) | |
903 | #define OVERRIDE_32_epoll_ctl | |
904 | #define OVERRIDE_64_epoll_ctl | |
905 | SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_ctl, | |
906 | TP_PROTO(sc_exit(long ret,) int epfd, int op, int fd, | |
907 | struct epoll_event __user * uevent), | |
908 | TP_ARGS(sc_exit(ret,) epfd, op, fd, uevent), | |
909 | TP_locvar( | |
910 | struct epoll_event event; | |
911 | int err; | |
912 | ), | |
913 | TP_code_pre( | |
914 | tp_locvar->err = lib_ring_buffer_copy_from_user_check_nofault( | |
915 | &tp_locvar->event, uevent, sizeof(struct epoll_event)); | |
916 | ), | |
917 | TP_FIELDS( | |
918 | sc_exit(ctf_integer(long, ret, ret)) | |
919 | sc_in(ctf_integer(int, epfd, epfd)) | |
920 | sc_in(ctf_enum(lttng_epoll_op, int, op_enum, op)) | |
921 | sc_in(ctf_integer(int, fd, fd)) | |
922 | sc_in( | |
923 | ctf_custom_field( | |
924 | ctf_custom_type( | |
e42c4f49 | 925 | (const struct lttng_kernel_type_common *) &epoll_ctl_fields_struct |
45e0ded1 JD |
926 | ), |
927 | event, | |
928 | ctf_custom_code( | |
929 | ctf_align(uint64_t) | |
930 | if (!tp_locvar->err) { | |
931 | ctf_integer_type(uint64_t, tp_locvar->event.data) | |
932 | ctf_integer_type(int, tp_locvar->event.data) | |
933 | ctf_integer_bitfield_type(uint32_t, | |
934 | tp_locvar->event.events) | |
935 | ctf_integer_bitfield_type(uint8_t, | |
936 | (uint8_t) tp_locvar->event.events) | |
937 | } else { | |
938 | ctf_integer_type(uint64_t, 0) | |
939 | ctf_integer_type(int, 0) | |
940 | ctf_integer_bitfield_type(uint32_t, 0) | |
941 | ctf_integer_bitfield_type(uint8_t, 0) | |
942 | } | |
943 | ) | |
944 | ) | |
945 | ) | |
946 | ), | |
947 | TP_code_post() | |
948 | ) | |
949 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
950 | ||
9857164a | 951 | #ifdef LTTNG_CREATE_FIELD_METADATA |
f22697ca JD |
952 | #ifndef ONCE_LTTNG_TRACE_EPOLL_H |
953 | #define ONCE_LTTNG_TRACE_EPOLL_H | |
954 | ||
9857164a | 955 | #ifndef LTTNG_TRACEPOINT_TYPE_EXTERN |
437d5aa5 MD |
956 | static const struct lttng_kernel_event_field *lttng_epoll_wait_fields[] = lttng_kernel_static_event_field_array( |
957 | [0] = lttng_kernel_static_event_field("data_union", | |
9857164a | 958 | (const struct lttng_kernel_type_common *) <tng_epoll_data_fields_struct, |
4697aac7 | 959 | false, false), |
437d5aa5 | 960 | [1] = lttng_kernel_static_event_field("raw_events", lttng_kernel_static_type_integer_from_type(uint32_t, __BYTE_ORDER, 16), |
4697aac7 | 961 | false, false), |
437d5aa5 | 962 | [2] = lttng_kernel_static_event_field("events", |
9857164a | 963 | (const struct lttng_kernel_type_common *) <tng_epoll_ctl_events_fields_struct, |
4697aac7 | 964 | false, false), |
437d5aa5 | 965 | ); |
f22697ca | 966 | |
9857164a FD |
967 | static_assert(((ARRAY_SIZE(lttng_epoll_ctl_events_fields) - 1) + EPOLL_FLAGS_PADDING_SIZE) == sizeof(uint8_t) * BITS_PER_BYTE); |
968 | ||
969 | #endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */ | |
970 | ||
971 | LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_epoll_wait_fields_struct), | |
972 | PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_epoll_wait_fields), lttng_epoll_wait_fields, 0))) | |
973 | ||
f22697ca | 974 | #endif /* ONCE_LTTNG_TRACE_EPOLL_H */ |
9857164a | 975 | #endif /* LTTNG_CREATE_FIELD_METADATA */ |
f22697ca JD |
976 | |
977 | #define LTTNG_SYSCALL_EPOLL_WAIT_locvar \ | |
978 | sc_out( \ | |
979 | unsigned int fds_length; \ | |
980 | uint8_t overflow; \ | |
981 | struct epoll_event *events; \ | |
982 | ) | |
983 | ||
984 | #define LTTNG_SYSCALL_EPOLL_WAIT_code_pre \ | |
f22697ca JD |
985 | sc_out({ \ |
986 | int err; \ | |
987 | unsigned long maxalloc; \ | |
988 | \ | |
989 | tp_locvar->fds_length = 0; \ | |
990 | tp_locvar->events = NULL; \ | |
991 | tp_locvar->overflow = 0; \ | |
992 | \ | |
993 | if (maxevents <= 0 || ret <= 0 || ret > maxevents) \ | |
994 | goto skip_code; \ | |
995 | \ | |
996 | if (maxevents > PAGE_SIZE / sizeof(struct epoll_event)) { \ | |
997 | maxalloc = PAGE_SIZE / sizeof(struct epoll_event); \ | |
998 | } else { \ | |
999 | maxalloc = maxevents; \ | |
1000 | } \ | |
1001 | \ | |
1002 | if (ret > maxalloc) { \ | |
1003 | tp_locvar->fds_length = maxalloc; \ | |
1004 | tp_locvar->overflow = 1; \ | |
1005 | } else { \ | |
1006 | tp_locvar->fds_length = ret; \ | |
1007 | } \ | |
1008 | \ | |
437d5aa5 | 1009 | tp_locvar->events = lttng_tp_mempool_alloc( \ |
ec85ce1d | 1010 | maxalloc * sizeof(struct epoll_event)); \ |
f22697ca JD |
1011 | if (!tp_locvar->events) { \ |
1012 | tp_locvar->fds_length = 0; \ | |
1013 | goto skip_code; \ | |
1014 | } \ | |
1015 | \ | |
1016 | err = lib_ring_buffer_copy_from_user_check_nofault( \ | |
1017 | tp_locvar->events, uevents, \ | |
41a3cca2 | 1018 | maxalloc * sizeof(struct epoll_event)); \ |
f22697ca JD |
1019 | if (err != 0) \ |
1020 | tp_locvar->fds_length = 0; \ | |
1021 | } \ | |
1022 | skip_code: \ | |
1023 | ) | |
1024 | ||
1025 | #define LTTNG_SYSCALL_EPOLL_WAIT_fds_field \ | |
1026 | ctf_custom_field( \ | |
1027 | ctf_custom_type( \ | |
437d5aa5 | 1028 | lttng_kernel_static_type_sequence("fds_length", \ |
e42c4f49 | 1029 | (const struct lttng_kernel_type_common *) <tng_epoll_wait_fields_struct, \ |
437d5aa5 MD |
1030 | 0, \ |
1031 | none) \ | |
f22697ca JD |
1032 | ), \ |
1033 | fds, \ | |
1034 | ctf_custom_code( \ | |
1035 | uint32_t i; \ | |
1036 | \ | |
1037 | ctf_align(uint64_t) \ | |
1038 | for (i = 0; i < tp_locvar->fds_length; i++) { \ | |
1039 | ctf_integer_type(uint64_t, tp_locvar->events[i].data) \ | |
1040 | ctf_integer_type(int, tp_locvar->events[i].data) \ | |
1041 | ctf_integer_bitfield_type(uint32_t, \ | |
1042 | tp_locvar->events[i].events) \ | |
1043 | ctf_integer_bitfield_type(uint8_t, \ | |
1044 | (uint8_t) tp_locvar->events[i].events) \ | |
1045 | } \ | |
1046 | ) \ | |
1047 | ) | |
1048 | ||
1049 | #define LTTNG_SYSCALL_EPOLL_WAIT_code_post \ | |
1050 | sc_out( \ | |
ec85ce1d | 1051 | lttng_tp_mempool_free(tp_locvar->events); \ |
f22697ca JD |
1052 | ) |
1053 | ||
1054 | ||
a6370148 | 1055 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) |
f22697ca JD |
1056 | #define OVERRIDE_32_epoll_wait |
1057 | #define OVERRIDE_64_epoll_wait | |
1058 | SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_wait, | |
1059 | TP_PROTO(sc_exit(long ret,) int epfd, struct epoll_event __user * uevents, | |
1060 | int maxevents, int timeout), | |
1061 | TP_ARGS(sc_exit(ret,) epfd, uevents, maxevents, timeout), | |
1062 | TP_locvar( | |
1063 | LTTNG_SYSCALL_EPOLL_WAIT_locvar | |
1064 | ), | |
1065 | TP_code_pre( | |
1066 | LTTNG_SYSCALL_EPOLL_WAIT_code_pre | |
1067 | ), | |
1068 | TP_FIELDS( | |
1069 | sc_exit(ctf_integer(long, ret, ret)) | |
1070 | sc_in(ctf_integer(int, epfd, epfd)) | |
1071 | sc_in(ctf_integer(int, maxevents, maxevents)) | |
1072 | sc_in(ctf_integer(int, timeout, timeout)) | |
1073 | sc_out(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
1074 | sc_out(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
1075 | sc_out( | |
1076 | LTTNG_SYSCALL_EPOLL_WAIT_fds_field | |
1077 | ) | |
1078 | ), | |
1079 | TP_code_post( | |
1080 | LTTNG_SYSCALL_EPOLL_WAIT_code_post | |
1081 | ) | |
1082 | ) | |
639655f9 | 1083 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */ |
f22697ca JD |
1084 | |
1085 | #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) | |
1086 | #define OVERRIDE_32_epoll_pwait | |
1087 | #define OVERRIDE_64_epoll_pwait | |
1088 | SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_pwait, | |
1089 | TP_PROTO(sc_exit(long ret,) int epfd, struct epoll_event __user * uevents, | |
1090 | int maxevents, int timeout, const sigset_t __user * sigmask, size_t sigsetsize), | |
1091 | TP_ARGS(sc_exit(ret,) epfd, uevents, maxevents, timeout, sigmask, sigsetsize), | |
1092 | TP_locvar( | |
1093 | LTTNG_SYSCALL_EPOLL_WAIT_locvar | |
1094 | ), | |
1095 | TP_code_pre( | |
1096 | LTTNG_SYSCALL_EPOLL_WAIT_code_pre | |
1097 | ), | |
1098 | TP_FIELDS( | |
1099 | sc_exit(ctf_integer(long, ret, ret)) | |
1100 | sc_in(ctf_integer(int, epfd, epfd)) | |
1101 | sc_in(ctf_integer(int, maxevents, maxevents)) | |
1102 | sc_in(ctf_integer(int, timeout, timeout)) | |
1103 | sc_in(ctf_integer_hex(const sigset_t *, sigmask, sigmask)) | |
1104 | sc_in(ctf_integer(size_t, sigsetsize, sigsetsize)) | |
1105 | sc_out(ctf_integer(unsigned int, fds_length, tp_locvar->fds_length)) | |
1106 | sc_out(ctf_integer(uint8_t, overflow, tp_locvar->overflow)) | |
1107 | sc_out( | |
1108 | LTTNG_SYSCALL_EPOLL_WAIT_fds_field | |
1109 | ) | |
1110 | ), | |
1111 | TP_code_post( | |
1112 | LTTNG_SYSCALL_EPOLL_WAIT_code_post | |
1113 | ) | |
1114 | ) | |
1115 | #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
1116 | ||
771af27e JW |
1117 | #if (defined(CONFIG_X86_64) && !defined(LTTNG_SC_COMPAT)) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) |
1118 | #define OVERRIDE_32_socketpair | |
1119 | #define OVERRIDE_64_socketpair | |
1120 | SC_LTTNG_TRACEPOINT_EVENT(socketpair, | |
1121 | TP_PROTO(sc_exit(long ret,) int family, int type, int protocol, int *usockvec), | |
1122 | TP_ARGS(sc_exit(ret,) family, type, protocol, usockvec), | |
1123 | TP_FIELDS( | |
1124 | sc_exit(ctf_integer(long, ret, ret)) | |
1125 | sc_in(ctf_integer(int, family, family)) | |
1126 | sc_in(ctf_integer(int, type, type)) | |
1127 | sc_in(ctf_integer(int, protocol, protocol)) | |
1128 | sc_out(ctf_user_array(int, socket, usockvec, 2)) | |
1129 | ) | |
1130 | ) | |
1131 | #endif /* (defined(CONFIG_X86_64) && !defined(LTTNG_SC_COMPAT)) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */ | |
1132 | ||
f52e9f44 | 1133 | #ifdef CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM |
c8dfb724 GB |
1134 | /* |
1135 | * Enumeration of the open flags, as described in the 'open' | |
1136 | * system call man page. | |
1137 | */ | |
1138 | SC_LTTNG_TRACEPOINT_ENUM(lttng_file_status_flags, | |
1139 | TP_ENUM_VALUES( | |
1140 | ctf_enum_value("O_RDONLY", O_RDONLY) | |
1141 | ctf_enum_value("O_WRONLY", O_WRONLY) | |
1142 | ctf_enum_value("O_RDWR", O_RDWR) | |
1143 | ctf_enum_value("O_CREAT", O_CREAT) | |
1144 | ctf_enum_value("O_EXCL", O_EXCL) | |
1145 | ctf_enum_value("O_NOCTTY", O_NOCTTY) | |
1146 | ctf_enum_value("O_TRUNC", O_TRUNC) | |
1147 | ctf_enum_value("O_APPEND", O_APPEND) | |
1148 | ctf_enum_value("O_NONBLOCK", O_NONBLOCK) | |
1149 | ctf_enum_value("O_DSYNC", O_DSYNC) | |
1150 | ctf_enum_value("FASYNC", FASYNC) | |
1151 | ctf_enum_value("O_DIRECT", O_DIRECT) | |
1152 | ctf_enum_value("O_LARGEFILE", O_LARGEFILE) | |
1153 | ctf_enum_value("O_DIRECTORY", O_DIRECTORY) | |
1154 | ctf_enum_value("O_NOFOLLOW", O_NOFOLLOW) | |
1155 | ctf_enum_value("O_NOATIME", O_NOATIME) | |
1156 | ctf_enum_value("O_CLOEXEC", O_CLOEXEC) | |
1157 | ctf_enum_value("O_SYNC", __O_SYNC) | |
1158 | ctf_enum_value("O_PATH", O_PATH) | |
5f4c791e | 1159 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) |
c8dfb724 | 1160 | ctf_enum_value("O_TMPFILE", __O_TMPFILE) |
5f4c791e | 1161 | #endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0)) */ |
c8dfb724 GB |
1162 | ) |
1163 | ) | |
1164 | ||
1165 | /* | |
1166 | * Enumeration of the open flags, as described in the 'open' | |
1167 | * system call man page. | |
1168 | */ | |
1169 | SC_LTTNG_TRACEPOINT_ENUM(lttng_file_mode, | |
1170 | TP_ENUM_VALUES( | |
1171 | ctf_enum_value("S_IRWXU", S_IRWXU) | |
1172 | ctf_enum_value("S_IRUSR", S_IRUSR) | |
1173 | ctf_enum_value("S_IWUSR", S_IWUSR) | |
1174 | ctf_enum_value("S_IXUSR", S_IXUSR) | |
1175 | ctf_enum_value("S_IRWXG", S_IRWXG) | |
1176 | ctf_enum_value("S_IRGRP", S_IRGRP) | |
1177 | ctf_enum_value("S_IWGRP", S_IWGRP) | |
1178 | ctf_enum_value("S_IXGRP", S_IXGRP) | |
1179 | ctf_enum_value("S_IRWXO", S_IRWXO) | |
1180 | ctf_enum_value("S_IROTH", S_IROTH) | |
1181 | ctf_enum_value("S_IWOTH", S_IWOTH) | |
1182 | ctf_enum_value("S_IXOTH", S_IXOTH) | |
1183 | ctf_enum_value("S_ISUID", S_ISUID) | |
1184 | ctf_enum_value("S_ISGID", S_ISGID) | |
1185 | ctf_enum_value("S_ISVTX", S_ISVTX) | |
1186 | ) | |
1187 | ) | |
1188 | ||
1189 | #define OVERRIDE_32_openat | |
1190 | #define OVERRIDE_64_openat | |
1191 | SC_LTTNG_TRACEPOINT_EVENT(openat, | |
1192 | TP_PROTO(sc_exit(long ret,) int dfd, const char * filename, int flags, umode_t mode), | |
1193 | TP_ARGS(sc_exit(ret,) dfd, filename, flags, mode), | |
1194 | TP_FIELDS( | |
1195 | sc_exit(ctf_integer(long, ret, ret)) | |
1196 | sc_in(ctf_integer(int, dfd, dfd)) | |
1197 | sc_in(ctf_user_string(filename, filename)) | |
1198 | sc_in(ctf_enum(lttng_file_status_flags, int, flags, flags)) | |
1199 | sc_in(ctf_enum(lttng_file_mode, umode_t, mode, mode)) | |
1200 | ) | |
1201 | ) | |
1202 | ||
1203 | #define OVERRIDE_32_open | |
1204 | #define OVERRIDE_64_open | |
1205 | SC_LTTNG_TRACEPOINT_EVENT(open, | |
1206 | TP_PROTO(sc_exit(long ret,) const char * filename, int flags, umode_t mode), | |
1207 | TP_ARGS(sc_exit(ret,) filename, flags, mode), | |
1208 | TP_FIELDS( | |
1209 | sc_exit(ctf_integer(long, ret, ret)) | |
1210 | sc_in(ctf_user_string(filename, filename)) | |
1211 | sc_in(ctf_enum(lttng_file_status_flags, int, flags, flags)) | |
1212 | sc_in(ctf_enum(lttng_file_mode, umode_t, mode, mode)) | |
1213 | ) | |
1214 | ) | |
f52e9f44 | 1215 | #endif /* CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM */ |
c8dfb724 | 1216 | |
e42e81fd | 1217 | #endif /* CREATE_SYSCALL_TABLE */ |