From: Michael Jeanson Date: Tue, 20 Apr 2021 17:00:16 +0000 (-0400) Subject: Tracepoint API namespacing 'TRACEPOINT_DEFINE' X-Git-Tag: v2.13.0-rc1~60 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88c7c4eacbd4a98ad8e5df341ae2f1223b735194;p=lttng-ust.git Tracepoint API namespacing 'TRACEPOINT_DEFINE' 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: Iffa8f15a1050e8d995bcc94c46f1cd588bb70aac Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/README.md b/README.md index 39fa4428..9553ef15 100644 --- a/README.md +++ b/README.md @@ -92,11 +92,11 @@ This method links the tracepoint provider with the application, either directly or through a static library (`.a`): 1. Into exactly one unit (C/C++ source file) of your _application_, - define `TRACEPOINT_DEFINE` and include the tracepoint provider + define `LTTNG_UST_TRACEPOINT_DEFINE` and 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. - 3. Use `-I.` when compiling the unit defining `TRACEPOINT_DEFINE` + 3. Use `-I.` when compiling the unit defining `LTTNG_UST_TRACEPOINT_DEFINE` (e.g., `tp.c`). 4. Link the application with `-ldl` on Linux, or with `-lc` on BSD, and with `-llttng-ust`. @@ -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_ `LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE`, + `LTTNG_UST_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. diff --git a/doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp b/doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp index 2e4284d5..cd6bcfbe 100644 --- a/doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp +++ b/doc/examples/cmake-multiple-shared-libraries/aligner-lib.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2016 Sebastien Boisvert */ -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "aligner-lib.h" #include "tracepoint-provider.h" diff --git a/doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp b/doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp index 95b7b3d0..647308b4 100644 --- a/doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp +++ b/doc/examples/cmake-multiple-shared-libraries/tester-lib.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2016 Sebastien Boisvert */ -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "tester-lib.h" #include "tracepoint-provider.h" diff --git a/doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp b/doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp index 58044b60..2f60f97a 100644 --- a/doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp +++ b/doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp @@ -5,6 +5,6 @@ */ #define TRACEPOINT_CREATE_PROBES -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "tracepoint-provider.h" diff --git a/doc/examples/demo/demo.c b/doc/examples/demo/demo.c index 96f9001b..d21e2ad1 100644 --- a/doc/examples/demo/demo.c +++ b/doc/examples/demo/demo.c @@ -17,7 +17,7 @@ #include #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "ust_tests_demo.h" #include "ust_tests_demo2.h" diff --git a/doc/examples/easy-ust/sample.c b/doc/examples/easy-ust/sample.c index 542a8f62..101d10d7 100644 --- a/doc/examples/easy-ust/sample.c +++ b/doc/examples/easy-ust/sample.c @@ -8,10 +8,10 @@ #include /* - * We need to define TRACEPOINT_DEFINE in one C file in the program + * We need to define LTTNG_UST_TRACEPOINT_DEFINE in one C file in the program * before including provider headers. */ -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "sample_component_provider.h" int main(void) diff --git a/doc/examples/hello-static-lib/hello.c b/doc/examples/hello-static-lib/hello.c index 4c339715..0bf41f7f 100644 --- a/doc/examples/hello-static-lib/hello.c +++ b/doc/examples/hello-static-lib/hello.c @@ -17,7 +17,7 @@ #include #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_tests_hello.h" static diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index b02ec330..043426fc 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -433,7 +433,13 @@ lttng_ust__tracepoints__destroy(void) memset(lttng_ust_tracepoint_dlopen_ptr, 0, sizeof(*lttng_ust_tracepoint_dlopen_ptr)); } -#ifdef TRACEPOINT_DEFINE +#if LTTNG_UST_COMPAT_API(0) +# if defined(TRACEPOINT_DEFINE) && !defined(LTTNG_UST_TRACEPOINT_DEFINE) +# define LTTNG_UST_TRACEPOINT_DEFINE +# endif +#endif /* #if LTTNG_UST_COMPAT_API(0) */ + +#ifdef LTTNG_UST_TRACEPOINT_DEFINE /* * These weak symbols, the constructor, and destructor take care of @@ -569,11 +575,11 @@ lttng_ust__tracepoints__ptrs_destroy(void) } } -#else /* TRACEPOINT_DEFINE */ +#else /* LTTNG_UST_TRACEPOINT_DEFINE */ #define LTTNG_UST__DEFINE_TRACEPOINT(_provider, _name, _args) -#endif /* #else TRACEPOINT_DEFINE */ +#endif /* #else LTTNG_UST_TRACEPOINT_DEFINE */ #if LTTNG_UST_COMPAT_API(0) #define tracepoint lttng_ust_tracepoint diff --git a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile-fast.c b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile-fast.c index f5396b41..3ea273ac 100644 --- a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile-fast.c +++ b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile-fast.c @@ -9,7 +9,7 @@ #include #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #define TP_IP_PARAM func_addr #include "lttng-ust-cyg-profile-fast.h" diff --git a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.c b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.c index c7d3d5ee..8566695c 100644 --- a/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.c +++ b/src/lib/lttng-ust-cyg-profile/lttng-ust-cyg-profile.c @@ -9,7 +9,7 @@ #include #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #define TP_IP_PARAM func_addr #include "lttng-ust-cyg-profile.h" diff --git a/src/lib/lttng-ust-dl/lttng-ust-dl.c b/src/lib/lttng-ust-dl/lttng-ust-dl.c index 0f01b356..e342fb2d 100644 --- a/src/lib/lttng-ust-dl/lttng-ust-dl.c +++ b/src/lib/lttng-ust-dl/lttng-ust-dl.c @@ -26,7 +26,7 @@ /* Include link.h last else it conflicts with ust-dlfcn. */ #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_dl.h" static void *(*__lttng_ust_plibc_dlopen)(const char *filename, int flags); diff --git a/src/lib/lttng-ust-java-agent/jni/jul/lttng_ust_jul.c b/src/lib/lttng-ust-java-agent/jni/jul/lttng_ust_jul.c index c1f4db86..840b27de 100644 --- a/src/lib/lttng-ust-java-agent/jni/jul/lttng_ust_jul.c +++ b/src/lib/lttng-ust-java-agent/jni/jul/lttng_ust_jul.c @@ -9,7 +9,7 @@ #define _LGPL_SOURCE #include "org_lttng_ust_agent_jul_LttngJulApi.h" -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #include "lttng_ust_jul.h" #include "../common/lttng_ust_context.h" diff --git a/src/lib/lttng-ust-java-agent/jni/log4j/lttng_ust_log4j.c b/src/lib/lttng-ust-java-agent/jni/log4j/lttng_ust_log4j.c index dea4bb96..6708fb4c 100644 --- a/src/lib/lttng-ust-java-agent/jni/log4j/lttng_ust_log4j.c +++ b/src/lib/lttng-ust-java-agent/jni/log4j/lttng_ust_log4j.c @@ -9,7 +9,7 @@ #define _LGPL_SOURCE #include "org_lttng_ust_agent_log4j_LttngLog4jApi.h" -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #include "lttng_ust_log4j.h" #include "../common/lttng_ust_context.h" diff --git a/src/lib/lttng-ust-java/LTTngUst.c b/src/lib/lttng-ust-java/LTTngUst.c index 5985bc41..69e00f90 100644 --- a/src/lib/lttng-ust-java/LTTngUst.c +++ b/src/lib/lttng-ust-java/LTTngUst.c @@ -7,7 +7,7 @@ #define _LGPL_SOURCE #include "org_lttng_ust_LTTngUst.h" -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #include "lttng_ust_java.h" diff --git a/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c b/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c index 48955795..3243693d 100644 --- a/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c +++ b/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c @@ -30,7 +30,7 @@ #include "common/macros.h" #include "common/align.h" -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #define TP_IP_PARAM ip #include "ust_libc.h" diff --git a/src/lib/lttng-ust-pthread-wrapper/lttng-ust-pthread.c b/src/lib/lttng-ust-pthread-wrapper/lttng-ust-pthread.c index 9b14317b..b590aa3e 100644 --- a/src/lib/lttng-ust-pthread-wrapper/lttng-ust-pthread.c +++ b/src/lib/lttng-ust-pthread-wrapper/lttng-ust-pthread.c @@ -16,7 +16,7 @@ #include "common/macros.h" #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #define TP_IP_PARAM ip #include "ust_pthread.h" diff --git a/src/lib/lttng-ust-python-agent/lttng_ust_python.c b/src/lib/lttng-ust-python-agent/lttng_ust_python.c index 9782f512..44b6ccf9 100644 --- a/src/lib/lttng-ust-python-agent/lttng_ust_python.c +++ b/src/lib/lttng-ust-python-agent/lttng_ust_python.c @@ -5,7 +5,7 @@ */ #define _LGPL_SOURCE -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #include "lttng_ust_python.h" diff --git a/src/lib/lttng-ust/lttng-ust-statedump.c b/src/lib/lttng-ust/lttng-ust-statedump.c index 31626f8c..b0c9a1a8 100644 --- a/src/lib/lttng-ust/lttng-ust-statedump.c +++ b/src/lib/lttng-ust/lttng-ust-statedump.c @@ -24,7 +24,7 @@ #include "common/getenv.h" #include "lib/lttng-ust/events.h" -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_lib.h" /* Only define. */ #define TRACEPOINT_CREATE_PROBES diff --git a/src/lib/lttng-ust/tracef.c b/src/lib/lttng-ust/tracef.c index e48ef802..b3aa32e9 100644 --- a/src/lib/lttng-ust/tracef.c +++ b/src/lib/lttng-ust/tracef.c @@ -9,7 +9,7 @@ #include "common/macros.h" #define TRACEPOINT_CREATE_PROBES -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "lttng-ust-tracef-provider.h" static inline diff --git a/src/lib/lttng-ust/tracelog.c b/src/lib/lttng-ust/tracelog.c index 28a3e1ac..f506e8ae 100644 --- a/src/lib/lttng-ust/tracelog.c +++ b/src/lib/lttng-ust/tracelog.c @@ -9,7 +9,7 @@ #include "common/macros.h" #define TRACEPOINT_CREATE_PROBES -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "lttng-ust-tracelog-provider.h" #define TRACELOG_CB(level) \ diff --git a/tests/benchmark/bench.c b/tests/benchmark/bench.c index 5b17af8b..fcd373ad 100644 --- a/tests/benchmark/bench.c +++ b/tests/benchmark/bench.c @@ -16,7 +16,7 @@ #include #ifdef TRACING -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_tests_benchmark.h" #endif diff --git a/tests/compile/ctf-types/ctf-types.c b/tests/compile/ctf-types/ctf-types.c index 6b6021db..c54ed6a4 100644 --- a/tests/compile/ctf-types/ctf-types.c +++ b/tests/compile/ctf-types/ctf-types.c @@ -6,7 +6,7 @@ #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_tests_ctf_types.h" int main(int argc, char **argv) diff --git a/tests/compile/hello-many/hello-many.c b/tests/compile/hello-many/hello-many.c index e615b33d..1cae515f 100644 --- a/tests/compile/hello-many/hello-many.c +++ b/tests/compile/hello-many/hello-many.c @@ -16,7 +16,7 @@ #include #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_tests_hello_many.h" int main(int argc, char **argv) diff --git a/tests/compile/hello.cxx/hello.cpp b/tests/compile/hello.cxx/hello.cpp index afbcf469..e031279b 100644 --- a/tests/compile/hello.cxx/hello.cpp +++ b/tests/compile/hello.cxx/hello.cpp @@ -17,7 +17,7 @@ #include #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_tests_hello.h" static diff --git a/tests/compile/hello/hello.c b/tests/compile/hello/hello.c index 6b36ee7c..107cf55e 100644 --- a/tests/compile/hello/hello.c +++ b/tests/compile/hello/hello.c @@ -23,7 +23,7 @@ struct mmsghdr; #include #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_tests_hello.h" static diff --git a/tests/compile/same_line_tracepoint/same_line_tracepoint.c b/tests/compile/same_line_tracepoint/same_line_tracepoint.c index 2a59df81..9ec02607 100644 --- a/tests/compile/same_line_tracepoint/same_line_tracepoint.c +++ b/tests/compile/same_line_tracepoint/same_line_tracepoint.c @@ -4,7 +4,7 @@ * Copyright (C) 2013 Jérémie Galarneau */ -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #define TRACEPOINT_CREATE_PROBES #include "ust_tests_sameline.h" diff --git a/tests/compile/test-app-ctx/hello.c b/tests/compile/test-app-ctx/hello.c index cb0af8b5..723f179f 100644 --- a/tests/compile/test-app-ctx/hello.c +++ b/tests/compile/test-app-ctx/hello.c @@ -25,7 +25,7 @@ struct mmsghdr; #include #include -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_tests_hello.h" #include diff --git a/tools/lttng-gen-tp b/tools/lttng-gen-tp index 919f01a3..b318d1cd 100755 --- a/tools/lttng-gen-tp +++ b/tools/lttng-gen-tp @@ -61,7 +61,7 @@ class CFile: /* * The header containing our LTTNG_UST_TRACEPOINT_EVENTs. */ -#define TRACEPOINT_DEFINE +#define LTTNG_UST_TRACEPOINT_DEFINE #include "{headerFilename}" """