diff options
author | Joe Orton <jorton@apache.org> | 2020-07-07 15:40:15 +0200 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2020-07-07 15:40:15 +0200 |
commit | 33d99cf67f4bbdce86be0a0fdbb3d26f18e0f2a7 (patch) | |
tree | 6f4ae663614add01978478726de007b673219102 /server/log.c | |
parent | Bump the logno. (diff) | |
download | apache2-33d99cf67f4bbdce86be0a0fdbb3d26f18e0f2a7.tar.xz apache2-33d99cf67f4bbdce86be0a0fdbb3d26f18e0f2a7.zip |
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
Diffstat (limited to 'server/log.c')
-rw-r--r-- | server/log.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/log.c b/server/log.c index 9ebbebd87a..1a32ebb2d9 100644 --- a/server/log.c +++ b/server/log.c @@ -56,7 +56,7 @@ #include "ap_provider.h" #include "ap_listen.h" -#if HAVE_GETTID +#ifdef HAVE_SYS_GETTID #include <sys/syscall.h> #include <sys/types.h> #endif @@ -538,14 +538,18 @@ static int log_tid(const ap_errorlog_info *info, const char *arg, #if APR_HAS_THREADS int result; #endif -#if HAVE_GETTID +#if defined(HAVE_GETTID) || defined(HAVE_SYS_GETTID) if (arg && *arg == 'g') { +#ifdef HAVE_GETTID + pid_t tid = gettid(); +#else pid_t tid = syscall(SYS_gettid); +#endif if (tid == -1) return 0; return apr_snprintf(buf, buflen, "%"APR_PID_T_FMT, tid); } -#endif +#endif /* HAVE_GETTID || HAVE_SYS_GETTID */ #if APR_HAS_THREADS if (ap_mpm_query(AP_MPMQ_IS_THREADED, &result) == APR_SUCCESS && result != AP_MPMQ_NOT_SUPPORTED) |