1 #ifndef CREATE_SYSCALL_TABLE
3 #define OVERRIDE_32_execve
4 #define OVERRIDE_64_execve
5 SC_LTTNG_TRACEPOINT_EVENT(execve
,
6 TP_PROTO(sc_exit(long ret
,) const char *filename
, char *const *argv
, char *const *envp
),
7 TP_ARGS(sc_exit(ret
,) filename
, argv
, envp
),
8 TP_FIELDS(sc_exit(ctf_integer(long, ret
, ret
))
9 sc_in(ctf_user_string(filename
, filename
))
10 sc_in(ctf_integer_hex(char *const *, argv
, argv
))
11 sc_in(ctf_integer_hex(char *const *, envp
, envp
))
15 #define OVERRIDE_32_clone
16 #define OVERRIDE_64_clone
17 SC_LTTNG_TRACEPOINT_EVENT(clone
,
18 TP_PROTO(sc_exit(long ret
,) unsigned long clone_flags
, unsigned long newsp
,
19 void __user
*parent_tid
,
20 void __user
*child_tid
),
21 TP_ARGS(sc_exit(ret
,) clone_flags
, newsp
, parent_tid
, child_tid
),
23 sc_exit(ctf_integer(long, ret
, ret
))
24 sc_in(ctf_integer_hex(unsigned long, clone_flags
, clone_flags
))
25 sc_in(ctf_integer_hex(unsigned long, newsp
, newsp
))
26 sc_in(ctf_integer_hex(void *, parent_tid
, parent_tid
))
27 sc_in(ctf_integer_hex(void *, child_tid
, child_tid
))
31 /* present in 32, missing in 64 due to old kernel headers */
32 #define OVERRIDE_32_getcpu
33 #define OVERRIDE_64_getcpu
34 SC_LTTNG_TRACEPOINT_EVENT(getcpu
,
35 TP_PROTO(sc_exit(long ret
,) unsigned __user
*cpup
, unsigned __user
*nodep
, void *tcache
),
36 TP_ARGS(sc_exit(ret
,) cpup
, nodep
, tcache
),
38 sc_exit(ctf_integer(long, ret
, ret
))
39 sc_out(ctf_integer_hex(unsigned *, cpup
, cpup
))
40 sc_out(ctf_integer_hex(unsigned *, nodep
, nodep
))
41 sc_inout(ctf_integer_hex(void *, tcache
, tcache
))
45 #define OVERRIDE_32_pipe2
46 #define OVERRIDE_64_pipe2
47 SC_LTTNG_TRACEPOINT_EVENT(pipe2
,
48 TP_PROTO(sc_exit(long ret
,) int * fildes
, int flags
),
49 TP_ARGS(sc_exit(ret
,) fildes
, flags
),
50 TP_FIELDS(sc_exit(ctf_integer(long, ret
, ret
))
51 sc_out(ctf_user_array(int, fildes
, fildes
, 2))
52 sc_in(ctf_integer(int, flags
, flags
))
56 #define LTTNG_SYSCALL_SELECT_locvar \
57 unsigned long *fds_in, *fds_out, *fds_ex; \
58 unsigned long nr_bytes, nr_ulong; \
61 #define LTTNG_SYSCALL_SELECT_code_pre \
65 unsigned int n_in_bytes; \
67 tp_locvar->fds_in = NULL; \
68 tp_locvar->fds_out = NULL; \
69 tp_locvar->fds_ex = NULL; \
70 tp_locvar->overflow = 0; \
80 /* On error or bogus input, don't copy anything. */ \
81 if (n >__FD_SETSIZE) \
84 n_in_bytes = DIV_ROUND_UP((unsigned int) n, BITS_PER_BYTE); \
87 * Limit atomic memory allocation to one page, since n \
88 * is limited to 1024 and the smallest page size on Linux \
89 * is 4k, this should not happen, don't try to make it work. \
91 if (n_in_bytes > PAGE_SIZE) { \
93 /* Inform the user that we did not output everything. */ \
94 tp_locvar->overflow = 1; \
97 tp_locvar->nr_bytes = n_in_bytes; \
98 tp_locvar->nr_ulong = DIV_ROUND_UP(n_in_bytes, \
99 sizeof(unsigned long)); \
103 tp_locvar->fds_in = lttng_tp_mempool_alloc( \
104 tp_locvar->nr_ulong * sizeof(unsigned long)); \
105 if (!tp_locvar->fds_in) \
108 err = lib_ring_buffer_copy_from_user_check_nofault( \
109 tp_locvar->fds_in, inp, \
110 tp_locvar->nr_ulong * sizeof(unsigned long)); \
115 tp_locvar->fds_out = lttng_tp_mempool_alloc( \
116 tp_locvar->nr_ulong * sizeof(unsigned long)); \
117 if (!tp_locvar->fds_out) \
120 err = lib_ring_buffer_copy_from_user_check_nofault( \
121 tp_locvar->fds_out, outp, \
122 tp_locvar->nr_ulong * sizeof(unsigned long)); \
127 tp_locvar->fds_ex = lttng_tp_mempool_alloc( \
128 tp_locvar->nr_ulong * sizeof(unsigned long)); \
129 if (!tp_locvar->fds_ex) \
132 err = lib_ring_buffer_copy_from_user_check_nofault( \
133 tp_locvar->fds_ex, exp, \
134 tp_locvar->nr_ulong * sizeof(unsigned long)); \
141 tp_locvar->nr_bytes = 0; \
142 tp_locvar->nr_ulong = 0; \
143 end: ; /* Label at end of compound statement. */ \
147 #define LTTNG_SYSCALL_SELECT_fds_field_LE(name, input) \
150 .atype = atype_sequence, \
151 .u.sequence.length_type = __type_integer( \
152 uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none), \
153 .u.sequence.elem_type = __type_integer(uint8_t, 0, 0, 0, \
154 __BYTE_ORDER, 16, none), \
159 unsigned int nr_bytes_out = 0; \
162 ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \
165 ctf_integer_type(uint8_t, 0) \
170 for (src = 0; src < tp_locvar->nr_ulong; src++) { \
172 for (dst = 0; dst < sizeof(long); dst++) { \
173 if (nr_bytes_out++ >= tp_locvar->nr_bytes) { \
176 ctf_user_integer_type(uint8_t, \
177 ((uint8_t __user *) (input->fds_bits + src))[dst]); \
184 #define LTTNG_SYSCALL_SELECT_fds_field_BE(name, input) \
187 .atype = atype_sequence, \
188 .u.sequence.length_type = __type_integer( \
189 uint8_t, 0, 0, 0, __BYTE_ORDER, 10, none), \
190 .u.sequence.elem_type = __type_integer(uint8_t, 0, 0, 0, \
191 __BYTE_ORDER, 16, none), \
195 unsigned int src, nr_bytes_out = 0; \
198 ctf_integer_type(uint8_t, tp_locvar->nr_bytes) \
201 ctf_integer_type(uint8_t, 0) \
206 for (src = 0; src < tp_locvar->nr_ulong; src++) { \
208 for (dst = sizeof(long); dst >= 0; dst--) { \
209 if (nr_bytes_out++ >= tp_locvar->nr_bytes) { \
212 ctf_user_integer_type(uint8_t, \
213 ((uint8_t __user *) (input->fds_bits + src))[dst]); \
220 #define LTTNG_SYSCALL_SELECT_code_post \
221 lttng_tp_mempool_free(tp_locvar->fds_in); \
222 lttng_tp_mempool_free(tp_locvar->fds_out); \
223 lttng_tp_mempool_free(tp_locvar->fds_ex);
225 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM)
226 #define OVERRIDE_32_select
227 #define OVERRIDE_64_select
228 SC_LTTNG_TRACEPOINT_EVENT_CODE(select
,
229 TP_PROTO(sc_exit(long ret
,) int n
, fd_set __user
*inp
, fd_set __user
*outp
,
230 fd_set __user
*exp
, struct timeval
*tvp
),
231 TP_ARGS(sc_exit(ret
,) n
, inp
, outp
, exp
, tvp
),
233 LTTNG_SYSCALL_SELECT_locvar
236 LTTNG_SYSCALL_SELECT_code_pre
239 sc_exit(ctf_integer(long, ret
, ret
))
240 sc_in(ctf_integer(int, n
, n
))
241 sc_inout(ctf_integer(uint8_t, overflow
, tp_locvar
->overflow
))
242 sc_inout(ctf_integer(struct timeval
*, tvp
, tvp
))
245 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
246 LTTNG_SYSCALL_SELECT_fds_field_LE(readfds
, inp
)
247 LTTNG_SYSCALL_SELECT_fds_field_LE(writefds
, outp
)
248 LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds
, exp
)
250 LTTNG_SYSCALL_SELECT_fds_field_BE(readfds
, inp
)
251 LTTNG_SYSCALL_SELECT_fds_field_BE(writefds
, outp
)
252 LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds
, exp
)
257 LTTNG_SYSCALL_SELECT_code_post
260 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */
262 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM)
263 #define OVERRIDE_32_pselect6
264 #define OVERRIDE_64_pselect6
265 SC_LTTNG_TRACEPOINT_EVENT_CODE(pselect6
,
266 TP_PROTO(sc_exit(long ret
,) int n
, fd_set __user
* inp
, fd_set __user
* outp
,
267 fd_set __user
* exp
, struct timeval __user
* tvp
, void __user
* sig
),
268 TP_ARGS(sc_exit(ret
,) n
, inp
, outp
, exp
, tvp
, sig
),
270 LTTNG_SYSCALL_SELECT_locvar
273 LTTNG_SYSCALL_SELECT_code_pre
276 sc_exit(ctf_integer(long, ret
, ret
))
277 sc_in(ctf_integer(int, n
, n
))
278 sc_inout(ctf_integer(uint8_t, overflow
, tp_locvar
->overflow
))
279 sc_inout(ctf_integer(struct timeval
*, tvp
, tvp
))
280 sc_in(ctf_integer_hex(void *, sig
, sig
))
283 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
284 LTTNG_SYSCALL_SELECT_fds_field_LE(readfds
, inp
)
285 LTTNG_SYSCALL_SELECT_fds_field_LE(writefds
, outp
)
286 LTTNG_SYSCALL_SELECT_fds_field_LE(exceptfds
, exp
)
288 LTTNG_SYSCALL_SELECT_fds_field_BE(readfds
, inp
)
289 LTTNG_SYSCALL_SELECT_fds_field_BE(writefds
, outp
)
290 LTTNG_SYSCALL_SELECT_fds_field_BE(exceptfds
, exp
)
295 LTTNG_SYSCALL_SELECT_code_post
298 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */
300 #ifndef ONCE_LTTNG_TRACE_POLL_H
301 #define ONCE_LTTNG_TRACE_POLL_H
303 #define LTTNG_POLL_NRFLAGS (POLLNVAL + 1)
304 #define POLL_FLAGS_PADDING_SIZE (sizeof(uint8_t) * BITS_PER_BYTE) - \
305 ilog2(LTTNG_POLL_NRFLAGS - 1)
308 * Only extract the values specified by iBCS2 for now.
310 static struct lttng_event_field lttng_pollfd_flag_fields
[] = {
313 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
317 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
321 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
325 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
329 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
331 [ilog2(POLLNVAL
)] = {
333 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
335 [ilog2(LTTNG_POLL_NRFLAGS
)] = {
337 .type
= __type_integer(int, POLL_FLAGS_PADDING_SIZE
, 1, 0,
338 __LITTLE_ENDIAN
, 10, none
),
342 static struct lttng_event_field lttng_pollfd_fields
[] = {
345 .type
= __type_integer(int, 0, 0, 0, __BYTE_ORDER
, 10, none
),
348 .name
= "raw_events",
349 .type
= __type_integer(short, 0, 0, 0, __BYTE_ORDER
, 16, none
),
354 .atype
= atype_struct
,
355 .u
._struct
.nr_fields
= ARRAY_SIZE(lttng_pollfd_flag_fields
),
356 .u
._struct
.fields
= lttng_pollfd_flag_fields
,
361 static struct lttng_type lttng_pollfd_elem
= {
362 .atype
= atype_struct
,
363 .u
._struct
.nr_fields
= ARRAY_SIZE(lttng_pollfd_fields
),
364 .u
._struct
.fields
= lttng_pollfd_fields
,
366 #endif /* ONCE_LTTNG_TRACE_POLL_H */
368 #define LTTNG_SYSCALL_POLL_locvar \
369 unsigned int fds_length, fds_max_len, alloc_fds; \
370 struct pollfd *fds; \
373 #define LTTNG_SYSCALL_POLL_code_pre \
374 BUILD_BUG_ON(((ARRAY_SIZE(lttng_pollfd_flag_fields) - 1) + \
375 POLL_FLAGS_PADDING_SIZE) != \
376 sizeof(uint8_t) * BITS_PER_BYTE); \
377 tp_locvar->fds = NULL; \
378 tp_locvar->overflow = 0; \
381 if (nfds > PAGE_SIZE / sizeof(struct pollfd)) { \
382 tp_locvar->fds_length = PAGE_SIZE / sizeof(struct pollfd); \
383 tp_locvar->fds_max_len = PAGE_SIZE / sizeof(struct pollfd); \
384 tp_locvar->overflow = 1; \
386 tp_locvar->fds_length = nfds; \
387 tp_locvar->fds_max_len = nfds; \
389 tp_locvar->alloc_fds = tp_locvar->fds_length * sizeof(struct pollfd); \
392 * On exit, the number of active FDs is determined by ret, \
393 * nfds stays the same as the entry, but we only want to \
394 * output the FDs that are relevant. \
397 if (ret <= 0 || ret > nfds) \
400 if (nfds > PAGE_SIZE / sizeof(struct pollfd)) { \
401 tp_locvar->fds_length = PAGE_SIZE / sizeof(struct pollfd); \
402 tp_locvar->fds_max_len = PAGE_SIZE / sizeof(struct pollfd); \
403 tp_locvar->overflow = 1; \
405 tp_locvar->fds_length = ret; \
406 tp_locvar->fds_max_len = nfds; \
408 tp_locvar->alloc_fds = tp_locvar->fds_max_len * sizeof(struct pollfd); \
413 tp_locvar->fds = lttng_tp_mempool_alloc(tp_locvar->alloc_fds); \
414 if (!tp_locvar->fds) \
416 err = lib_ring_buffer_copy_from_user_check_nofault( \
417 tp_locvar->fds, ufds, tp_locvar->alloc_fds); \
424 tp_locvar->fds_length = 0; \
425 tp_locvar->fds_max_len = 0; \
429 #define LTTNG_SYSCALL_POLL_fds_field \
433 .atype = atype_sequence_compound, \
434 .u.sequence_compound.length_name = "fds_length", \
435 .u.sequence_compound.elem_type = <tng_pollfd_elem, \
441 ctf_align(int) /* Align on largest field in struct. */ \
442 for (i = 0; i < tp_locvar->fds_length; i++) { \
443 ctf_integer_type(int, tp_locvar->fds[i].fd) \
444 ctf_integer_type(short, tp_locvar->fds[i].events) \
445 ctf_integer_bitfield_type(uint8_t, \
446 (uint8_t) tp_locvar->fds[i].events) \
454 .atype = atype_sequence_compound, \
455 .u.sequence_compound.length_name = "fds_length", \
456 .u.sequence_compound.elem_type = <tng_pollfd_elem, \
460 unsigned int i, nr = 0; \
462 ctf_align(int) /* Align on largest field in struct. */ \
464 * Iterate over the complete array, but only output \
465 * "ret" active FDs. \
467 for (i = 0; i < tp_locvar->fds_max_len; i++) { \
468 if (!tp_locvar->fds[i].revents) \
470 if (nr++ >= tp_locvar->fds_length) \
472 ctf_integer_type(int, tp_locvar->fds[i].fd) \
473 ctf_integer_type(short, tp_locvar->fds[i].revents) \
474 ctf_integer_bitfield_type(uint8_t, \
475 (uint8_t) tp_locvar->fds[i].revents) \
478 * If there is a discrepancy between ret and the \
479 * content of revents (e.g. caused by userspace corrupting \
480 * the array from a concurrent thread), we have to output \
481 * zeros to keep the trace readable. \
483 for (i = nr; i < tp_locvar->fds_length; i++) { \
484 ctf_integer_type(int, 0) \
485 ctf_integer_type(short, 0) \
486 ctf_integer_bitfield_type(uint8_t, 0) \
492 #define LTTNG_SYSCALL_POLL_code_post \
493 lttng_tp_mempool_free(tp_locvar->fds);
495 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM)
496 #define OVERRIDE_32_poll
497 #define OVERRIDE_64_poll
498 SC_LTTNG_TRACEPOINT_EVENT_CODE(poll
,
499 TP_PROTO(sc_exit(long ret
,) struct pollfd __user
* ufds
,
500 unsigned int nfds
, int timeout_msecs
),
501 TP_ARGS(sc_exit(ret
,) ufds
, nfds
, timeout_msecs
),
503 LTTNG_SYSCALL_POLL_locvar
506 LTTNG_SYSCALL_POLL_code_pre
509 sc_exit(ctf_integer(long, ret
, ret
))
510 sc_in(ctf_integer(int, timeout_msecs
, timeout_msecs
))
511 sc_inout(ctf_integer(unsigned int, nfds
, nfds
))
512 sc_inout(ctf_integer(unsigned int, fds_length
, tp_locvar
->fds_length
))
513 sc_in(ctf_integer(uint8_t, overflow
, tp_locvar
->overflow
))
514 LTTNG_SYSCALL_POLL_fds_field
517 LTTNG_SYSCALL_POLL_code_post
520 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */
522 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM)
523 #define OVERRIDE_32_ppoll
524 #define OVERRIDE_64_ppoll
525 SC_LTTNG_TRACEPOINT_EVENT_CODE(ppoll
,
526 TP_PROTO(sc_exit(long ret
,) struct pollfd __user
* ufds
,
527 unsigned int nfds
, struct timespec
* tsp
, const sigset_t
* sigmask
, size_t sigsetsize
),
528 TP_ARGS(sc_exit(ret
,) ufds
, nfds
, tsp
, sigmask
, sigsetsize
),
530 LTTNG_SYSCALL_POLL_locvar
533 LTTNG_SYSCALL_POLL_code_pre
536 sc_exit(ctf_integer(long, ret
, ret
))
537 sc_in(ctf_integer(struct timespec
*, tsp
, tsp
))
538 sc_in(ctf_integer(const sigset_t
*, sigmask
, sigmask
))
539 sc_in(ctf_integer(size_t, sigsetsize
, sigsetsize
))
540 sc_inout(ctf_integer(unsigned int, nfds
, nfds
))
541 sc_inout(ctf_integer(unsigned int, fds_length
, tp_locvar
->fds_length
))
542 sc_inout(ctf_integer(uint8_t, overflow
, tp_locvar
->overflow
))
543 LTTNG_SYSCALL_POLL_fds_field
546 LTTNG_SYSCALL_POLL_code_post
549 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */
551 #include <linux/eventpoll.h>
553 SC_LTTNG_TRACEPOINT_ENUM(lttng_epoll_op
,
555 ctf_enum_value("EPOLL_CTL_ADD", EPOLL_CTL_ADD
)
556 ctf_enum_value("EPOLL_CTL_DEL", EPOLL_CTL_DEL
)
557 ctf_enum_value("EPOLL_CTL_MOD", EPOLL_CTL_MOD
)
561 #ifndef ONCE_LTTNG_TRACE_EPOLL_CTL_H
562 #define ONCE_LTTNG_TRACE_EPOLL_CTL_H
564 #define LTTNG_EPOLL_NRFLAGS (POLLHUP + 1)
565 #define EPOLL_FLAGS_PADDING_SIZE (sizeof(uint8_t) * BITS_PER_BYTE) - \
566 ilog2(LTTNG_EPOLL_NRFLAGS - 1)
569 * Only extract the values specified by iBCS2 for now.
571 static struct lttng_event_field lttng_epoll_ctl_events_fields
[] = {
575 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
580 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
585 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
590 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
595 .type
= __type_integer(int, 1, 1, 0, __LITTLE_ENDIAN
, 10, none
),
597 [ilog2(LTTNG_EPOLL_NRFLAGS
)] = {
599 .type
= __type_integer(int, EPOLL_FLAGS_PADDING_SIZE
, 1, 0,
600 __LITTLE_ENDIAN
, 10, none
),
605 static struct lttng_event_field lttng_epoll_data_fields
[] = {
608 .type
= __type_integer(uint64_t, 0, 0, 0, __BYTE_ORDER
, 16, none
),
612 .type
= __type_integer(int, 0, 0, 0, __BYTE_ORDER
, 10, none
),
616 static struct lttng_event_field epoll_ctl_fields
[] = {
618 .name
= "data_union",
620 .atype
= atype_struct
,
621 .u
._struct
.nr_fields
= ARRAY_SIZE(lttng_epoll_data_fields
),
622 .u
._struct
.fields
= lttng_epoll_data_fields
,
626 .name
= "raw_events",
627 .type
= __type_integer(uint32_t, 0, 0, 0, __BYTE_ORDER
, 16, none
),
632 .atype
= atype_struct
,
633 .u
._struct
.nr_fields
= ARRAY_SIZE(lttng_epoll_ctl_events_fields
),
634 .u
._struct
.fields
= lttng_epoll_ctl_events_fields
,
638 #endif /* ONCE_LTTNG_TRACE_EPOLL_CTL_H */
640 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM)
641 #define OVERRIDE_32_epoll_ctl
642 #define OVERRIDE_64_epoll_ctl
643 SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_ctl
,
644 TP_PROTO(sc_exit(long ret
,) int epfd
, int op
, int fd
,
645 struct epoll_event __user
* uevent
),
646 TP_ARGS(sc_exit(ret
,) epfd
, op
, fd
, uevent
),
648 struct epoll_event event
;
652 tp_locvar
->err
= lib_ring_buffer_copy_from_user_check_nofault(
653 &tp_locvar
->event
, uevent
, sizeof(struct epoll_event
));
656 sc_exit(ctf_integer(long, ret
, ret
))
657 sc_in(ctf_integer(int, epfd
, epfd
))
658 sc_in(ctf_enum(lttng_epoll_op
, int, op_enum
, op
))
659 sc_in(ctf_integer(int, fd
, fd
))
663 .atype
= atype_struct
,
664 .u
._struct
.nr_fields
= ARRAY_SIZE(epoll_ctl_fields
),
665 .u
._struct
.fields
= epoll_ctl_fields
,
670 if (!tp_locvar
->err
) {
671 ctf_integer_type(uint64_t, tp_locvar
->event
.data
)
672 ctf_integer_type(int, tp_locvar
->event
.data
)
673 ctf_integer_bitfield_type(uint32_t,
674 tp_locvar
->event
.events
)
675 ctf_integer_bitfield_type(uint8_t,
676 (uint8_t) tp_locvar
->event
.events
)
678 ctf_integer_type(uint64_t, 0)
679 ctf_integer_type(int, 0)
680 ctf_integer_bitfield_type(uint32_t, 0)
681 ctf_integer_bitfield_type(uint8_t, 0)
689 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */
691 #ifndef ONCE_LTTNG_TRACE_EPOLL_H
692 #define ONCE_LTTNG_TRACE_EPOLL_H
694 static struct lttng_event_field lttng_epoll_wait_fields
[] = {
696 .name
= "data_union",
698 .atype
= atype_struct
,
699 .u
._struct
.nr_fields
= ARRAY_SIZE(lttng_epoll_data_fields
),
700 .u
._struct
.fields
= lttng_epoll_data_fields
,
704 .name
= "raw_events",
705 .type
= __type_integer(uint32_t, 0, 0, 0, __BYTE_ORDER
, 16, none
),
710 .atype
= atype_struct
,
711 .u
._struct
.nr_fields
= ARRAY_SIZE(lttng_epoll_ctl_events_fields
),
712 .u
._struct
.fields
= lttng_epoll_ctl_events_fields
,
717 static struct lttng_type lttng_epoll_wait_elem
= {
718 .atype
= atype_struct
,
719 .u
._struct
.nr_fields
= ARRAY_SIZE(lttng_epoll_wait_fields
),
720 .u
._struct
.fields
= lttng_epoll_wait_fields
,
723 #endif /* ONCE_LTTNG_TRACE_EPOLL_H */
725 #define LTTNG_SYSCALL_EPOLL_WAIT_locvar \
727 unsigned int fds_length; \
729 struct epoll_event *events; \
732 #define LTTNG_SYSCALL_EPOLL_WAIT_code_pre \
733 BUILD_BUG_ON(((ARRAY_SIZE(lttng_epoll_ctl_events_fields) - 1) + \
734 EPOLL_FLAGS_PADDING_SIZE) != \
735 sizeof(uint8_t) * BITS_PER_BYTE); \
738 unsigned long maxalloc; \
740 tp_locvar->fds_length = 0; \
741 tp_locvar->events = NULL; \
742 tp_locvar->overflow = 0; \
744 if (maxevents <= 0 || ret <= 0 || ret > maxevents) \
747 if (maxevents > PAGE_SIZE / sizeof(struct epoll_event)) { \
748 maxalloc = PAGE_SIZE / sizeof(struct epoll_event); \
750 maxalloc = maxevents; \
753 if (ret > maxalloc) { \
754 tp_locvar->fds_length = maxalloc; \
755 tp_locvar->overflow = 1; \
757 tp_locvar->fds_length = ret; \
760 tp_locvar->events = lttng_tp_mempool_alloc( \
761 maxalloc * sizeof(struct epoll_event)); \
762 if (!tp_locvar->events) { \
763 tp_locvar->fds_length = 0; \
767 err = lib_ring_buffer_copy_from_user_check_nofault( \
768 tp_locvar->events, uevents, \
769 maxalloc * sizeof(struct epoll_event)); \
771 tp_locvar->fds_length = 0; \
776 #define LTTNG_SYSCALL_EPOLL_WAIT_fds_field \
779 .atype = atype_sequence_compound, \
780 .u.sequence_compound.length_name = \
782 .u.sequence_compound.elem_type = \
783 <tng_epoll_wait_elem, \
789 ctf_align(uint64_t) \
790 for (i = 0; i < tp_locvar->fds_length; i++) { \
791 ctf_integer_type(uint64_t, tp_locvar->events[i].data) \
792 ctf_integer_type(int, tp_locvar->events[i].data) \
793 ctf_integer_bitfield_type(uint32_t, \
794 tp_locvar->events[i].events) \
795 ctf_integer_bitfield_type(uint8_t, \
796 (uint8_t) tp_locvar->events[i].events) \
801 #define LTTNG_SYSCALL_EPOLL_WAIT_code_post \
803 lttng_tp_mempool_free(tp_locvar->events); \
807 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM)
808 #define OVERRIDE_32_epoll_wait
809 #define OVERRIDE_64_epoll_wait
810 SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_wait
,
811 TP_PROTO(sc_exit(long ret
,) int epfd
, struct epoll_event __user
* uevents
,
812 int maxevents
, int timeout
),
813 TP_ARGS(sc_exit(ret
,) epfd
, uevents
, maxevents
, timeout
),
815 LTTNG_SYSCALL_EPOLL_WAIT_locvar
818 LTTNG_SYSCALL_EPOLL_WAIT_code_pre
821 sc_exit(ctf_integer(long, ret
, ret
))
822 sc_in(ctf_integer(int, epfd
, epfd
))
823 sc_in(ctf_integer(int, maxevents
, maxevents
))
824 sc_in(ctf_integer(int, timeout
, timeout
))
825 sc_out(ctf_integer(unsigned int, fds_length
, tp_locvar
->fds_length
))
826 sc_out(ctf_integer(uint8_t, overflow
, tp_locvar
->overflow
))
828 LTTNG_SYSCALL_EPOLL_WAIT_fds_field
832 LTTNG_SYSCALL_EPOLL_WAIT_code_post
835 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM) */
837 #if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM)
838 #define OVERRIDE_32_epoll_pwait
839 #define OVERRIDE_64_epoll_pwait
840 SC_LTTNG_TRACEPOINT_EVENT_CODE(epoll_pwait
,
841 TP_PROTO(sc_exit(long ret
,) int epfd
, struct epoll_event __user
* uevents
,
842 int maxevents
, int timeout
, const sigset_t __user
* sigmask
, size_t sigsetsize
),
843 TP_ARGS(sc_exit(ret
,) epfd
, uevents
, maxevents
, timeout
, sigmask
, sigsetsize
),
845 LTTNG_SYSCALL_EPOLL_WAIT_locvar
848 LTTNG_SYSCALL_EPOLL_WAIT_code_pre
851 sc_exit(ctf_integer(long, ret
, ret
))
852 sc_in(ctf_integer(int, epfd
, epfd
))
853 sc_in(ctf_integer(int, maxevents
, maxevents
))
854 sc_in(ctf_integer(int, timeout
, timeout
))
855 sc_in(ctf_integer_hex(const sigset_t
*, sigmask
, sigmask
))
856 sc_in(ctf_integer(size_t, sigsetsize
, sigsetsize
))
857 sc_out(ctf_integer(unsigned int, fds_length
, tp_locvar
->fds_length
))
858 sc_out(ctf_integer(uint8_t, overflow
, tp_locvar
->overflow
))
860 LTTNG_SYSCALL_EPOLL_WAIT_fds_field
864 LTTNG_SYSCALL_EPOLL_WAIT_code_post
867 #endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */
869 #if (defined(CONFIG_X86_64) && !defined(LTTNG_SC_COMPAT)) || defined(CONFIG_ARM64) || defined(CONFIG_ARM)
870 #define OVERRIDE_32_socketpair
871 #define OVERRIDE_64_socketpair
872 SC_LTTNG_TRACEPOINT_EVENT(socketpair
,
873 TP_PROTO(sc_exit(long ret
,) int family
, int type
, int protocol
, int *usockvec
),
874 TP_ARGS(sc_exit(ret
,) family
, type
, protocol
, usockvec
),
876 sc_exit(ctf_integer(long, ret
, ret
))
877 sc_in(ctf_integer(int, family
, family
))
878 sc_in(ctf_integer(int, type
, type
))
879 sc_in(ctf_integer(int, protocol
, protocol
))
880 sc_out(ctf_user_array(int, socket
, usockvec
, 2))
883 #endif /* (defined(CONFIG_X86_64) && !defined(LTTNG_SC_COMPAT)) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */
885 #endif /* CREATE_SYSCALL_TABLE */