summaryrefslogtreecommitdiffstats
path: root/server/log.c
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2022-06-16 16:25:05 +0200
committerYann Ylavic <ylavic@apache.org>2022-06-16 16:25:05 +0200
commitc4234718917924ac696f66dc71ef2b7b4e6e68cc (patch)
treeaf7117234138af1b8119bbb3a6f73036e7fcce11 /server/log.c
parentmpm_prefork: Do not access the POD in ONE_PROCESS mode. (diff)
downloadapache2-c4234718917924ac696f66dc71ef2b7b4e6e68cc.tar.xz
apache2-c4234718917924ac696f66dc71ef2b7b4e6e68cc.zip
core: log_tid support on FreeBSD.
Use pthread_getthreadid_np() when available. BZ: 65835 Submitted by: David CARLIER <devnexen gmail.com> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901975 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/log.c')
-rw-r--r--server/log.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/log.c b/server/log.c
index 89e1679fed..6295f1a89c 100644
--- a/server/log.c
+++ b/server/log.c
@@ -61,6 +61,10 @@
#include <sys/types.h>
#endif
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+
/* we know core's module_index is 0 */
#undef APLOG_MODULE_INDEX
#define APLOG_MODULE_INDEX AP_CORE_MODULE_INDEX
@@ -538,10 +542,12 @@ static int log_tid(const ap_errorlog_info *info, const char *arg,
#if APR_HAS_THREADS
int result;
#endif
-#if defined(HAVE_GETTID) || defined(HAVE_SYS_GETTID)
+#if defined(HAVE_GETTID) || defined(HAVE_SYS_GETTID) || defined(HAVE_PTHREAD_GETTHREADID_NP)
if (arg && *arg == 'g') {
-#ifdef HAVE_GETTID
+#if defined(HAVE_GETTID)
pid_t tid = gettid();
+#elif defined(HAVE_PTHREAD_GETTHREADID_NP)
+ pid_t tid = pthread_getthreadid_np();
#else
pid_t tid = syscall(SYS_gettid);
#endif