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]
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
<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>
#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
{
#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)
{