From: Mathieu Desnoyers Date: Thu, 10 Dec 2020 15:14:43 +0000 (-0500) Subject: Fix: event notifier: notification send should be a callback X-Git-Tag: v2.13.0-rc1~410 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=cab88ff8cb13622233f1e0ed338d8d10a229370d;p=lttng-ust.git Fix: event notifier: notification send should be a callback 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 Change-Id: Ib51fdc09865f8ae158129417b9e26e86221881b0 --- diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 7e70ea40..98513891 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -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, diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index ad159b0d..ef9ea692 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -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); \ } diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index c80ecbfd..53bb1100 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -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); diff --git a/liblttng-ust/lttng-tracer-core.h b/liblttng-ust/lttng-tracer-core.h index 76f62510..f464d87a 100644 --- a/liblttng-ust/lttng-tracer-core.h +++ b/liblttng-ust/lttng-tracer-core.h @@ -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);