Fix: namespace our gettid wrapper
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 3 Jun 2019 19:25:52 +0000 (15:25 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Sep 2019 18:25:02 +0000 (14:25 -0400)
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: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/compat/tid.h
src/common/error.h

index 40f562f9749668f7f1ebbcea4b6e1d0513ca22c0..15f9fdc7a467d5f1b294fdb757cddc1fe297d14f 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_TID_H */
index c90c4ae07a1902d73eb17cc1c7ae90af652fb9a8..3fe742c02fe97bf85b792d989e7ab3e02352c1f2 100644 (file)
@@ -151,11 +151,11 @@ static inline void __lttng_print_check_abort(enum lttng_error_level type)
 /* Three level of debug. Use -v, -vv or -vvv for the levels */
 #define _ERRMSG(msg, type, fmt, args...) __lttng_print(type, msg \
                " - %s [%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" XSTR(__LINE__) ")\n", \
-                       log_add_time(), (long) getpid(), (long) gettid(), ## args, __func__)
+                       log_add_time(), (long) getpid(), (long) lttng_gettid(), ## args, __func__)
 
 #define _ERRMSG_NO_LOC(msg, type, fmt, args...) __lttng_print(type, msg        \
                " - %s [%ld/%ld]: " fmt "\n", \
-                       log_add_time(), (long) getpid(), (long) gettid(), ## args)
+                       log_add_time(), (long) getpid(), (long) lttng_gettid(), ## args)
 
 #define MSG(fmt, args...) \
        __lttng_print(PRINT_MSG, fmt "\n", ## args)
This page took 0.02856 seconds and 4 git commands to generate.