Refactoring: syscalls: move lttng_syscalls_create_matching_event_notifiers into regis...
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 2 Nov 2021 17:50:40 +0000 (13:50 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 2 Nov 2021 17:50:40 +0000 (13:50 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3c8e7c0f2ebf832e433b0c10b5073e7e469d8329

include/lttng/events-internal.h
src/lttng-events.c
src/lttng-syscalls.c

index e81404856ee9f2fd92721346e6d245b86fae2323..35ed887930b9f8fa9d3f358832e6cd148eccfe3d 100644 (file)
@@ -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)
 {
index bc5a56cc2a103d6a6a06273362428c6d5d05bd41..21f215492fde8dca231447ca8700d7f8e3bf495d 100644 (file)
@@ -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);
 }
 
 /*
index 9739513b0e37b45df5256efbc5ed18426edaaef9..70bbdd33b568b8924abd9a017e6ff72778db7ecd 100644 (file)
@@ -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,
This page took 0.030315 seconds and 4 git commands to generate.