]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
core: log_tid support on FreeBSD.
authorYann Ylavic <ylavic@apache.org>
Thu, 16 Jun 2022 14:25:05 +0000 (14:25 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 16 Jun 2022 14:25:05 +0000 (14:25 +0000)
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

configure.in
server/log.c

index 78bcf9baff4b2d28d00a1fc733d3ac9a70f23aa2..dbc9ea8536b97cc4d06a747a2a3778ef0ca361d4 100644 (file)
@@ -474,6 +474,7 @@ unistd.h \
 sys/socket.h \
 pwd.h \
 grp.h \
+pthread_np.h \
 strings.h \
 sys/prctl.h \
 sys/procctl.h \
@@ -535,6 +536,7 @@ initgroups \
 bindprocessor \
 prctl \
 procctl \
+pthread_getthreadid_np \
 timegm \
 getpgid \
 fopen64 \
index 89e1679fed69ee624a99a7c8c96d17f4272cbaf7..6295f1a89c458b07dbe6046468ac3682e558b728 100644 (file)
 #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