From: Jonathan Rajotte Date: Mon, 23 Mar 2020 21:03:37 +0000 (-0400) Subject: kernel: event notifier: kernel-ctl interface X-Git-Tag: v2.13.0-rc1~370 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=cfb1c9bcab7801380b6ffbab9e505b861072254c;p=lttng-tools.git kernel: event notifier: kernel-ctl interface Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Idd3983c594ffecff0a20b71b7cd3d297e77446a1 Depends-on: lttng-ust: I5a800fc92e588c2a6a0e26282b0ad5f31c044479 --- diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index 4470e7717..f7b92f045 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -418,6 +418,25 @@ int kernctl_stop_session(int fd) LTTNG_KERNEL_SESSION_STOP); } +int kernctl_create_event_notifier_group(int fd) +{ + return LTTNG_IOCTL_NO_CHECK(fd, + LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_CREATE); +} + +int kernctl_create_event_notifier_group_notification_fd(int group_fd) +{ + return LTTNG_IOCTL_NO_CHECK(group_fd, + LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD); +} + +int kernctl_create_event_notifier(int group_fd, + const struct lttng_kernel_event_notifier *event_notifier) +{ + return LTTNG_IOCTL_NO_CHECK(group_fd, + LTTNG_KERNEL_EVENT_NOTIFIER_CREATE, event_notifier); +} + int kernctl_filter(int fd, struct lttng_filter_bytecode *filter) { struct lttng_kernel_filter_bytecode *kb; diff --git a/src/common/kernel-ctl/kernel-ctl.h b/src/common/kernel-ctl/kernel-ctl.h index 49925ea6c..b73a1d68e 100644 --- a/src/common/kernel-ctl/kernel-ctl.h +++ b/src/common/kernel-ctl/kernel-ctl.h @@ -28,7 +28,14 @@ int kernctl_disable(int fd); int kernctl_start_session(int fd); int kernctl_stop_session(int fd); -/* Apply on event FD */ +int kernctl_create_event_notifier_group(int fd); + +/* Apply on event notifier_group file descriptor. */ +int kernctl_create_event_notifier_group_notification_fd(int fd); +int kernctl_create_event_notifier(int fd, + const struct lttng_kernel_event_notifier *event_notifier); + +/* Apply on event file descriptor. */ int kernctl_filter(int fd, struct lttng_filter_bytecode *filter); int kernctl_add_callsite(int fd, struct lttng_kernel_event_callsite *callsite); @@ -39,7 +46,8 @@ int kernctl_tracer_abi_version(int fd, struct lttng_kernel_tracer_abi_version *v int kernctl_wait_quiescent(int fd); /* - * kernctl_syscall_mask - Get syscall mask associated to a channel FD. + * kernctl_syscall_mask - Get syscall mask associated to a channel file + * descriptor. * * The parameter @syscall_mask should initially be either NULL or point * to memory allocated with malloc(3) or realloc(3). When the function @@ -52,7 +60,7 @@ int kernctl_wait_quiescent(int fd); int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits); -/* Process ID tracking can be applied to session FD */ +/* Process ID tracking can be applied to session file descriptor. */ int kernctl_track_pid(int fd, int pid); int kernctl_untrack_pid(int fd, int pid); int kernctl_list_tracker_pids(int fd); diff --git a/src/common/kernel-ctl/kernel-ioctl.h b/src/common/kernel-ctl/kernel-ioctl.h index ed6555e10..8fa0a7d10 100644 --- a/src/common/kernel-ctl/kernel-ioctl.h +++ b/src/common/kernel-ctl/kernel-ioctl.h @@ -117,6 +117,8 @@ #define LTTNG_KERNEL_SYSCALL_LIST _IO(0xF6, 0x4A) #define LTTNG_KERNEL_TRACER_ABI_VERSION \ _IOR(0xF6, 0x4B, struct lttng_kernel_tracer_abi_version) +#define LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_CREATE \ + _IO(0xF6, 0x4C) /* Session FD ioctl */ #define LTTNG_KERNEL_METADATA \ @@ -154,11 +156,11 @@ #define LTTNG_KERNEL_CONTEXT \ _IOW(0xF6, 0x71, struct lttng_kernel_context) -/* Event, Channel and Session ioctl */ +/* Event, event notifier, Channel and Session ioctl */ #define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x82) #define LTTNG_KERNEL_DISABLE _IO(0xF6, 0x83) -/* Event FD ioctl */ +/* Event and event notifier FD ioctl */ #define LTTNG_KERNEL_FILTER _IO(0xF6, 0x90) #define LTTNG_KERNEL_ADD_CALLSITE _IO(0xF6, 0x91) @@ -170,4 +172,10 @@ #define LTTNG_KERNEL_SESSION_UNTRACK_ID \ _IOR(0xF6, 0xA2, struct lttng_kernel_tracker_args) +/* Event notifier group file descriptor ioctl */ +#define LTTNG_KERNEL_EVENT_NOTIFIER_CREATE \ + _IOW(0xF6, 0xB0, struct lttng_kernel_event_notifier) +#define LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD \ + _IO(0xF6, 0xB1) + #endif /* _LTT_KERNEL_IOCTL_H */ diff --git a/src/common/lttng-kernel.h b/src/common/lttng-kernel.h index 3dd866c75..cd343bb76 100644 --- a/src/common/lttng-kernel.h +++ b/src/common/lttng-kernel.h @@ -178,6 +178,18 @@ struct lttng_kernel_event { } u; } LTTNG_PACKED; +#define LTTNG_KERNEL_EVENT_NOTIFIER_PADDING 40 +struct lttng_kernel_event_notifier { + struct lttng_kernel_event event; + char padding[LTTNG_KERNEL_EVENT_NOTIFIER_PADDING]; +} LTTNG_PACKED; + +#define LTTNG_KERNEL_EVENT_NOTIFIER_NOTIFICATION_PADDING 34 +struct lttng_kernel_event_notifier_notification { + uint64_t token; + char padding[LTTNG_KERNEL_EVENT_NOTIFIER_NOTIFICATION_PADDING]; +} LTTNG_PACKED; + struct lttng_kernel_tracer_version { uint32_t major; uint32_t minor;