Fix: event notifier: notification send should be a callback
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 10 Dec 2020 15:14:43 +0000 (10:14 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 10 Dec 2020 15:16:56 +0000 (10:16 -0500)
Turn notification send into a callback so probes compiled against
lttng-ust 2.13+ but executed in an environment with lttng-ust 2.12 or
prior don't trigger linker error due to missing
lttng_event_notifier_notification_send symbol.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib51fdc09865f8ae158129417b9e26e86221881b0

include/lttng/ust-events.h
include/lttng/ust-tracepoint-event.h
liblttng-ust/lttng-events.c
liblttng-ust/lttng-tracer-core.h

index 7e70ea40e0b096c8c89fcc6b84c7928c2bb7b197..98513891501306f9bbd9095f64800e4e61bddc2e 100644 (file)
@@ -64,6 +64,7 @@ struct lttng_session;
 struct lttng_ust_lib_ring_buffer_ctx;
 struct lttng_ust_context_app;
 struct lttng_event_field;
+struct lttng_event_notifier;
 struct lttng_event_notifier_group;
 
 /*
@@ -515,6 +516,8 @@ struct lttng_event_notifier {
        int enabled;
        int registered;                 /* has reg'd tracepoint probe */
        size_t num_captures;            /* Needed to allocate the msgpack array. */
+       void (*notification_send)(struct lttng_event_notifier *event_notifier,
+               const char *stack_data);
        struct cds_list_head filter_bytecode_runtime_head;
        struct cds_list_head capture_bytecode_runtime_head;
        int has_enablers_without_bytecode;
@@ -751,10 +754,6 @@ int lttng_session_disable(struct lttng_session *session);
 int lttng_session_statedump(struct lttng_session *session);
 void lttng_session_destroy(struct lttng_session *session);
 
-void lttng_event_notifier_notification_send(
-               struct lttng_event_notifier *event_notifier,
-               const char *stack_data);
-
 struct lttng_channel *lttng_channel_create(struct lttng_session *session,
                                       const char *transport_name,
                                       void *buf_addr,
index ad159b0d9949cf51db25fbc5acad679c488b11f0..ef9ea692dad9f48703d3e2e360210da9f339b1e6 100644 (file)
@@ -957,6 +957,7 @@ void __event_notifier_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))
                size_t __dynamic_len[__num_fields];                           \
                char __interpreter_stack_data[2 * sizeof(unsigned long) * __num_fields]; \
        } __stackvar;                                                         \
+                                                                             \
        if (caa_unlikely(!CMM_ACCESS_ONCE(__event_notifier->enabled)))        \
                return;                                                       \
        if (caa_unlikely(!TP_RCU_LINK_TEST()))                                \
@@ -979,7 +980,7 @@ void __event_notifier_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))
                __event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
                        _TP_ARGS_DATA_VAR(_args));                            \
                                                                              \
-       lttng_event_notifier_notification_send(__event_notifier,              \
+       __event_notifier->notification_send(__event_notifier,                 \
                        __stackvar.__interpreter_stack_data);                 \
 }
 
index c80ecbfdadc92a94be63e0c541d38e02d1a330e2..53bb1100cab922b7fd86a0349c69ce3b057bfb98 100644 (file)
@@ -869,6 +869,7 @@ int lttng_event_notifier_create(const struct lttng_event_desc *desc,
        CDS_INIT_LIST_HEAD(&event_notifier->capture_bytecode_runtime_head);
        CDS_INIT_LIST_HEAD(&event_notifier->enablers_ref_head);
        event_notifier->desc = desc;
+       event_notifier->notification_send = lttng_event_notifier_notification_send;
 
        cds_list_add(&event_notifier->node,
                        &event_notifier_group->event_notifiers_head);
index 76f62510b41e75439f39bb0ada731235b03cadcb..f464d87a6e10eeee486812fad52cae6dbb821ac5 100644 (file)
@@ -84,6 +84,11 @@ extern void (*lttng_ust_liburcu_bp_before_fork)(void);
 extern void (*lttng_ust_liburcu_bp_after_fork_parent)(void);
 extern void (*lttng_ust_liburcu_bp_after_fork_child)(void);
 
+LTTNG_HIDDEN
+void lttng_event_notifier_notification_send(
+               struct lttng_event_notifier *event_notifier,
+               const char *stack_data);
+
 #ifdef LTTNG_UST_HAVE_PERF_EVENT
 void lttng_ust_fixup_perf_counter_tls(void);
 void lttng_perf_lock(void);
This page took 0.028269 seconds and 4 git commands to generate.