From: Michael Jeanson Date: Mon, 3 Jun 2019 19:25:52 +0000 (-0400) Subject: Fix: namespace our gettid wrapper X-Git-Tag: v2.10.8~18 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=743770bbd5556f893d55f402eeae98bee1128ef2;p=lttng-tools.git Fix: namespace our gettid wrapper 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 Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h index 40f562f97..15f9fdc7a 100644 --- a/src/common/compat/tid.h +++ b/src/common/compat/tid.h @@ -29,23 +29,25 @@ #include #endif -#if defined(_syscall0) -_syscall0(pid_t, gettid) -#elif defined(__NR_gettid) +#if defined(__NR_gettid) + #include -static inline pid_t gettid(void) +static inline pid_t lttng_gettid(void) { return syscall(__NR_gettid); } + #else + #include #include /* 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 */ diff --git a/src/common/error.h b/src/common/error.h index c90c4ae07..3fe742c02 100644 --- a/src/common/error.h +++ b/src/common/error.h @@ -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)