From mboxrd@z Thu Jan 1 00:00:00 1970 From: c.briere@samsung.com (Charles Briere) Date: Mon, 27 Oct 2014 20:49:28 +0000 Subject: [lttng-dev] [PATCH lttng-tools 06/24] Fix : Do not redeclare gettid if found In-Reply-To: <1414442926-14381-1-git-send-email-c.briere@samsung.com> References: <1414442926-14381-1-git-send-email-c.briere@samsung.com> Message-ID: <1414442926-14381-7-git-send-email-c.briere@samsung.com> From: Charles Briere Signed-off-by: Charles Briere --- configure.ac | 2 ++ src/common/compat/tid.h | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 8703284..3460f98 100644 --- a/configure.ac +++ b/configure.ac @@ -213,6 +213,8 @@ AC_CHECK_DECL([cmm_smp_mb__before_uatomic_or], [], [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include ]] ) +AC_CHECK_DECLS([gettid], [], [], [[#include ]]) + # Check kmod library AC_ARG_WITH(kmod-prefix, AS_HELP_STRING([--with-kmod-prefix=PATH], diff --git a/src/common/compat/tid.h b/src/common/compat/tid.h index 40f562f..b420914 100644 --- a/src/common/compat/tid.h +++ b/src/common/compat/tid.h @@ -29,15 +29,16 @@ #include #endif -#if defined(_syscall0) +#if !HAVE_DECL_GETTID +# if defined(_syscall0) _syscall0(pid_t, gettid) -#elif defined(__NR_gettid) +# elif defined(__NR_gettid) #include static inline pid_t gettid(void) { return syscall(__NR_gettid); } -#else +# else #include #include @@ -46,6 +47,8 @@ static inline pid_t gettid(void) { return getpid(); } -#endif + +# endif +#endif /* !HAVE_DECL_GETTID */ #endif /* LTTNG_TID_H */ -- 2.1.2