From 660323e630e752c98bf6124d54ff99777d05ce7d Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 20 Apr 2021 13:59:50 -0400 Subject: [PATCH] Tracepoint API namespacing 'TRACEPOINT_CREATE_PROBES' 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: Ibb5e359d4d594b8c7a51852acde8e80d9f79e131 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- .../tracepoint-provider.cpp | 2 +- doc/examples/demo/tp.c | 2 +- doc/examples/demo/tp2.c | 2 +- doc/examples/demo/tp3.c | 2 +- doc/examples/easy-ust/tp.c | 2 +- doc/examples/hello-static-lib/tp.c | 2 +- include/lttng/tracepoint-event.h | 18 +++++++++++++++--- .../lttng-ust-cyg-profile-fast.c | 2 +- .../lttng-ust-cyg-profile.c | 2 +- src/lib/lttng-ust-dl/ust_dl.c | 2 +- .../jni/jul/lttng_ust_jul.c | 2 +- .../jni/log4j/lttng_ust_log4j.c | 2 +- src/lib/lttng-ust-java/LTTngUst.c | 2 +- .../lttng-ust-libc-wrapper/lttng-ust-malloc.c | 2 +- .../lttng-ust-pthread.c | 2 +- .../lttng-ust-python-agent/lttng_ust_python.c | 2 +- src/lib/lttng-ust/lttng-ust-statedump.c | 2 +- src/lib/lttng-ust/tracef.c | 2 +- src/lib/lttng-ust/tracelog.c | 2 +- src/lib/lttng-ust/ust_lib.c | 2 +- tests/benchmark/tp.c | 2 +- tests/compile/ctf-types/tp.c | 2 +- tests/compile/hello-many/tp.c | 2 +- tests/compile/hello.cxx/tp-cpp.cpp | 2 +- tests/compile/hello/tp.c | 2 +- .../same_line_tracepoint.c | 2 +- tests/compile/test-app-ctx/tp.c | 2 +- tools/lttng-gen-tp | 2 +- 28 files changed, 42 insertions(+), 30 deletions(-) diff --git a/doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp b/doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp index 2f60f97a..17972b2f 100644 --- a/doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp +++ b/doc/examples/cmake-multiple-shared-libraries/tracepoint-provider.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2016 Sebastien Boisvert */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #define LTTNG_UST_TRACEPOINT_DEFINE #include "tracepoint-provider.h" diff --git a/doc/examples/demo/tp.c b/doc/examples/demo/tp.c index 6a6fa6c0..bfd6c175 100644 --- a/doc/examples/demo/tp.c +++ b/doc/examples/demo/tp.c @@ -4,5 +4,5 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_demo.h" diff --git a/doc/examples/demo/tp2.c b/doc/examples/demo/tp2.c index d154fd3d..91e9cf4e 100644 --- a/doc/examples/demo/tp2.c +++ b/doc/examples/demo/tp2.c @@ -4,5 +4,5 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_demo2.h" diff --git a/doc/examples/demo/tp3.c b/doc/examples/demo/tp3.c index 9df93c27..13b079a7 100644 --- a/doc/examples/demo/tp3.c +++ b/doc/examples/demo/tp3.c @@ -4,5 +4,5 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_demo3.h" diff --git a/doc/examples/easy-ust/tp.c b/doc/examples/easy-ust/tp.c index d4666131..f95da91a 100644 --- a/doc/examples/easy-ust/tp.c +++ b/doc/examples/easy-ust/tp.c @@ -8,7 +8,7 @@ * Defining macro creates the code objects of the traceprobes, only do * it once per file */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES /* * The header containing our LTTNG_UST_TRACEPOINT_EVENTs. */ diff --git a/doc/examples/hello-static-lib/tp.c b/doc/examples/hello-static-lib/tp.c index c7495dd6..98669b6e 100644 --- a/doc/examples/hello-static-lib/tp.c +++ b/doc/examples/hello-static-lib/tp.c @@ -4,5 +4,5 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_hello.h" diff --git a/include/lttng/tracepoint-event.h b/include/lttng/tracepoint-event.h index f97b67d1..cf482b17 100644 --- a/include/lttng/tracepoint-event.h +++ b/include/lttng/tracepoint-event.h @@ -4,7 +4,16 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#ifdef TRACEPOINT_CREATE_PROBES +#include + + +#if LTTNG_UST_COMPAT_API(0) +# if defined(TRACEPOINT_CREATE_PROBES) && !defined(LTTNG_UST_TRACEPOINT_CREATE_PROBES) +# define LTTNG_UST_TRACEPOINT_CREATE_PROBES +# endif +#endif /* #if LTTNG_UST_COMPAT_API(0) */ + +#ifdef LTTNG_UST_TRACEPOINT_CREATE_PROBES #define __tp_stringify1(x) #x #define __tp_stringify(x) __tp_stringify1(x) @@ -20,7 +29,10 @@ LTTNG_UST__TP_PARAMS(_args)) +#undef LTTNG_UST_TRACEPOINT_CREATE_PROBES +#if LTTNG_UST_COMPAT_API(0) #undef TRACEPOINT_CREATE_PROBES +#endif #define TRACEPOINT_HEADER_MULTI_READ @@ -31,7 +43,7 @@ #undef TRACEPOINT_HEADER_MULTI_READ #undef TRACEPOINT_INCLUDE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES /* * Put back definitions to the state they were when defined by @@ -59,4 +71,4 @@ #undef LTTNG_UST_TRACEPOINT_MODEL_EMF_URI #define LTTNG_UST_TRACEPOINT_MODEL_EMF_URI(provider, name, uri) -#endif /* TRACEPOINT_CREATE_PROBES */ +#endif /* LTTNG_UST_TRACEPOINT_CREATE_PROBES */ 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 3ea273ac..2d91d8ac 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 @@ -10,7 +10,7 @@ #include #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_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 8566695c..e0a0dd61 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 @@ -10,7 +10,7 @@ #include #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #define TP_IP_PARAM func_addr #include "lttng-ust-cyg-profile.h" diff --git a/src/lib/lttng-ust-dl/ust_dl.c b/src/lib/lttng-ust-dl/ust_dl.c index b35ed620..234857ae 100644 --- a/src/lib/lttng-ust-dl/ust_dl.c +++ b/src/lib/lttng-ust-dl/ust_dl.c @@ -5,6 +5,6 @@ */ #define _LGPL_SOURCE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #define TP_IP_PARAM ip #include "ust_dl.h" 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 840b27de..bb9af808 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 @@ -10,7 +10,7 @@ #include "org_lttng_ust_agent_jul_LttngJulApi.h" #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_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 6708fb4c..65f519dd 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 @@ -10,7 +10,7 @@ #include "org_lttng_ust_agent_log4j_LttngLog4jApi.h" #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_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 69e00f90..8e9c9603 100644 --- a/src/lib/lttng-ust-java/LTTngUst.c +++ b/src/lib/lttng-ust-java/LTTngUst.c @@ -8,7 +8,7 @@ #include "org_lttng_ust_LTTngUst.h" #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "lttng_ust_java.h" JNIEXPORT void JNICALL Java_org_lttng_ust_LTTngUst_tracepointInt(JNIEnv *env, 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 3243693d..d51c5ab3 100644 --- a/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c +++ b/src/lib/lttng-ust-libc-wrapper/lttng-ust-malloc.c @@ -31,7 +31,7 @@ #include "common/align.h" #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_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 b590aa3e..09881e2b 100644 --- a/src/lib/lttng-ust-pthread-wrapper/lttng-ust-pthread.c +++ b/src/lib/lttng-ust-pthread-wrapper/lttng-ust-pthread.c @@ -17,7 +17,7 @@ #include #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_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 44b6ccf9..bf71beae 100644 --- a/src/lib/lttng-ust-python-agent/lttng_ust_python.c +++ b/src/lib/lttng-ust-python-agent/lttng_ust_python.c @@ -6,7 +6,7 @@ #define _LGPL_SOURCE #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_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 b0c9a1a8..62a94291 100644 --- a/src/lib/lttng-ust/lttng-ust-statedump.c +++ b/src/lib/lttng-ust/lttng-ust-statedump.c @@ -27,7 +27,7 @@ #define LTTNG_UST_TRACEPOINT_DEFINE #include "ust_lib.h" /* Only define. */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #define TP_SESSION_CHECK #include "lttng-ust-statedump-provider.h" /* Define and create probes. */ diff --git a/src/lib/lttng-ust/tracef.c b/src/lib/lttng-ust/tracef.c index b3aa32e9..e1824e5c 100644 --- a/src/lib/lttng-ust/tracef.c +++ b/src/lib/lttng-ust/tracef.c @@ -8,7 +8,7 @@ #include #include "common/macros.h" -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #define LTTNG_UST_TRACEPOINT_DEFINE #include "lttng-ust-tracef-provider.h" diff --git a/src/lib/lttng-ust/tracelog.c b/src/lib/lttng-ust/tracelog.c index e5bd3890..d079b15a 100644 --- a/src/lib/lttng-ust/tracelog.c +++ b/src/lib/lttng-ust/tracelog.c @@ -8,7 +8,7 @@ #include #include "common/macros.h" -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #define LTTNG_UST_TRACEPOINT_DEFINE #include "lttng-ust-tracelog-provider.h" diff --git a/src/lib/lttng-ust/ust_lib.c b/src/lib/lttng-ust/ust_lib.c index 19817d78..e56a43f6 100644 --- a/src/lib/lttng-ust/ust_lib.c +++ b/src/lib/lttng-ust/ust_lib.c @@ -6,6 +6,6 @@ */ #define _LGPL_SOURCE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #define TP_IP_PARAM ip #include "ust_lib.h" diff --git a/tests/benchmark/tp.c b/tests/benchmark/tp.c index a0bd812c..72339e2f 100644 --- a/tests/benchmark/tp.c +++ b/tests/benchmark/tp.c @@ -4,5 +4,5 @@ * Copyright (C) 2013 Zifei Tong */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_benchmark.h" diff --git a/tests/compile/ctf-types/tp.c b/tests/compile/ctf-types/tp.c index 426854c4..25c9c8a7 100644 --- a/tests/compile/ctf-types/tp.c +++ b/tests/compile/ctf-types/tp.c @@ -4,5 +4,5 @@ * Copyright (C) 2014 Geneviève Bastien */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_ctf_types.h" diff --git a/tests/compile/hello-many/tp.c b/tests/compile/hello-many/tp.c index 6c032644..fbd81ab9 100644 --- a/tests/compile/hello-many/tp.c +++ b/tests/compile/hello-many/tp.c @@ -4,5 +4,5 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_hello_many.h" diff --git a/tests/compile/hello.cxx/tp-cpp.cpp b/tests/compile/hello.cxx/tp-cpp.cpp index c7495dd6..98669b6e 100644 --- a/tests/compile/hello.cxx/tp-cpp.cpp +++ b/tests/compile/hello.cxx/tp-cpp.cpp @@ -4,5 +4,5 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_hello.h" diff --git a/tests/compile/hello/tp.c b/tests/compile/hello/tp.c index c7495dd6..98669b6e 100644 --- a/tests/compile/hello/tp.c +++ b/tests/compile/hello/tp.c @@ -4,5 +4,5 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_hello.h" diff --git a/tests/compile/same_line_tracepoint/same_line_tracepoint.c b/tests/compile/same_line_tracepoint/same_line_tracepoint.c index 9ec02607..81c7540d 100644 --- a/tests/compile/same_line_tracepoint/same_line_tracepoint.c +++ b/tests/compile/same_line_tracepoint/same_line_tracepoint.c @@ -5,7 +5,7 @@ */ #define LTTNG_UST_TRACEPOINT_DEFINE -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_sameline.h" int main(void) diff --git a/tests/compile/test-app-ctx/tp.c b/tests/compile/test-app-ctx/tp.c index c7495dd6..98669b6e 100644 --- a/tests/compile/test-app-ctx/tp.c +++ b/tests/compile/test-app-ctx/tp.c @@ -4,5 +4,5 @@ * Copyright (C) 2011 Mathieu Desnoyers */ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES #include "ust_tests_hello.h" diff --git a/tools/lttng-gen-tp b/tools/lttng-gen-tp index c3ee7c5e..889a4030 100755 --- a/tools/lttng-gen-tp +++ b/tools/lttng-gen-tp @@ -57,7 +57,7 @@ class HeaderFile: class CFile: FILE_TPL = """ -#define TRACEPOINT_CREATE_PROBES +#define LTTNG_UST_TRACEPOINT_CREATE_PROBES /* * The header containing our LTTNG_UST_TRACEPOINT_EVENTs. */ -- 2.34.1