Fix: namespace our gettid wrapper 36/220036/2 accepted/tizen_6.0_base accepted/tizen_6.0_base_hotfix accepted/tizen_6.5_base accepted/tizen_7.0_base accepted/tizen_7.0_base_hotfix tizen_6.0_base tizen_6.0_base_hotfix tizen_6.5_base tizen_7.0_base tizen_7.0_base_hotfix accepted/tizen/6.0/base/20201029.111023 accepted/tizen/6.0/base/hotfix/20201102.093401 accepted/tizen/6.5/base/20211028.060354 accepted/tizen/7.0/base/20221116.025837 accepted/tizen/7.0/base/hotfix/20221116.055244 accepted/tizen/base/20200113.070336 accepted/tizen/base/20221115.103714 submit/tizen_6.0_base/20201029.184801 submit/tizen_6.0_base_hotfix/20201030.192501 submit/tizen_6.0_base_hotfix/20201102.162701 submit/tizen_6.5_base/20211028.134101 submit/tizen_base/20200107.062350 tizen_6.0.m2_release tizen_6.5.m2_release tizen_7.0_m2_release
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 3 Jun 2019 19:25:32 +0000 (15:25 -0400)
committerDongkyun Son <dongkyun.s@samsung.com>
Thu, 2 Jan 2020 09:14:44 +0000 (18:14 +0900)
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 <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
(cherry picked from commit 0f029713c868ef3e868d0dc7297455cb737e606f)

Change-Id: I896e5e838e37096edf941ade786bd7a2a8566321

include/lttng/ust-tid.h
include/usterr-signal-safe.h
liblttng-ust/lttng-context-vtid.c

index e669d7e..e637718 100644 (file)
 #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 */
index 1df5ada..d987c1f 100644 (file)
@@ -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)
 
index a213b26..1a0ac44 100644 (file)
@@ -62,7 +62,7 @@ pid_t wrapper_getvtid(void)
 
        vtid = CMM_LOAD_SHARED(URCU_TLS(cached_vtid));
        if (caa_unlikely(!vtid)) {
-               vtid = getpid();
+               vtid = lttng_gettid();
                CMM_STORE_SHARED(URCU_TLS(cached_vtid), vtid);
        }
        return vtid;