From 33d99cf67f4bbdce86be0a0fdbb3d26f18e0f2a7 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Tue, 7 Jul 2020 13:40:15 +0000 Subject: Check for and use gettid() directly if available; glibc 2.30 and later provides a wrapper for the system call: * configure.in: Check for gettid() and define HAVE_SYS_GETTID if gettid() is only usable via syscall(). * server/log.c (log_tid): Use gettid() directly if available. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879591 13f79535-47bb-0310-9956-ffa450edef68 --- configure.in | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'configure.in') diff --git a/configure.in b/configure.in index 423d58d4b9..60cbf7b7f8 100644 --- a/configure.in +++ b/configure.in @@ -535,22 +535,26 @@ prctl \ timegm \ getpgid \ fopen64 \ -getloadavg +getloadavg \ +gettid ) dnl confirm that a void pointer is large enough to store a long integer APACHE_CHECK_VOID_PTR_LEN -AC_CACHE_CHECK([for gettid()], ac_cv_gettid, +if test $ac_cv_func_gettid = no; then + # On Linux before glibc 2.30, gettid() is only usable via syscall() + AC_CACHE_CHECK([for gettid() via syscall], ap_cv_gettid, [AC_TRY_RUN(#define _GNU_SOURCE #include #include #include int main(int argc, char **argv) { pid_t t = syscall(SYS_gettid); return t == -1 ? 1 : 0; }, -[ac_cv_gettid=yes], [ac_cv_gettid=no], [ac_cv_gettid=no])]) -if test "$ac_cv_gettid" = "yes"; then - AC_DEFINE(HAVE_GETTID, 1, [Define if you have gettid()]) + [ap_cv_gettid=yes], [ap_cv_gettid=no], [ap_cv_gettid=no])]) + if test "$ap_cv_gettid" = "yes"; then + AC_DEFINE(HAVE_SYS_GETTID, 1, [Define if you have gettid() via syscall()]) + fi fi dnl ## Check for the tm_gmtoff field in struct tm to get the timezone diffs -- cgit v1.2.1