* Re: [PATCH lttng-tools] Fix: namespace our gettid wrapper
[not found] <20190603192552.19061-1-mjeanson@efficios.com>
@ 2019-09-05 21:05 ` Jérémie Galarneau
0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2019-09-05 21:05 UTC (permalink / raw)
To: Michael Jeanson; +Cc: lttng-dev, jgalar
Merged in master, stable-2.11, and stable-2.10.
Thanks!
Jérémie
On Mon, Jun 03, 2019 at 03:25:52PM -0400, Michael Jeanson 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 <mjeanson@efficios.com>
> ---
> src/common/compat/tid.h | 12 +++++++-----
> src/common/error.h | 4 ++--
> 2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h
> index 40f562f9..15f9fdc7 100644
> --- a/src/common/compat/tid.h
> +++ b/src/common/compat/tid.h
> @@ -29,23 +29,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_TID_H */
> diff --git a/src/common/error.h b/src/common/error.h
> index c90c4ae0..3fe742c0 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)
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH lttng-tools] Fix: namespace our gettid wrapper
@ 2019-06-03 19:25 Michael Jeanson
0 siblings, 0 replies; 2+ messages in thread
From: Michael Jeanson @ 2019-06-03 19:25 UTC (permalink / raw)
To: lttng-dev; +Cc: jgalar
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>
---
src/common/compat/tid.h | 12 +++++++-----
src/common/error.h | 4 ++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h
index 40f562f9..15f9fdc7 100644
--- a/src/common/compat/tid.h
+++ b/src/common/compat/tid.h
@@ -29,23 +29,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_TID_H */
diff --git a/src/common/error.h b/src/common/error.h
index c90c4ae0..3fe742c0 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)
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-05 21:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20190603192552.19061-1-mjeanson@efficios.com>
2019-09-05 21:05 ` [PATCH lttng-tools] Fix: namespace our gettid wrapper Jérémie Galarneau
2019-06-03 19:25 Michael Jeanson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).