Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 1 | From c45ab69f9428e4d2fc1146301a4546bb2b42c9ae Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 27 Jul 2019 00:25:58 -0700 |
| 4 | Subject: [PATCH] chdeck for gettid API during configure |
| 5 | |
| 6 | glibc 2.30 added gettid syscall wrapper |
| 7 | |
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 9 | --- |
| 10 | configure.in | 2 +- |
| 11 | src/util.h | 2 ++ |
| 12 | 2 files changed, 3 insertions(+), 1 deletion(-) |
| 13 | |
| 14 | diff --git a/configure.in b/configure.in |
| 15 | index 000bb91..d79e6d0 100644 |
| 16 | --- a/configure.in |
| 17 | +++ b/configure.in |
| 18 | @@ -256,7 +256,7 @@ SN_CHECK_DECLS(printf fprintf syslog puts fputs fputc fopen \ |
| 19 | strcasecmp strncasecmp strerror perror socket sendto \ |
| 20 | vsnprintf snprintf strtoul) |
| 21 | |
| 22 | -AC_CHECK_FUNCS([sigaction strlcpy strlcat strerror vswprintf wprintf memrchr inet_ntop]) |
| 23 | +AC_CHECK_FUNCS([sigaction strlcpy strlcat strerror vswprintf wprintf memrchr inet_ntop gettid]) |
| 24 | |
| 25 | AC_CHECK_FUNC([snprintf],[have_snprintf="yes"],[have_snprintf="no"]) |
| 26 | AM_CONDITIONAL(BUILD_SNPRINTF, test "x$have_snprintf" != "xyes") |
| 27 | diff --git a/src/util.h b/src/util.h |
| 28 | index 6880906..c310b83 100644 |
| 29 | --- a/src/util.h |
| 30 | +++ b/src/util.h |
| 31 | @@ -374,6 +374,7 @@ static inline int IsEmptyStr(const char *str) |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | +#if !HAVE_GETTID |
| 36 | static inline pid_t gettid(void) |
| 37 | { |
| 38 | #if defined(LINUX) && defined(SYS_gettid) |
| 39 | @@ -382,5 +383,6 @@ static inline pid_t gettid(void) |
| 40 | return getpid(); |
| 41 | #endif |
| 42 | } |
| 43 | +#endif |
| 44 | |
| 45 | #endif /*__UTIL_H__*/ |
| 46 | -- |
| 47 | 2.22.0 |
| 48 | |