httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1138616 - in /httpd/httpd/trunk: CHANGES configure.in docs/manual/mod/core.xml server/log.c
Date Wed, 22 Jun 2011 20:22:24 GMT
Author: sf
Date: Wed Jun 22 20:22:24 2011
New Revision: 1138616

URL: http://svn.apache.org/viewvc?rev=1138616&view=rev
Log:
Add support to ErrorLogFormat for logging the system unique
thread id under Linux

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/configure.in
    httpd/httpd/trunk/docs/manual/mod/core.xml
    httpd/httpd/trunk/server/log.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1138616&r1=1138615&r2=1138616&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Jun 22 20:22:24 2011
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.13
 
+  *) core: Add support to ErrorLogFormat for logging the system unique
+     thread id under Linux. [Stefan Fritsch]
+
   *) event: New AsyncRequestWorkerFactor directive to influence how many
      connections will be accepted per process. [Stefan Fritsch]
 

Modified: httpd/httpd/trunk/configure.in
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/configure.in?rev=1138616&r1=1138615&r2=1138616&view=diff
==============================================================================
--- httpd/httpd/trunk/configure.in (original)
+++ httpd/httpd/trunk/configure.in Wed Jun 22 20:22:24 2011
@@ -446,6 +446,18 @@ fopen64
 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,
+[AC_TRY_RUN(#define _GNU_SOURCE
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+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()])
+fi
+
 dnl check for LDAP support, needed by modules/aaa and modules/ldap
 AP_FIND_LDAP
 

Modified: httpd/httpd/trunk/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/core.xml?rev=1138616&r1=1138615&r2=1138616&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Wed Jun 22 20:22:24 2011
@@ -1322,6 +1322,10 @@ in case of an error</description>
     <tr><td><code>%...T</code></td>
         <td>Thread ID of current thread</td></tr>
 
+    <tr><td><code>%...{g}T</code></td>
+        <td>System unique thread ID of current thread (the same ID as
+            displayed by e.g. <code>top</code>; currently Linux only)</td></tr>
+
     <tr><td><code>%...t</code></td>
         <td>The current time</td></tr>
 

Modified: httpd/httpd/trunk/server/log.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/log.c?rev=1138616&r1=1138615&r2=1138616&view=diff
==============================================================================
--- httpd/httpd/trunk/server/log.c (original)
+++ httpd/httpd/trunk/server/log.c Wed Jun 22 20:22:24 2011
@@ -54,6 +54,11 @@
 #include "util_time.h"
 #include "ap_mpm.h"
 
+#if HAVE_GETTID
+#include <sys/syscall.h>
+#include <sys/types.h>
+#endif
+
 /* we know core's module_index is 0 */
 #undef APLOG_MODULE_INDEX
 #define APLOG_MODULE_INDEX AP_CORE_MODULE_INDEX
@@ -585,7 +590,16 @@ static int log_tid(const ap_errorlog_inf
 {
 #if APR_HAS_THREADS
     int result;
-
+#endif
+#if HAVE_GETTID
+    if (arg && *arg == 'g') {
+        pid_t tid = syscall(SYS_gettid);
+        if (tid == -1)
+            return 0;
+        return apr_snprintf(buf, buflen, "%"APR_PID_T_FMT, tid);
+    }
+#endif
+#if APR_HAS_THREADS
     if (ap_mpm_query(AP_MPMQ_IS_THREADED, &result) == APR_SUCCESS
         && result != AP_MPMQ_NOT_SUPPORTED)
     {



Mime
View raw message