#include <linux/tracepoint.h>
#include <linux/syscalls.h>
+DECLARE_EVENT_CLASS_NOARGS(syscalls_noargs,
+ TP_STRUCT__entry(),
+ TP_fast_assign(),
+ TP_printk()
+)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_sched_yield)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_pause)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_getpid)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_getuid)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_getgid)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_geteuid)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_getegid)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_getppid)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_getpgrp)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_setsid)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_munlockall)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_vhangup)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_sync)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_gettid)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_restart_syscall)
+DEFINE_EVENT_NOARGS(syscalls_noargs, sys_inotify_init)
TRACE_EVENT(sys_close,
TP_PROTO(unsigned int fd),
TP_ARGS(fd),
#else /* CREATE_SYSCALL_TABLE */
-TRACE_SYSCALL_TABLE(sys_close, 3, 1)
-TRACE_SYSCALL_TABLE(sys_brk, 12, 1)
-TRACE_SYSCALL_TABLE(sys_dup, 32, 1)
-TRACE_SYSCALL_TABLE(sys_alarm, 37, 1)
-TRACE_SYSCALL_TABLE(sys_exit, 60, 1)
-TRACE_SYSCALL_TABLE(sys_fsync, 74, 1)
-TRACE_SYSCALL_TABLE(sys_fdatasync, 75, 1)
-TRACE_SYSCALL_TABLE(sys_fchdir, 81, 1)
-TRACE_SYSCALL_TABLE(sys_umask, 95, 1)
-TRACE_SYSCALL_TABLE(sys_setuid, 105, 1)
-TRACE_SYSCALL_TABLE(sys_setgid, 106, 1)
-TRACE_SYSCALL_TABLE(sys_getpgid, 121, 1)
-TRACE_SYSCALL_TABLE(sys_setfsuid, 122, 1)
-TRACE_SYSCALL_TABLE(sys_setfsgid, 123, 1)
-TRACE_SYSCALL_TABLE(sys_getsid, 124, 1)
-TRACE_SYSCALL_TABLE(sys_personality, 135, 1)
-TRACE_SYSCALL_TABLE(sys_sched_getscheduler, 145, 1)
-TRACE_SYSCALL_TABLE(sys_sched_get_priority_max, 146, 1)
-TRACE_SYSCALL_TABLE(sys_sched_get_priority_min, 147, 1)
-TRACE_SYSCALL_TABLE(sys_mlockall, 151, 1)
-TRACE_SYSCALL_TABLE(sys_io_destroy, 207, 1)
-TRACE_SYSCALL_TABLE(sys_epoll_create, 213, 1)
-TRACE_SYSCALL_TABLE(sys_timer_getoverrun, 225, 1)
-TRACE_SYSCALL_TABLE(sys_timer_delete, 226, 1)
-TRACE_SYSCALL_TABLE(sys_exit_group, 231, 1)
-TRACE_SYSCALL_TABLE(sys_unshare, 272, 1)
-TRACE_SYSCALL_TABLE(sys_eventfd, 284, 1)
-TRACE_SYSCALL_TABLE(sys_epoll_create1, 291, 1)
-TRACE_SYSCALL_TABLE(sys_inotify_init1, 294, 1)
-TRACE_SYSCALL_TABLE(sys_syncfs, 306, 1)
-TRACE_SYSCALL_TABLE(sys_munmap, 11, 2)
-TRACE_SYSCALL_TABLE(sys_dup2, 33, 2)
-TRACE_SYSCALL_TABLE(sys_shutdown, 48, 2)
-TRACE_SYSCALL_TABLE(sys_listen, 50, 2)
-TRACE_SYSCALL_TABLE(sys_kill, 62, 2)
-TRACE_SYSCALL_TABLE(sys_msgget, 68, 2)
-TRACE_SYSCALL_TABLE(sys_flock, 73, 2)
-TRACE_SYSCALL_TABLE(sys_ftruncate, 77, 2)
-TRACE_SYSCALL_TABLE(sys_fchmod, 91, 2)
-TRACE_SYSCALL_TABLE(sys_setpgid, 109, 2)
-TRACE_SYSCALL_TABLE(sys_setreuid, 113, 2)
-TRACE_SYSCALL_TABLE(sys_setregid, 114, 2)
-TRACE_SYSCALL_TABLE(sys_getpriority, 140, 2)
-TRACE_SYSCALL_TABLE(sys_mlock, 149, 2)
-TRACE_SYSCALL_TABLE(sys_munlock, 150, 2)
-TRACE_SYSCALL_TABLE(sys_tkill, 200, 2)
-TRACE_SYSCALL_TABLE(sys_ioprio_get, 252, 2)
-TRACE_SYSCALL_TABLE(sys_inotify_rm_watch, 255, 2)
-TRACE_SYSCALL_TABLE(sys_timerfd_create, 283, 2)
-TRACE_SYSCALL_TABLE(sys_eventfd2, 290, 2)
-TRACE_SYSCALL_TABLE(sys_setns, 308, 2)
-TRACE_SYSCALL_TABLE(sys_lseek, 8, 3)
-TRACE_SYSCALL_TABLE(sys_mprotect, 10, 3)
-TRACE_SYSCALL_TABLE(sys_ioctl, 16, 3)
-TRACE_SYSCALL_TABLE(sys_msync, 26, 3)
-TRACE_SYSCALL_TABLE(sys_madvise, 28, 3)
-TRACE_SYSCALL_TABLE(sys_shmget, 29, 3)
-TRACE_SYSCALL_TABLE(sys_socket, 41, 3)
-TRACE_SYSCALL_TABLE(sys_semget, 64, 3)
-TRACE_SYSCALL_TABLE(sys_fcntl, 72, 3)
-TRACE_SYSCALL_TABLE(sys_fchown, 93, 3)
-TRACE_SYSCALL_TABLE(sys_setresuid, 117, 3)
-TRACE_SYSCALL_TABLE(sys_setresgid, 119, 3)
-TRACE_SYSCALL_TABLE(sys_sysfs, 139, 3)
-TRACE_SYSCALL_TABLE(sys_setpriority, 141, 3)
-TRACE_SYSCALL_TABLE(sys_tgkill, 234, 3)
-TRACE_SYSCALL_TABLE(sys_ioprio_set, 251, 3)
-TRACE_SYSCALL_TABLE(sys_dup3, 292, 3)
-TRACE_SYSCALL_TABLE(sys_ptrace, 101, 4)
-TRACE_SYSCALL_TABLE(sys_tee, 276, 4)
-TRACE_SYSCALL_TABLE(sys_mremap, 25, 5)
-TRACE_SYSCALL_TABLE(sys_prctl, 157, 5)
-TRACE_SYSCALL_TABLE(sys_remap_file_pages, 216, 5)
-TRACE_SYSCALL_TABLE(sys_mmap, 9, 6)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_sched_yield, 24, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_pause, 34, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_getpid, 39, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_getuid, 102, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_getgid, 104, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_geteuid, 107, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_getegid, 108, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_getppid, 110, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_getpgrp, 111, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_setsid, 112, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_munlockall, 152, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_vhangup, 153, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_sync, 162, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_gettid, 186, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_restart_syscall, 219, 0)
+TRACE_SYSCALL_TABLE(syscalls_noargs, sys_inotify_init, 253, 0)
+TRACE_SYSCALL_TABLE(sys_close, sys_close, 3, 1)
+TRACE_SYSCALL_TABLE(sys_lseek, sys_lseek, 8, 3)
+TRACE_SYSCALL_TABLE(sys_mmap, sys_mmap, 9, 6)
+TRACE_SYSCALL_TABLE(sys_mprotect, sys_mprotect, 10, 3)
+TRACE_SYSCALL_TABLE(sys_munmap, sys_munmap, 11, 2)
+TRACE_SYSCALL_TABLE(sys_brk, sys_brk, 12, 1)
+TRACE_SYSCALL_TABLE(sys_ioctl, sys_ioctl, 16, 3)
+TRACE_SYSCALL_TABLE(sys_mremap, sys_mremap, 25, 5)
+TRACE_SYSCALL_TABLE(sys_msync, sys_msync, 26, 3)
+TRACE_SYSCALL_TABLE(sys_madvise, sys_madvise, 28, 3)
+TRACE_SYSCALL_TABLE(sys_shmget, sys_shmget, 29, 3)
+TRACE_SYSCALL_TABLE(sys_dup, sys_dup, 32, 1)
+TRACE_SYSCALL_TABLE(sys_dup2, sys_dup2, 33, 2)
+TRACE_SYSCALL_TABLE(sys_alarm, sys_alarm, 37, 1)
+TRACE_SYSCALL_TABLE(sys_socket, sys_socket, 41, 3)
+TRACE_SYSCALL_TABLE(sys_shutdown, sys_shutdown, 48, 2)
+TRACE_SYSCALL_TABLE(sys_listen, sys_listen, 50, 2)
+TRACE_SYSCALL_TABLE(sys_exit, sys_exit, 60, 1)
+TRACE_SYSCALL_TABLE(sys_kill, sys_kill, 62, 2)
+TRACE_SYSCALL_TABLE(sys_semget, sys_semget, 64, 3)
+TRACE_SYSCALL_TABLE(sys_msgget, sys_msgget, 68, 2)
+TRACE_SYSCALL_TABLE(sys_fcntl, sys_fcntl, 72, 3)
+TRACE_SYSCALL_TABLE(sys_flock, sys_flock, 73, 2)
+TRACE_SYSCALL_TABLE(sys_fsync, sys_fsync, 74, 1)
+TRACE_SYSCALL_TABLE(sys_fdatasync, sys_fdatasync, 75, 1)
+TRACE_SYSCALL_TABLE(sys_ftruncate, sys_ftruncate, 77, 2)
+TRACE_SYSCALL_TABLE(sys_fchdir, sys_fchdir, 81, 1)
+TRACE_SYSCALL_TABLE(sys_fchmod, sys_fchmod, 91, 2)
+TRACE_SYSCALL_TABLE(sys_fchown, sys_fchown, 93, 3)
+TRACE_SYSCALL_TABLE(sys_umask, sys_umask, 95, 1)
+TRACE_SYSCALL_TABLE(sys_ptrace, sys_ptrace, 101, 4)
+TRACE_SYSCALL_TABLE(sys_setuid, sys_setuid, 105, 1)
+TRACE_SYSCALL_TABLE(sys_setgid, sys_setgid, 106, 1)
+TRACE_SYSCALL_TABLE(sys_setpgid, sys_setpgid, 109, 2)
+TRACE_SYSCALL_TABLE(sys_setreuid, sys_setreuid, 113, 2)
+TRACE_SYSCALL_TABLE(sys_setregid, sys_setregid, 114, 2)
+TRACE_SYSCALL_TABLE(sys_setresuid, sys_setresuid, 117, 3)
+TRACE_SYSCALL_TABLE(sys_setresgid, sys_setresgid, 119, 3)
+TRACE_SYSCALL_TABLE(sys_getpgid, sys_getpgid, 121, 1)
+TRACE_SYSCALL_TABLE(sys_setfsuid, sys_setfsuid, 122, 1)
+TRACE_SYSCALL_TABLE(sys_setfsgid, sys_setfsgid, 123, 1)
+TRACE_SYSCALL_TABLE(sys_getsid, sys_getsid, 124, 1)
+TRACE_SYSCALL_TABLE(sys_personality, sys_personality, 135, 1)
+TRACE_SYSCALL_TABLE(sys_sysfs, sys_sysfs, 139, 3)
+TRACE_SYSCALL_TABLE(sys_getpriority, sys_getpriority, 140, 2)
+TRACE_SYSCALL_TABLE(sys_setpriority, sys_setpriority, 141, 3)
+TRACE_SYSCALL_TABLE(sys_sched_getscheduler, sys_sched_getscheduler, 145, 1)
+TRACE_SYSCALL_TABLE(sys_sched_get_priority_max, sys_sched_get_priority_max, 146, 1)
+TRACE_SYSCALL_TABLE(sys_sched_get_priority_min, sys_sched_get_priority_min, 147, 1)
+TRACE_SYSCALL_TABLE(sys_mlock, sys_mlock, 149, 2)
+TRACE_SYSCALL_TABLE(sys_munlock, sys_munlock, 150, 2)
+TRACE_SYSCALL_TABLE(sys_mlockall, sys_mlockall, 151, 1)
+TRACE_SYSCALL_TABLE(sys_prctl, sys_prctl, 157, 5)
+TRACE_SYSCALL_TABLE(sys_tkill, sys_tkill, 200, 2)
+TRACE_SYSCALL_TABLE(sys_io_destroy, sys_io_destroy, 207, 1)
+TRACE_SYSCALL_TABLE(sys_epoll_create, sys_epoll_create, 213, 1)
+TRACE_SYSCALL_TABLE(sys_remap_file_pages, sys_remap_file_pages, 216, 5)
+TRACE_SYSCALL_TABLE(sys_timer_getoverrun, sys_timer_getoverrun, 225, 1)
+TRACE_SYSCALL_TABLE(sys_timer_delete, sys_timer_delete, 226, 1)
+TRACE_SYSCALL_TABLE(sys_exit_group, sys_exit_group, 231, 1)
+TRACE_SYSCALL_TABLE(sys_tgkill, sys_tgkill, 234, 3)
+TRACE_SYSCALL_TABLE(sys_ioprio_set, sys_ioprio_set, 251, 3)
+TRACE_SYSCALL_TABLE(sys_ioprio_get, sys_ioprio_get, 252, 2)
+TRACE_SYSCALL_TABLE(sys_inotify_rm_watch, sys_inotify_rm_watch, 255, 2)
+TRACE_SYSCALL_TABLE(sys_unshare, sys_unshare, 272, 1)
+TRACE_SYSCALL_TABLE(sys_tee, sys_tee, 276, 4)
+TRACE_SYSCALL_TABLE(sys_timerfd_create, sys_timerfd_create, 283, 2)
+TRACE_SYSCALL_TABLE(sys_eventfd, sys_eventfd, 284, 1)
+TRACE_SYSCALL_TABLE(sys_eventfd2, sys_eventfd2, 290, 2)
+TRACE_SYSCALL_TABLE(sys_epoll_create1, sys_epoll_create1, 291, 1)
+TRACE_SYSCALL_TABLE(sys_dup3, sys_dup3, 292, 3)
+TRACE_SYSCALL_TABLE(sys_inotify_init1, sys_inotify_init1, 294, 1)
+TRACE_SYSCALL_TABLE(sys_syncfs, sys_syncfs, 306, 1)
+TRACE_SYSCALL_TABLE(sys_setns, sys_setns, 308, 2)
#endif /* CREATE_SYSCALL_TABLE */
PARAMS(print)) \
DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args))
+#undef TRACE_EVENT_NOARGS
+#define TRACE_EVENT_NOARGS(name, tstruct, assign, print) \
+ DECLARE_EVENT_CLASS_NOARGS(name, \
+ PARAMS(tstruct), \
+ PARAMS(assign), \
+ PARAMS(print)) \
+ DEFINE_EVENT_NOARGS(name, name)
+
+
#undef DEFINE_EVENT_PRINT
#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
#define DEFINE_EVENT(_template, _name, _proto, _args) \
void trace_##_name(_proto);
+#undef DEFINE_EVENT_NOARGS
+#define DEFINE_EVENT_NOARGS(_template, _name) \
+void trace_##_name(void *__data);
+
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
/*
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args /* Only one used in this phase */
-#undef DECLARE_EVENT_CLASS
-#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
+#undef DECLARE_EVENT_CLASS_NOARGS
+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
static const struct lttng_event_field __event_fields___##_name[] = { \
_tstruct \
};
+#undef DECLARE_EVENT_CLASS
+#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
+ DECLARE_EVENT_CLASS_NOARGS(_name, PARAMS(_tstruct), PARAMS(_assign), \
+ PARAMS(_print))
+
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
#undef __type_integer
#define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \
static void __event_probe__##_name(void *__data, _proto);
+#undef DECLARE_EVENT_CLASS_NOARGS
+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
+static void __event_probe__##_name(void *__data);
+
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
/*
- * Stage 4 of the trace events.
+ * Stage 3.9 of the trace events.
*
- * Create an array of events.
+ * Create event descriptions.
*/
/* Named field types must be defined in lttng-types.h */
#define TP_PROBE_CB(_template) &__event_probe__##_template
#endif
+#undef DEFINE_EVENT_NOARGS
+#define DEFINE_EVENT_NOARGS(_template, _name) \
+static const struct lttng_event_desc __event_desc___##_name = { \
+ .fields = __event_fields___##_template, \
+ .name = #_name, \
+ .probe_callback = (void *) TP_PROBE_CB(_template), \
+ .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
+ .owner = THIS_MODULE, \
+};
+
+#undef DEFINE_EVENT
+#define DEFINE_EVENT(_template, _name, _proto, _args) \
+ DEFINE_EVENT_NOARGS(_template, _name)
+
+#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
+
+
+/*
+ * Stage 4 of the trace events.
+ *
+ * Create an array of event description pointers.
+ */
+
+/* Named field types must be defined in lttng-types.h */
+
+#include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */
+
+#undef DEFINE_EVENT_NOARGS
+#define DEFINE_EVENT_NOARGS(_template, _name) \
+ &__event_desc___##_name,
+
#undef DEFINE_EVENT
#define DEFINE_EVENT(_template, _name, _proto, _args) \
- { \
- .fields = __event_fields___##_template, \
- .name = #_name, \
- .probe_callback = (void *) TP_PROBE_CB(_template), \
- .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
- .owner = THIS_MODULE, \
- },
+ DEFINE_EVENT_NOARGS(_template, _name)
#define TP_ID1(_token, _system) _token##_system
#define TP_ID(_token, _system) TP_ID1(_token, _system)
-static const struct lttng_event_desc TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
+static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
};
_assign \
}
+#undef DECLARE_EVENT_CLASS_NOARGS
+#define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \
+static void __event_probe__##_name(void *__data) \
+{ \
+ struct ltt_event *__event = __data; \
+ struct ltt_channel *__chan = __event->chan; \
+ struct lib_ring_buffer_ctx __ctx; \
+ size_t __event_len, __event_align; \
+ int __ret; \
+ \
+ if (unlikely(!ACCESS_ONCE(__chan->session->active))) \
+ return; \
+ if (unlikely(!ACCESS_ONCE(__chan->enabled))) \
+ return; \
+ if (unlikely(!ACCESS_ONCE(__event->enabled))) \
+ return; \
+ __event_len = 0; \
+ __event_align = 1; \
+ lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
+ __event_align, -1); \
+ __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
+ if (__ret < 0) \
+ return; \
+ /* Control code (field ordering) */ \
+ _tstruct \
+ __chan->ops->event_commit(&__ctx); \
+ return; \
+ /* Copy code, steered by control code */ \
+ _assign \
+}
+
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
/*