Fix: namespace our gettid wrapper
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mathieu Desnoyers
AppliedMerged into master, backported to 2.11, 2.10, 2.9 branches, thanks!
Mathieu
Quoted 76 lines · ----- On Jun 3, 2019, at 3:25 PM, Michael Jeanson [email protected] wrote:
Since glibc 2.30, a gettid wrapper was added that conflicts with our static declaration. Namespace our wrapper so there is no conflict, we'll add support for the glibc provided wrapper in a further commit.
Signed-off-by Michael Jeanson <[email protected]>---
include/lttng/ust-tid.h | 12 +++++++----- include/usterr-signal-safe.h | 2 +- liblttng-ust/lttng-context-vtid.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-)include/lttng/ust-tid.h +7
-5@@ -31,23 +31,25 @@#include <syscall.h> #endif -#if defined(_syscall0) -_syscall0(pid_t, gettid) -#elif defined(__NR_gettid) +#if defined(__NR_gettid) +#include <unistd.h> -static inline pid_t gettid (void ) +static inline pid_t lttng_gettid (void ) {return syscall (__NR_gettid); } +#else +#include <sys/types.h> #include <unistd.h> /* Fall-back on getpid for tid if not available. */ -static inline pid_t gettid (void ) +static inline pid_t lttng_gettid (void ) {return getpid (); } +#endif #endif /* _LTTNG_UST_TID_H */ include/usterr-signal-safe.h +1
-1@@ -95,7 +95,7 @@ do { \do { \ sigsafe_print_err(UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" UST_XSTR(__LINE__) ")\n", \ (long )getpid (), \ - (long )gettid (), \ + (long )lttng_gettid (), \ ## args, __func__); \ }while (0 )liblttng-ust/lttng-context-vtid.c +1
-2@@ -63,7 +63,7 @@ pid_t wrapper_getvtid(void) vtid =CMM_LOAD_SHARED (URCU_TLS (cached_vtid));if (caa_unlikely (!vtid)) { - vtid =gettid (); + vtid =lttng_gettid ();CMM_STORE_SHARED (URCU_TLS (cached_vtid), vtid); }return vtid; --2.17.1
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com