From: Michael Jeanson Date: Tue, 9 Mar 2021 19:41:26 +0000 (-0500) Subject: Hide lttng_ust_getenv private symbols X-Git-Tag: v2.13.0-rc1~329 X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=4c41b460614826ada066a7e0c26a8b116336bab2 Hide lttng_ust_getenv private symbols The major SONAME bump to '1' gives us the opportunity to hide private symbols that should never have been visible. Also namespace lttng_getenv to lttng_ust_getenv to match the init function. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers Change-Id: I03f9c4f431d521a3b2419bde23a51d495155730c --- diff --git a/liblttng-ust/getenv.c b/liblttng-ust/getenv.c index f2222ddb..ea8edbcd 100644 --- a/liblttng-ust/getenv.c +++ b/liblttng-ust/getenv.c @@ -50,7 +50,7 @@ int lttng_is_setuid_setgid(void) return geteuid() != getuid() || getegid() != getgid(); } -char *lttng_getenv(const char *name) +char *lttng_ust_getenv(const char *name) { size_t i; struct lttng_env *e; diff --git a/liblttng-ust/getenv.h b/liblttng-ust/getenv.h index c504ecbd..f8e7bc37 100644 --- a/liblttng-ust/getenv.h +++ b/liblttng-ust/getenv.h @@ -7,17 +7,21 @@ #ifndef _COMPAT_GETENV_H #define _COMPAT_GETENV_H +#include "ust-helper.h" + /* - * Always add the lttng-ust environment variables to lttng_getenv() - * infrastructure rather than using getenv() directly from lttng-ust. - * This ensures that we don't trigger races between getenv() invoked by - * lttng-ust listener threads invoked concurrently with setenv() called - * by an otherwise single-threaded application thread. (the application - * is not aware that it runs with lttng-ust) + * Always add the lttng-ust environment variables using the lttng_ust_getenv() + * infrastructure rather than using getenv() directly. This ensures that we + * don't trigger races between getenv() invoked by lttng-ust listener threads + * invoked concurrently with setenv() called by an otherwise single-threaded + * application thread. (the application is not aware that it runs with + * lttng-ust) */ -char *lttng_getenv(const char *name); +LTTNG_HIDDEN +char *lttng_ust_getenv(const char *name); +LTTNG_HIDDEN void lttng_ust_getenv_init(void); #endif /* _COMPAT_GETENV_H */ diff --git a/liblttng-ust/lttng-clock.c b/liblttng-ust/lttng-clock.c index 3cd26fb3..93a5075d 100644 --- a/liblttng-ust/lttng-clock.c +++ b/liblttng-ust/lttng-clock.c @@ -90,7 +90,7 @@ void lttng_ust_clock_init(void) if (clock_handle) return; - libname = lttng_getenv("LTTNG_UST_CLOCK_PLUGIN"); + libname = lttng_ust_getenv("LTTNG_UST_CLOCK_PLUGIN"); if (!libname) return; clock_handle = dlopen(libname, RTLD_NOW); diff --git a/liblttng-ust/lttng-getcpu.c b/liblttng-ust/lttng-getcpu.c index dc2834e9..762f8152 100644 --- a/liblttng-ust/lttng-getcpu.c +++ b/liblttng-ust/lttng-getcpu.c @@ -34,7 +34,7 @@ void lttng_ust_getcpu_init(void) if (getcpu_handle) return; - libname = lttng_getenv("LTTNG_UST_GETCPU_PLUGIN"); + libname = lttng_ust_getenv("LTTNG_UST_GETCPU_PLUGIN"); if (!libname) return; getcpu_handle = dlopen(libname, RTLD_NOW); diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index a2691049..25de5dd5 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -398,11 +398,11 @@ const char *get_lttng_home_dir(void) { const char *val; - val = (const char *) lttng_getenv("LTTNG_HOME"); + val = (const char *) lttng_ust_getenv("LTTNG_HOME"); if (val != NULL) { return val; } - return (const char *) lttng_getenv("HOME"); + return (const char *) lttng_ust_getenv("HOME"); } /* @@ -552,7 +552,7 @@ long get_timeout(void) long constructor_delay_ms = LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS; if (!got_timeout_env) { - str_timeout = lttng_getenv("LTTNG_UST_REGISTER_TIMEOUT"); + str_timeout = lttng_ust_getenv("LTTNG_UST_REGISTER_TIMEOUT"); got_timeout_env = 1; } if (str_timeout) @@ -619,7 +619,7 @@ static void get_allow_blocking(void) { const char *str_allow_blocking = - lttng_getenv("LTTNG_UST_ALLOW_BLOCKING"); + lttng_ust_getenv("LTTNG_UST_ALLOW_BLOCKING"); if (str_allow_blocking) { DBG("%s environment variable is set", diff --git a/liblttng-ust/lttng-ust-statedump.c b/liblttng-ust/lttng-ust-statedump.c index 2b3158d4..eac3e888 100644 --- a/liblttng-ust/lttng-ust-statedump.c +++ b/liblttng-ust/lttng-ust-statedump.c @@ -548,7 +548,7 @@ void lttng_ust_dl_update(void *ip) { struct dl_iterate_data data; - if (lttng_getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP")) + if (lttng_ust_getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP")) return; /* @@ -582,7 +582,7 @@ void lttng_ust_dl_update(void *ip) static int do_baddr_statedump(void *owner) { - if (lttng_getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP")) + if (lttng_ust_getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP")) return 0; lttng_ust_dl_update(LTTNG_UST_CALLER_IP()); ust_dl_table_statedump(owner); @@ -592,7 +592,7 @@ int do_baddr_statedump(void *owner) static int do_procname_statedump(void *owner) { - if (lttng_getenv("LTTNG_UST_WITHOUT_PROCNAME_STATEDUMP")) + if (lttng_ust_getenv("LTTNG_UST_WITHOUT_PROCNAME_STATEDUMP")) return 0; trace_statedump_event(procname_cb, owner, lttng_ust_sockinfo_get_procname(owner)); diff --git a/snprintf/core.c b/snprintf/core.c index d0f60a10..8c4eddec 100644 --- a/snprintf/core.c +++ b/snprintf/core.c @@ -14,7 +14,7 @@ void ust_err_init(void) if (ust_err_loglevel == UST_ERR_LOGLEVEL_UNKNOWN) { /* - * This getenv is not part of lttng_getenv() because it + * This getenv is not part of lttng_ust_getenv() because it * is required to print ERR() performed during getenv * initialization. */