Commit e0e8b4cd authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

Add support to ErrorLogFormat for logging the system unique

thread id under Linux


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1138616 13f79535-47bb-0310-9956-ffa450edef68
parent b1a7483b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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]

+12 −0
Original line number Diff line number Diff line
@@ -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

+4 −0
Original line number Diff line number Diff line
@@ -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>

+15 −1
Original line number Diff line number Diff line
@@ -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_info *info, const char *arg,
{
#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)
    {