Fix: namespace our gettid wrapper
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 3 Jun 2019 19:25:32 +0000 (15:25 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 3 Jun 2019 21:39:30 +0000 (17:39 -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: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-tid.h
include/usterr-signal-safe.h
liblttng-ust/lttng-context-vtid.c

index e669d7e7d17dac2ff875d847003af0196c08f51c..e637718a3ab603190c7ca4dffbb1b6b9376fd057 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 1df5ada0ff2ec290d4eb5f53a15836a5bb7cb454..d987c1f0a11009788eaf0672450afb0736f61014 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 f28e470a38c91be3e88c7b1d1fcd42c591d73c67..2f721fa00ad18655a700572efbc22979082493a5 100644 (file)
@@ -62,7 +62,7 @@ void vtid_record(struct lttng_ctx_field *field,
                 struct lttng_channel *chan)
 {
        if (caa_unlikely(!URCU_TLS(cached_vtid)))
-               URCU_TLS(cached_vtid) = gettid();
+               URCU_TLS(cached_vtid) = lttng_gettid();
        lib_ring_buffer_align_ctx(ctx, lttng_alignof(URCU_TLS(cached_vtid)));
        chan->ops->event_write(ctx, &URCU_TLS(cached_vtid),
                sizeof(URCU_TLS(cached_vtid)));
@@ -73,7 +73,7 @@ void vtid_get_value(struct lttng_ctx_field *field,
                struct lttng_ctx_value *value)
 {
        if (caa_unlikely(!URCU_TLS(cached_vtid)))
-               URCU_TLS(cached_vtid) = gettid();
+               URCU_TLS(cached_vtid) = lttng_gettid();
        value->u.s64 = URCU_TLS(cached_vtid);
 }
 
This page took 0.026872 seconds and 4 git commands to generate.