From: Mathieu Desnoyers Date: Tue, 2 Nov 2021 17:50:40 +0000 (-0400) Subject: Refactoring: syscalls: move lttng_syscalls_create_matching_event_notifiers into regis... X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0fab709d24a9c6195e31414e00c95e74d8d807c5;p=lttng-modules.git Refactoring: syscalls: move lttng_syscalls_create_matching_event_notifiers into registration Signed-off-by: Mathieu Desnoyers Change-Id: I3c8e7c0f2ebf832e433b0c10b5073e7e469d8329 --- diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index e8140485..35ed8879 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -818,9 +818,6 @@ int lttng_syscalls_destroy_syscall_table(struct lttng_kernel_syscall_table *sysc long lttng_syscall_table_get_active_mask(struct lttng_kernel_syscall_table *syscall_table, struct lttng_kernel_abi_syscall_mask __user *usyscall_mask); - -int lttng_syscalls_create_matching_event_notifiers( - struct lttng_event_notifier_enabler *event_notifier_enabler); #else static inline int lttng_syscalls_register_event(struct lttng_event_enabler_common *event_enabler) { diff --git a/src/lttng-events.c b/src/lttng-events.c index bc5a56cc..21f21549 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -2253,8 +2253,6 @@ void lttng_create_syscall_event_notifier_if_missing(struct lttng_event_notifier_ ret = lttng_syscalls_register_event(&event_notifier_enabler->parent); WARN_ON_ONCE(ret); - ret = lttng_syscalls_create_matching_event_notifiers(event_notifier_enabler); - WARN_ON_ONCE(ret); } /* diff --git a/src/lttng-syscalls.c b/src/lttng-syscalls.c index 9739513b..70bbdd33 100644 --- a/src/lttng-syscalls.c +++ b/src/lttng-syscalls.c @@ -132,6 +132,9 @@ struct lttng_syscall_filter { DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls); }; +static +int lttng_syscalls_create_matching_event_notifiers(struct lttng_event_enabler_common *event_enabler); + static void syscall_entry_event_unknown(struct hlist_head *unknown_action_list_head, struct pt_regs *regs, long id) { @@ -816,6 +819,11 @@ int lttng_syscalls_register_event(struct lttng_event_enabler_common *syscall_eve } syscall_table->sys_exit_registered = 1; } + + ret = lttng_syscalls_create_matching_event_notifiers(syscall_event_enabler); + if (ret) + return ret; + return ret; } @@ -994,14 +1002,17 @@ end: } -int lttng_syscalls_create_matching_event_notifiers( - struct lttng_event_notifier_enabler *event_notifier_enabler) +static +int lttng_syscalls_create_matching_event_notifiers(struct lttng_event_enabler_common *event_enabler) { int ret; - struct lttng_event_enabler_common *base_enabler = - lttng_event_notifier_enabler_as_enabler(event_notifier_enabler); enum lttng_kernel_abi_syscall_entryexit entryexit = - base_enabler->event_param.u.syscall.entryexit; + event_enabler->event_param.u.syscall.entryexit; + struct lttng_event_notifier_enabler *event_notifier_enabler; + + if (event_enabler->enabler_type != LTTNG_EVENT_ENABLER_TYPE_NOTIFIER) + return 0; + event_notifier_enabler = container_of(event_enabler, struct lttng_event_notifier_enabler, parent); if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRY || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT) { ret = create_matching_event_notifiers(event_notifier_enabler,