Tracepoint API namespacing 'TRACEPOINT_PROBE_DYNAMIC_LINKAGE'
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 20 Apr 2021 16:13:28 +0000 (12:13 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Apr 2021 15:01:18 +0000 (11:01 -0400)
The ABI bump gives us the opportunity to namespace all public symbols
under the 'lttng_ust_' prefix. Namespace all API symbols and macros
under 'lttng_ust_' / 'LTTNG_UST_' and add compat macros to keep
compatibility with the previous API.

Change-Id: Iee16eccc8fa796c0154a879d5fc04b9d84597e14
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
README.md
doc/examples/demo/demo.c
include/lttng/tracepoint.h

index 3c45c30c190752c5a458adb3a159904cd722c8cd..39fa442887f5a8ea80c48359152a6c6c29fc7b1c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -124,7 +124,7 @@ This method decouples the tracepoint provider from the application,
 making it dynamically loadable.
 
   1. Into exactly one unit of your _application_, define
-     `TRACEPOINT_DEFINE` _and_ `TRACEPOINT_PROBE_DYNAMIC_LINKAGE`,
+     `TRACEPOINT_DEFINE` _and_ `LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE`,
      then include the tracepoint provider header.
   2. Include the tracepoint provider header into all C/C++ files using
      the provider and insert tracepoints using the `tracepoint()` macro.
index aa54055b4d2c0de3012bce43703c7706b4689c90..96f9001b4e7335f0b141b1dac4e8f3105f4ac692 100644 (file)
@@ -18,7 +18,7 @@
 #include <stdlib.h>
 
 #define TRACEPOINT_DEFINE
-#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
+#define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE
 #include "ust_tests_demo.h"
 #include "ust_tests_demo2.h"
 #include "ust_tests_demo3.h"
index 96f3fe3a629c1099df9b61394077c9ad10c9bd72..4223579e54ef7aab940d1498188c318cbb8364b9 100644 (file)
@@ -446,26 +446,33 @@ extern struct lttng_ust_tracepoint * const __stop_lttng_ust_tracepoints_ptrs[]
        __attribute__((weak, visibility("hidden")));
 
 /*
- * When TRACEPOINT_PROBE_DYNAMIC_LINKAGE is defined, we do not emit a
+ * When LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE is defined, we do not emit a
  * unresolved symbol that requires the provider to be linked in. When
- * TRACEPOINT_PROBE_DYNAMIC_LINKAGE is not defined, we emit an
+ * LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE is not defined, we emit an
  * unresolved symbol that depends on having the provider linked in,
  * otherwise the linker complains. This deals with use of static
  * libraries, ensuring that the linker does not remove the provider
  * object from the executable.
  */
-#ifdef TRACEPOINT_PROBE_DYNAMIC_LINKAGE
-#define _TRACEPOINT_UNDEFINED_REF(provider)    NULL
-#else  /* TRACEPOINT_PROBE_DYNAMIC_LINKAGE */
-#define _TRACEPOINT_UNDEFINED_REF(provider)    &lttng_ust_tracepoint_provider_##provider
-#endif /* TRACEPOINT_PROBE_DYNAMIC_LINKAGE */
+
+#if LTTNG_UST_COMPAT_API(0)
+# if defined(TRACEPOINT_PROBE_DYNAMIC_LINKAGE) && !defined(LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE)
+#  define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE
+# endif
+#endif /* #if LTTNG_UST_COMPAT_API(0) */
+
+#ifdef LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE
+#define LTTNG_UST__TRACEPOINT_UNDEFINED_REF(provider)  NULL
+#else  /* LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE */
+#define LTTNG_UST__TRACEPOINT_UNDEFINED_REF(provider)  &lttng_ust_tracepoint_provider_##provider
+#endif /* LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE */
 
 /*
  * Note: to allow PIC code, we need to allow the linker to update the pointers
  * in the lttng_ust_tracepoints_ptrs section.
  * Therefore, this section is _not_ const (read-only).
  */
-#define _TP_EXTRACT_STRING(...)        #__VA_ARGS__
+#define LTTNG_UST__TP_EXTRACT_STRING(...)      #__VA_ARGS__
 
 #define LTTNG_UST__DEFINE_TRACEPOINT(_provider, _name, _args)                          \
        lttng_ust_tracepoint_validate_name_len(_provider, _name);               \
@@ -483,8 +490,8 @@ extern struct lttng_ust_tracepoint * const __stop_lttng_ust_tracepoints_ptrs[]
                        __tp_name_strtab_##_provider##___##_name,               \
                        0,                                                      \
                        NULL,                                                   \
-                       _TRACEPOINT_UNDEFINED_REF(_provider),                   \
-                       _TP_EXTRACT_STRING(_args),                              \
+                       LTTNG_UST__TRACEPOINT_UNDEFINED_REF(_provider),         \
+                       LTTNG_UST__TP_EXTRACT_STRING(_args),                    \
                };                                                              \
        static struct lttng_ust_tracepoint *                                    \
                lttng_ust_tracepoint_ptr_##_provider##___##_name                        \
This page took 0.027564 seconds and 4 git commands to generate.