summaryrefslogtreecommitdiff
path: root/2.2
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2007-05-18 08:37:35 +0000
committerChristian Heim <phreak@gentoo.org>2007-05-18 08:37:35 +0000
commitc2fc8f90c9b7feee8f799956a315a060d4c2b404 (patch)
tree2662b7a5e11e50c5f8af1b4e05d8e5ba7b484f24 /2.2
parentRemoving the remainders of clean_env. (diff)
downloadapache-c2fc8f90c9b7feee8f799956a315a060d4c2b404.tar.gz
apache-c2fc8f90c9b7feee8f799956a315a060d4c2b404.tar.bz2
apache-c2fc8f90c9b7feee8f799956a315a060d4c2b404.zip
Updating the MPM patches for peruser and itk.
Diffstat (limited to '2.2')
-rw-r--r--2.2/patches/20_all_peruser_0.2.1.patch (renamed from 2.2/patches/20_all_peruser_0.2.0.patch)321
-rw-r--r--2.2/patches/21_all_itk-20070425-00.patch (renamed from 2.2/patches/21_all_itk-20061030-01.patch)277
2 files changed, 349 insertions, 249 deletions
diff --git a/2.2/patches/20_all_peruser_0.2.0.patch b/2.2/patches/20_all_peruser_0.2.1.patch
index d0b5091..93d2028 100644
--- a/2.2/patches/20_all_peruser_0.2.0.patch
+++ b/2.2/patches/20_all_peruser_0.2.1.patch
@@ -1,6 +1,6 @@
-diff -NurpP httpd-2.2.0/server/mpm/config.m4 httpd-2.2.0-peruser/server/mpm/config.m4
---- httpd-2.2.0/server/mpm/config.m4 2005-10-30 18:05:26.000000000 +0100
-+++ httpd-2.2.0-peruser/server/mpm/config.m4 2006-03-06 18:56:50.142919750 +0100
+diff -Nur httpd-2.2.3/server/mpm/config.m4 httpd-2.2.3-new/server/mpm/config.m4
+--- httpd-2.2.3/server/mpm/config.m4 2005-10-30 10:05:26.000000000 -0700
++++ httpd-2.2.3-new/server/mpm/config.m4 2007-02-05 06:47:03.000000000 -0700
@@ -1,7 +1,7 @@
AC_MSG_CHECKING(which MPM to use)
AC_ARG_WITH(mpm,
@@ -10,35 +10,35 @@ diff -NurpP httpd-2.2.0/server/mpm/config.m4 httpd-2.2.0-peruser/server/mpm/conf
APACHE_MPM=$withval
],[
if test "x$APACHE_MPM" = "x"; then
-@@ -23,7 +23,7 @@ ap_mpm_is_threaded ()
+@@ -23,7 +23,7 @@
ap_mpm_is_experimental ()
{
- if test "$apache_cv_mpm" = "event" ; then
-+ if test "$apache_cv_mpm" = "event" -o "$apache_cv_mpm" = "peruser"; then
++ if test "$apache_cv_mpm" = "event" -o "$apache_cv_mpm" = "peruser" ; then
return 0
else
return 1
-diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/config.m4 httpd-2.2.0-peruser/server/mpm/experimental/peruser/config.m4
---- httpd-2.2.0/server/mpm/experimental/peruser/config.m4 1970-01-01 01:00:00.000000000 +0100
-+++ httpd-2.2.0-peruser/server/mpm/experimental/peruser/config.m4 2006-03-06 18:56:19.028975250 +0100
-@@ -0,0 +1,3 @@
-+if test "$MPM_NAME" = "peruser" ; then
-+ APACHE_FAST_OUTPUT(server/mpm/experimental/$MPM_NAME/Makefile)
-+fi
-diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/Makefile.in httpd-2.2.0-peruser/server/mpm/experimental/peruser/Makefile.in
---- httpd-2.2.0/server/mpm/experimental/peruser/Makefile.in 1970-01-01 01:00:00.000000000 +0100
-+++ httpd-2.2.0-peruser/server/mpm/experimental/peruser/Makefile.in 2006-03-06 18:56:19.028975250 +0100
+diff -Nur httpd-2.2.3/server/mpm/experimental/peruser/Makefile.in httpd-2.2.3-new/server/mpm/experimental/peruser/Makefile.in
+--- httpd-2.2.3/server/mpm/experimental/peruser/Makefile.in 1969-12-31 17:00:00.000000000 -0700
++++ httpd-2.2.3-new/server/mpm/experimental/peruser/Makefile.in 2007-02-05 06:47:03.000000000 -0700
@@ -0,0 +1,5 @@
+
+LTLIBRARY_NAME = libperuser.la
+LTLIBRARY_SOURCES = peruser.c
+
+include $(top_srcdir)/build/ltlib.mk
-diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/mpm_default.h httpd-2.2.0-peruser/server/mpm/experimental/peruser/mpm_default.h
---- httpd-2.2.0/server/mpm/experimental/peruser/mpm_default.h 1970-01-01 01:00:00.000000000 +0100
-+++ httpd-2.2.0-peruser/server/mpm/experimental/peruser/mpm_default.h 2006-03-06 18:56:19.032975500 +0100
-@@ -0,0 +1,110 @@
+diff -Nur httpd-2.2.3/server/mpm/experimental/peruser/config.m4 httpd-2.2.3-new/server/mpm/experimental/peruser/config.m4
+--- httpd-2.2.3/server/mpm/experimental/peruser/config.m4 1969-12-31 17:00:00.000000000 -0700
++++ httpd-2.2.3-new/server/mpm/experimental/peruser/config.m4 2007-02-05 06:47:03.000000000 -0700
+@@ -0,0 +1,3 @@
++if test "$MPM_NAME" = "peruser" ; then
++ APACHE_FAST_OUTPUT(server/mpm/experimental/$MPM_NAME/Makefile)
++fi
+diff -Nur httpd-2.2.3/server/mpm/experimental/peruser/mpm.h httpd-2.2.3-new/server/mpm/experimental/peruser/mpm.h
+--- httpd-2.2.3/server/mpm/experimental/peruser/mpm.h 1969-12-31 17:00:00.000000000 -0700
++++ httpd-2.2.3-new/server/mpm/experimental/peruser/mpm.h 2007-02-05 06:47:03.000000000 -0700
+@@ -0,0 +1,103 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
@@ -97,62 +97,55 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/mpm_default.h httpd-2.2.
+ * University of Illinois, Urbana-Champaign.
+ */
+
-+#ifndef APACHE_MPM_DEFAULT_H
-+#define APACHE_MPM_DEFAULT_H
-+
-+/* Number of processors to spawn off for each ServerEnvironment by default */
-+
-+#ifndef DEFAULT_START_PROCESSORS
-+#define DEFAULT_START_PROCESSORS 0
-+#endif
-+
-+/* Minimum number of running processors per ServerEnvironment */
-+
-+#ifndef DEFAULT_MIN_PROCESSORS
-+#define DEFAULT_MIN_PROCESSORS 0
-+#endif
++#include "httpd.h"
++#include "mpm_default.h"
++#include "scoreboard.h"
++#include "unixd.h"
+
-+/* Minimum --- fewer than this, and more will be created */
++#ifndef APACHE_MPM_PERUSER_H
++#define APACHE_MPM_PERUSER_H
+
-+#ifndef DEFAULT_MIN_FREE_PROCESSORS
-+#define DEFAULT_MIN_FREE_PROCESSORS 2
-+#endif
++#define PERUSER_MPM
+
-+/* Maximum processors per ServerEnvironment */
++#define MPM_NAME "Peruser"
+
-+#ifndef DEFAULT_MAX_PROCESSORS
-+#define DEFAULT_MAX_PROCESSORS 10
-+#endif
++#define AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
++#define AP_MPM_WANT_WAIT_OR_TIMEOUT
++#define AP_MPM_WANT_PROCESS_CHILD_STATUS
++#define AP_MPM_WANT_SET_PIDFILE
++#define AP_MPM_WANT_SET_SCOREBOARD
++#define AP_MPM_WANT_SET_LOCKFILE
++#define AP_MPM_WANT_SET_MAX_REQUESTS
++#define AP_MPM_WANT_SET_COREDUMPDIR
++#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
++#define AP_MPM_WANT_SIGNAL_SERVER
++#define AP_MPM_WANT_SET_MAX_MEM_FREE
++#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
+
-+/* File used for accept locking, when we use a file */
-+#ifndef DEFAULT_LOCKFILE
-+#define DEFAULT_LOCKFILE DEFAULT_REL_RUNTIMEDIR "/accept.lock"
-+#endif
++#define AP_MPM_USES_POD 1
++#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
++#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)
++#define MPM_ACCEPT_FUNC unixd_accept
+
-+/* Where the main/parent process's pid is logged */
-+#ifndef DEFAULT_PIDLOG
-+#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
-+#endif
++extern int ap_threads_per_child;
++extern int ap_max_daemons_limit;
++extern server_rec *ap_server_conf;
+
-+/*
-+ * Interval, in microseconds, between scoreboard maintenance.
-+ */
-+#ifndef SCOREBOARD_MAINTENANCE_INTERVAL
-+#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000
-+#endif
++/* Table of child status */
++#define SERVER_DEAD 0
++#define SERVER_DYING 1
++#define SERVER_ALIVE 2
+
-+/* Number of requests to try to handle in a single process. If <= 0,
-+ * the children don't die off.
-+ */
-+#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
-+#define DEFAULT_MAX_REQUESTS_PER_CHILD 10000
-+#endif
++typedef struct ap_ctable {
++ pid_t pid;
++ unsigned char status;
++} ap_ctable;
+
-+#endif /* AP_MPM_DEFAULT_H */
-diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/mpm.h httpd-2.2.0-peruser/server/mpm/experimental/peruser/mpm.h
---- httpd-2.2.0/server/mpm/experimental/peruser/mpm.h 1970-01-01 01:00:00.000000000 +0100
-+++ httpd-2.2.0-peruser/server/mpm/experimental/peruser/mpm.h 2006-03-06 18:56:19.032975500 +0100
-@@ -0,0 +1,103 @@
++#endif /* APACHE_MPM_PERUSER_H */
+diff -Nur httpd-2.2.3/server/mpm/experimental/peruser/mpm_default.h httpd-2.2.3-new/server/mpm/experimental/peruser/mpm_default.h
+--- httpd-2.2.3/server/mpm/experimental/peruser/mpm_default.h 1969-12-31 17:00:00.000000000 -0700
++++ httpd-2.2.3-new/server/mpm/experimental/peruser/mpm_default.h 2007-02-05 06:47:03.000000000 -0700
+@@ -0,0 +1,110 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
@@ -211,55 +204,62 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/mpm.h httpd-2.2.0-peruse
+ * University of Illinois, Urbana-Champaign.
+ */
+
-+#include "httpd.h"
-+#include "mpm_default.h"
-+#include "scoreboard.h"
-+#include "unixd.h"
++#ifndef APACHE_MPM_DEFAULT_H
++#define APACHE_MPM_DEFAULT_H
+
-+#ifndef APACHE_MPM_PERUSER_H
-+#define APACHE_MPM_PERUSER_H
++/* Number of processors to spawn off for each ServerEnvironment by default */
+
-+#define PERUSER_MPM
++#ifndef DEFAULT_START_PROCESSORS
++#define DEFAULT_START_PROCESSORS 0
++#endif
+
-+#define MPM_NAME "Peruser"
++/* Minimum number of running processors per ServerEnvironment */
+
-+#define AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
-+#define AP_MPM_WANT_WAIT_OR_TIMEOUT
-+#define AP_MPM_WANT_PROCESS_CHILD_STATUS
-+#define AP_MPM_WANT_SET_PIDFILE
-+#define AP_MPM_WANT_SET_SCOREBOARD
-+#define AP_MPM_WANT_SET_LOCKFILE
-+#define AP_MPM_WANT_SET_MAX_REQUESTS
-+#define AP_MPM_WANT_SET_COREDUMPDIR
-+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
-+#define AP_MPM_WANT_SIGNAL_SERVER
-+#define AP_MPM_WANT_SET_MAX_MEM_FREE
-+#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
++#ifndef DEFAULT_MIN_PROCESSORS
++#define DEFAULT_MIN_PROCESSORS 0
++#endif
+
-+#define AP_MPM_USES_POD 1
-+#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
-+#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)
-+#define MPM_ACCEPT_FUNC unixd_accept
++/* Minimum --- fewer than this, and more will be created */
+
-+extern int ap_threads_per_child;
-+extern int ap_max_daemons_limit;
-+extern server_rec *ap_server_conf;
++#ifndef DEFAULT_MIN_FREE_PROCESSORS
++#define DEFAULT_MIN_FREE_PROCESSORS 2
++#endif
+
-+/* Table of child status */
-+#define SERVER_DEAD 0
-+#define SERVER_DYING 1
-+#define SERVER_ALIVE 2
++/* Maximum processors per ServerEnvironment */
+
-+typedef struct ap_ctable {
-+ pid_t pid;
-+ unsigned char status;
-+} ap_ctable;
++#ifndef DEFAULT_MAX_PROCESSORS
++#define DEFAULT_MAX_PROCESSORS 10
++#endif
+
-+#endif /* APACHE_MPM_PERUSER_H */
-diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-peruser/server/mpm/experimental/peruser/peruser.c
---- httpd-2.2.0/server/mpm/experimental/peruser/peruser.c 1970-01-01 01:00:00.000000000 +0100
-+++ httpd-2.2.0-peruser/server/mpm/experimental/peruser/peruser.c 2006-03-06 18:56:19.036975750 +0100
-@@ -0,0 +1,2935 @@
++/* File used for accept locking, when we use a file */
++#ifndef DEFAULT_LOCKFILE
++#define DEFAULT_LOCKFILE DEFAULT_REL_RUNTIMEDIR "/accept.lock"
++#endif
++
++/* Where the main/parent process's pid is logged */
++#ifndef DEFAULT_PIDLOG
++#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid"
++#endif
++
++/*
++ * Interval, in microseconds, between scoreboard maintenance.
++ */
++#ifndef SCOREBOARD_MAINTENANCE_INTERVAL
++#define SCOREBOARD_MAINTENANCE_INTERVAL 1000000
++#endif
++
++/* Number of requests to try to handle in a single process. If <= 0,
++ * the children don't die off.
++ */
++#ifndef DEFAULT_MAX_REQUESTS_PER_CHILD
++#define DEFAULT_MAX_REQUESTS_PER_CHILD 10000
++#endif
++
++#endif /* AP_MPM_DEFAULT_H */
+diff -Nur httpd-2.2.3/server/mpm/experimental/peruser/peruser.c httpd-2.2.3-new/server/mpm/experimental/peruser/peruser.c
+--- httpd-2.2.3/server/mpm/experimental/peruser/peruser.c 1969-12-31 17:00:00.000000000 -0700
++++ httpd-2.2.3-new/server/mpm/experimental/peruser/peruser.c 2007-02-05 07:16:52.000000000 -0700
+@@ -0,0 +1,3006 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
@@ -359,6 +359,7 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+#include "ap_mmn.h"
+#include "apr_poll.h"
+#include "util_ebcdic.h"
++#include "mod_status.h"
+
+#ifdef HAVE_BSTRING_H
+#include <bstring.h> /* for IRIX, FD_SET calls bzero() */
@@ -466,6 +467,7 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+static int ap_max_processors=DEFAULT_MAX_PROCESSORS;
+static int ap_daemons_limit=0; /* MaxClients */
+static int expire_timeout=1800;
++static int idle_timeout=900;
+static int server_limit = DEFAULT_SERVER_LIMIT;
+static int first_server_limit;
+static int changed_limit_at_restart;
@@ -1148,12 +1150,6 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ processor->status = CHILD_STATUS_STARTING;
+ }
+
-+ while (processor->status != CHILD_STATUS_ACTIVE)
-+ {
-+ _DBG("Waiting for child #%d...", processor->id);
-+ sleep(1);
-+ }
-+
+ _DBG("Writing message to %d, passing sock_fd: %d", processor->senv->output, sock_fd);
+ _DBG("header_len=%d headers=\"%s\"", header_len, h.headers);
+ _DBG("body_len=%d body=\"%s\"", body_len, body);
@@ -1193,12 +1189,13 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ current_conn = ap_run_create_connection(p, ap_server_conf, sock, conn_id,
+ sbh, bucket_alloc);
+ _DBG("Looking up the right vhost");
-+ ap_update_vhost_given_ip(current_conn);
-+ _DBG("Base server is %s, name based vhosts %s", current_conn->base_server->server_hostname,
++ if (current_conn) {
++ ap_update_vhost_given_ip(current_conn);
++ _DBG("Base server is %s, name based vhosts %s", current_conn->base_server->server_hostname,
+ current_conn->vhost_lookup_data ? "on" : "off");
-+
++ }
+
-+ if (!current_conn->vhost_lookup_data && CHILD_INFO_TABLE[my_child_num].type == CHILD_TYPE_MULTIPLEXER) {
++ if (current_conn && !current_conn->vhost_lookup_data && CHILD_INFO_TABLE[my_child_num].type == CHILD_TYPE_MULTIPLEXER) {
+ _DBG("We are not using name based vhosts, we'll directly pass the socket.");
+
+ sconf = PERUSER_SERVER_CONF(current_conn->base_server->module_config);
@@ -2231,6 +2228,20 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+#define MAX_SPAWN_RATE (32)
+#endif
+static int hold_off_on_exponential_spawning;
++static int total_processes(int child_num)
++{
++ int i, total;
++ for(i = 0, total = 0; i < NUM_CHILDS; ++i)
++ {
++ if(CHILD_INFO_TABLE[i].senv == CHILD_INFO_TABLE[child_num].senv &&
++ (!(CHILD_INFO_TABLE[i].type == CHILD_TYPE_PROCESSOR &&
++ CHILD_INFO_TABLE[i].status == CHILD_STATUS_STANDBY)))
++ {
++ total++;
++ }
++ }
++ return total;
++}
+
+static void perform_idle_server_maintenance(apr_pool_t *p)
+{
@@ -2248,12 +2259,14 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ if(CHILD_INFO_TABLE[i].status == CHILD_STATUS_STARTING)
+ make_child(ap_server_conf, i);
+ }
-+ else if(expire_timeout > 0 &&
-+ (CHILD_INFO_TABLE[i].type == CHILD_TYPE_PROCESSOR ||
-+ CHILD_INFO_TABLE[i].type == CHILD_TYPE_WORKER) &&
-+ ap_scoreboard_image->parent[i].pid > 1 &&
-+ ap_scoreboard_image->servers[i][0].status != SERVER_DEAD &&
-+ apr_time_sec(now - ap_scoreboard_image->servers[i][0].last_used) > expire_timeout)
++ else if(((CHILD_INFO_TABLE[i].type == CHILD_TYPE_PROCESSOR ||
++ CHILD_INFO_TABLE[i].type == CHILD_TYPE_WORKER) &&
++ ap_scoreboard_image->parent[i].pid > 1) &&
++ (idle_processors (i) > 1 || total_processes (i) == 1) && (
++ (expire_timeout > 0 && ap_scoreboard_image->servers[i][0].status != SERVER_DEAD &&
++ apr_time_sec(now - ap_scoreboard_image->servers[i][0].last_used) > expire_timeout) ||
++ (idle_timeout > 0 && ap_scoreboard_image->servers[i][0].status == SERVER_READY &&
++ apr_time_sec(now - ap_scoreboard_image->servers[i][0].last_used) > idle_timeout)))
+ {
+ CHILD_INFO_TABLE[i].pid = 0;
+ CHILD_INFO_TABLE[i].status = CHILD_STATUS_STANDBY;
@@ -2266,12 +2279,12 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ CHILD_INFO_TABLE[i].type = CHILD_TYPE_UNKNOWN;
+ CHILD_INFO_TABLE[i].sock_fd = -3; /* -1 and -2 are taken */
+ }
-+
+ if(kill(ap_scoreboard_image->parent[i].pid, SIGTERM) == -1)
+ {
+ ap_log_error(APLOG_MARK, APLOG_WARNING, errno,
+ ap_server_conf, "kill SIGTERM");
+ }
++
+
+ ap_update_child_status_from_indexes(i, 0, SERVER_DEAD, NULL);
+ }
@@ -2453,8 +2466,8 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ }
+#if APR_HAS_OTHER_CHILD
+ }
-+ else if (apr_proc_other_child_alert(&pid, APR_OC_REASON_DEATH, status) == 0) {
-+ _DBG("APR_HAS_OTHER_CHILD, apparently", 0);
++ else if (apr_proc_other_child_alert(&pid, APR_OC_REASON_DEATH, status) == APR_SUCCESS) {
++ _DBG("Already handled", 0);
+ /* handled */
+#endif
+ }
@@ -2899,6 +2912,49 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ return OK;
+}
+
++static int peruser_status_hook(request_rec *r, int flags)
++{
++ int x;
++ server_env_t *senv;
++
++ if (flags & AP_STATUS_SHORT)
++ return OK;
++
++ ap_rputs("<hr>\n", r);
++ ap_rputs("<h2>peruser status</h2>\n", r);
++ ap_rputs("<table border=\"0\">\n", r);
++ ap_rputs("<tr><td>ID</td><td>PID</td><td>STATUS</td><td>TYPE</td><td>UID</td>"
++ "<td>GID</td><td>CHROOT</td><td>INPUT</td>"
++ "<td>OUTPUT</td><td>SOCK_FD</td>"
++ "<td>TOTAL PROCESSORS</td><td>MAX PROCESSORS</td>"
++ "<td>IDLE PROCESSORS</td><td>MIN FREE PROCESSORS</td></tr>\n", r);
++ for (x = 0; x < NUM_CHILDS; x++)
++ {
++ senv = CHILD_INFO_TABLE[x].senv;
++ ap_rprintf(r, "<tr><td>%3d</td><td>%5d</td><td>%8s</td><td>%12s</td>"
++ "<td>%4d</td><td>%4d</td><td>%25s</td><td>%5d</td>"
++ "<td>%6d</td><td>%7d</td><td>%d</td><td>%d</td>"
++ "<td>%d</td><td>%d</td></tr>\n",
++ CHILD_INFO_TABLE[x].id,
++ CHILD_INFO_TABLE[x].pid,
++ child_status_string(CHILD_INFO_TABLE[x].status),
++ child_type_string(CHILD_INFO_TABLE[x].type),
++ senv == NULL ? -1 : senv->uid,
++ senv == NULL ? -1 : senv->gid,
++ senv == NULL ? NULL : senv->chroot,
++ senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->input,
++ senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->output,
++ CHILD_INFO_TABLE[x].sock_fd,
++ total_processors(x),
++ senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->max_processors,
++ idle_processors(x),
++ senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->min_free_processors
++ );
++ }
++ ap_rputs("</table>\n", r);
++ return OK;
++}
++
+static void peruser_hooks(apr_pool_t *p)
+{
+ /* The peruser open_logs phase must run before the core's, or stderr
@@ -2926,6 +2982,8 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ APR_HOOK_REALLY_FIRST);
+ ap_hook_process_connection(peruser_process_connection, NULL, NULL,
+ APR_HOOK_REALLY_FIRST);
++
++ APR_OPTIONAL_HOOK(ap, status_hook, peruser_status_hook, NULL, NULL, APR_HOOK_MIDDLE);
+}
+
+/* we define an Processor w/ specific uid/gid */
@@ -3159,6 +3217,17 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ return NULL;
+}
+
++static const char *set_idle_timeout (cmd_parms *cmd, void *dummy, const char *arg) {
++ const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
++ if (err != NULL) {
++ return err;
++ }
++
++ idle_timeout = atoi(arg);
++
++ return NULL;
++}
++
+static const command_rec peruser_cmds[] = {
+UNIX_DAEMON_COMMANDS,
+LISTEN_COMMANDS,
@@ -3176,6 +3245,8 @@ diff -NurpP httpd-2.2.0/server/mpm/experimental/peruser/peruser.c httpd-2.2.0-pe
+ "Maximum value of MaxClients for this run of Apache"),
+AP_INIT_TAKE1("ExpireTimeout", set_expire_timeout, NULL, RSRC_CONF,
+ "Maximum idle time before a child is killed, 0 to disable"),
++AP_INIT_TAKE1("IdleTimeout", set_idle_timeout, NULL, RSRC_CONF,
++ "Maximum time before a child is killed after being idle, 0 to disable"),
+AP_INIT_TAKE23("Multiplexer", cf_Multiplexer, NULL, RSRC_CONF,
+ "Specify an Multiplexer Child configuration."),
+AP_INIT_TAKE23("Processor", cf_Processor, NULL, RSRC_CONF,
diff --git a/2.2/patches/21_all_itk-20061030-01.patch b/2.2/patches/21_all_itk-20070425-00.patch
index 3b10c33..dae5e9a 100644
--- a/2.2/patches/21_all_itk-20061030-01.patch
+++ b/2.2/patches/21_all_itk-20070425-00.patch
@@ -1,7 +1,6 @@
-Index: httpd-2.2.4/server/mpm/config.m4
-===================================================================
---- httpd-2.2.4.orig/server/mpm/config.m4
-+++ httpd-2.2.4/server/mpm/config.m4
+diff -Nur apache2.2.orig/server/mpm/config.m4 apache2.2/server/mpm/config.m4
+--- apache2.2.orig/server/mpm/config.m4 2005-10-30 18:05:26.000000000 +0100
++++ apache2.2/server/mpm/config.m4 2007-04-25 14:23:35.000000000 +0200
@@ -1,7 +1,7 @@
AC_MSG_CHECKING(which MPM to use)
AC_ARG_WITH(mpm,
@@ -11,7 +10,7 @@ Index: httpd-2.2.4/server/mpm/config.m4
APACHE_MPM=$withval
],[
if test "x$APACHE_MPM" = "x"; then
-@@ -23,7 +23,7 @@ ap_mpm_is_threaded ()
+@@ -23,7 +23,7 @@
ap_mpm_is_experimental ()
{
@@ -20,38 +19,29 @@ Index: httpd-2.2.4/server/mpm/config.m4
return 0
else
return 1
-@@ -63,6 +63,8 @@ MPM_NAME=$apache_cv_mpm
- if ap_mpm_is_experimental; then
- AC_MSG_WARN(You have selected an EXPERIMENTAL MPM. Be warned!)
- MPM_SUBDIR_NAME=experimental/$MPM_NAME
-+
-+ AC_CHECK_LIB(cap, cap_init)
+@@ -66,6 +66,11 @@
else
MPM_SUBDIR_NAME=$MPM_NAME
fi
-Index: httpd-2.2.4/server/mpm/experimental/itk/Makefile.in
-===================================================================
---- /dev/null
-+++ httpd-2.2.4/server/mpm/experimental/itk/Makefile.in
-@@ -0,0 +1,5 @@
+
-+LTLIBRARY_NAME = libitk.la
-+LTLIBRARY_SOURCES = itk.c
++if "$apache_cv_mpm" = "itk" ; then
++ AC_CHECK_LIB(cap, cap_init)
++fi
+
-+include $(top_srcdir)/build/ltlib.mk
-Index: httpd-2.2.4/server/mpm/experimental/itk/config.m4
-===================================================================
---- /dev/null
-+++ httpd-2.2.4/server/mpm/experimental/itk/config.m4
+ MPM_DIR=server/mpm/$MPM_SUBDIR_NAME
+ MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la
+
+diff -Nur apache2.2.orig/server/mpm/experimental/itk/config.m4 apache2.2/server/mpm/experimental/itk/config.m4
+--- apache2.2.orig/server/mpm/experimental/itk/config.m4 1970-01-01 01:00:00.000000000 +0100
++++ apache2.2/server/mpm/experimental/itk/config.m4 2007-04-25 14:23:35.000000000 +0200
@@ -0,0 +1,3 @@
+if test "$MPM_NAME" = "itk" ; then
+ APACHE_FAST_OUTPUT(server/mpm/$MPM_SUBDIR_NAME/Makefile)
+fi
-Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
-===================================================================
---- /dev/null
-+++ httpd-2.2.4/server/mpm/experimental/itk/itk.c
-@@ -0,0 +1,1650 @@
+diff -Nur apache2.2.orig/server/mpm/experimental/itk/itk.c apache2.2/server/mpm/experimental/itk/itk.c
+--- apache2.2.orig/server/mpm/experimental/itk/itk.c 1970-01-01 01:00:00.000000000 +0100
++++ apache2.2/server/mpm/experimental/itk/itk.c 2007-04-25 14:23:35.000000000 +0200
+@@ -0,0 +1,1682 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
@@ -66,8 +56,8 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
-+ *
-+ * Portions copyright 2005-2006 Steinar H. Gunderson <sgunderson@bigfoot.com>.
++ *
++ * Portions copyright 2005-2007 Steinar H. Gunderson <sgunderson@bigfoot.com>.
+ * Licensed under the same terms as the rest of Apache.
+ */
+
@@ -213,6 +203,7 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ gid_t gid;
+ char *username;
+ int max_clients_vhost;
++ int nice_value;
+} itk_server_conf;
+
+module AP_MODULE_DECLARE_DATA mpm_itk_module;
@@ -550,16 +541,17 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ apr_pollset_t *pollset;
+ ap_sb_handle_t *sbh;
+ apr_bucket_alloc_t *bucket_alloc;
++ int last_poll_idx = 0;
++
+#if HAVE_LIBCAP
+ cap_t caps;
+ cap_value_t suidcaps[] = {
+ CAP_SETUID,
-+ CAP_SETGID
++ CAP_SETGID,
++ CAP_SYS_NICE
+ };
+#endif
+
-+ int last_poll_idx = 0;
-+
+ mpm_state = AP_MPMQ_STARTING; /* for benefit of any hooks that run as this
+ * child initializes
+ */
@@ -739,7 +731,7 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ ap_log_error(APLOG_MARK, APLOG_ERR, errno, NULL, "fork: Unable to fork new process");
+ break;
+ case 0: /* child */
-+ apr_proc_mutex_child_init(&accept_mutex, ap_lock_fname, pchild);
++ apr_proc_mutex_child_init(&accept_mutex, ap_lock_fname, pchild);
+ current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd, my_child_num, sbh, bucket_alloc);
+ if (current_conn) {
+ ap_process_connection(current_conn, csd);
@@ -1449,6 +1441,7 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ uid_t wanted_uid;
+ gid_t wanted_gid;
+ const char *wanted_username;
++ int err = 0;
+
+ itk_server_conf *sconf =
+ (itk_server_conf *) ap_get_module_config(r->server->module_config, &mpm_itk_module);
@@ -1472,6 +1465,11 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+
+ strncpy(ap_scoreboard_image->servers[my_child_num][0].vhost, r->server->server_hostname, 31);
+ ap_scoreboard_image->servers[my_child_num][0].vhost[31] = 0;
++
++ if (setpriority(PRIO_PROCESS, 0, sconf->nice_value)) {
++ _DBG("setpriority(): %s", strerror(errno));
++ err = 1;
++ }
+
+ wanted_uid = sconf->uid;
+ wanted_gid = sconf->gid;
@@ -1483,8 +1481,7 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ wanted_username = unixd_config.user_name;
+ }
+
-+ if (wanted_uid != -1 && wanted_gid != -1 && (getuid() != wanted_uid || getgid() != wanted_gid)) {
-+ int err = 0;
++ if (!err && wanted_uid != -1 && wanted_gid != -1 && (getuid() != wanted_uid || getgid() != wanted_gid)) {
+ if (setgid(wanted_gid)) {
+ _DBG("setgid(): %s", strerror(errno));
+ err = 1;
@@ -1495,18 +1492,18 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ _DBG("setuid(): %s", strerror(errno));
+ err = 1;
+ }
++ }
+
-+ /*
-+ * Most likely a case of switching uid/gid within a persistent
-+ * connection; the RFCs allow us to just close the connection
-+ * at anytime, so we excercise our right. :-)
-+ */
-+ if (err) {
-+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, \
-+ "Couldn't set uid/gid, closing connection.");
-+ ap_lingering_close(r->connection);
-+ exit(0);
-+ }
++ /*
++ * Most likely a case of switching uid/gid within a persistent
++ * connection; the RFCs allow us to just close the connection
++ * at anytime, so we excercise our right. :-)
++ */
++ if (err) {
++ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, \
++ "Couldn't set uid/gid/priority, closing connection.");
++ ap_lingering_close(r->connection);
++ exit(0);
+ }
+ return OK;
+}
@@ -1661,6 +1658,28 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ return NULL;
+}
+
++static const char *set_nice_value (cmd_parms *cmd, void *dummy, const char *arg)
++{
++ itk_server_conf *sconf =
++ (itk_server_conf *) ap_get_module_config(cmd->server->module_config, &mpm_itk_module);
++ int nice_value = atoi(arg);
++
++ if (nice_value < -20) {
++ ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
++ "WARNING: NiceValue of %d is below -20, increasing NiceValue to -20.",
++ nice_value);
++ nice_value = -20;
++ }
++ else if (nice_value > 19) {
++ ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
++ "WARNING: NiceValue of %d is above 19, lowering NiceValue to 19.",
++ nice_value);
++ nice_value = 19;
++ }
++ sconf->nice_value = nice_value;
++ return NULL;
++}
++
+static const command_rec itk_cmds[] = {
+UNIX_DAEMON_COMMANDS,
+LISTEN_COMMANDS,
@@ -1678,6 +1697,8 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ "Tie a virtual host to a specific child process."),
+AP_INIT_TAKE1("MaxClientsVHost", set_max_clients_vhost, NULL, RSRC_CONF,
+ "Maximum number of children alive at the same time for this virtual host."),
++AP_INIT_TAKE1("NiceValue", set_nice_value, NULL, RSRC_CONF,
++ "Set nice value for the given vhost, from -20 (highest priority) to 19 (lowest priority)."),
+AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND,
+{ NULL }
+};
@@ -1689,6 +1710,7 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ apr_pcalloc(p, sizeof(itk_server_conf));
+ c->uid = c->gid = -1;
+ c->max_clients_vhost = -1;
++ c->nice_value = 0;
+ return c;
+}
+
@@ -1699,83 +1721,21 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/itk.c
+ NULL, /* merge per-directory config structures */
+ itk_create_config, /* create per-server config structure */
+ NULL, /* merge per-server config structures */
-+ itk_cmds, /* command apr_table_t */
-+ itk_hooks, /* register hooks */
++ itk_cmds, /* command apr_table_t */
++ itk_hooks, /* register hooks */
+};
-Index: httpd-2.2.4/server/mpm/experimental/itk/mpm.h
-===================================================================
---- /dev/null
-+++ httpd-2.2.4/server/mpm/experimental/itk/mpm.h
-@@ -0,0 +1,65 @@
-+/* Licensed to the Apache Software Foundation (ASF) under one or more
-+ * contributor license agreements. See the NOTICE file distributed with
-+ * this work for additional information regarding copyright ownership.
-+ * The ASF licenses this file to You under the Apache License, Version 2.0
-+ * (the "License"); you may not use this file except in compliance with
-+ * the License. You may obtain a copy of the License at
-+ *
-+ * http://www.apache.org/licenses/LICENSE-2.0
-+ *
-+ * Unless required by applicable law or agreed to in writing, software
-+ * distributed under the License is distributed on an "AS IS" BASIS,
-+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-+ * See the License for the specific language governing permissions and
-+ * limitations under the License.
-+ *
-+ * Portions copyright 2005-2006 Steinar H. Gunderson <sgunderson@bigfoot.com>.
-+ * Licensed under the same terms as the rest of Apache.
-+ */
-+
-+/**
-+ * @file itk/mpm.h
-+ * @brief ITK MPM (setuid per-vhost, no threads)
-+ *
-+ * @defgroup APACHE_MPM_ITK Apache ITK
-+ * @ingroup APACHE_MPM APACHE_OS_UNIX
-+ * @{
-+ */
-+
-+#include "httpd.h"
-+#include "mpm_default.h"
-+#include "scoreboard.h"
-+#include "unixd.h"
-+
-+#ifndef APACHE_MPM_ITK_H
-+#define APACHE_MPM_ITK_H
-+
-+#define ITK_MPM
-+
-+#define MPM_NAME "ITK"
-+
-+#define AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
-+#define AP_MPM_WANT_WAIT_OR_TIMEOUT
-+#define AP_MPM_WANT_PROCESS_CHILD_STATUS
-+#define AP_MPM_WANT_SET_PIDFILE
-+#define AP_MPM_WANT_SET_SCOREBOARD
-+#define AP_MPM_WANT_SET_LOCKFILE
-+#define AP_MPM_WANT_SET_MAX_REQUESTS
-+#define AP_MPM_WANT_SET_COREDUMPDIR
-+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
-+#define AP_MPM_WANT_SIGNAL_SERVER
-+#define AP_MPM_WANT_SET_MAX_MEM_FREE
-+#define AP_MPM_WANT_FATAL_SIGNAL_HANDLER
-+#define AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
-+#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
+diff -Nur apache2.2.orig/server/mpm/experimental/itk/Makefile.in apache2.2/server/mpm/experimental/itk/Makefile.in
+--- apache2.2.orig/server/mpm/experimental/itk/Makefile.in 1970-01-01 01:00:00.000000000 +0100
++++ apache2.2/server/mpm/experimental/itk/Makefile.in 2007-04-25 14:23:35.000000000 +0200
+@@ -0,0 +1,5 @@
+
-+#define AP_MPM_USES_POD 1
-+#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
-+#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)
-+#define MPM_ACCEPT_FUNC unixd_accept
++LTLIBRARY_NAME = libitk.la
++LTLIBRARY_SOURCES = itk.c
+
-+extern int ap_threads_per_child;
-+extern int ap_max_daemons_limit;
-+extern server_rec *ap_server_conf;
-+#endif /* APACHE_MPM_ITK_H */
-+/** @} */
-Index: httpd-2.2.4/server/mpm/experimental/itk/mpm_default.h
-===================================================================
---- /dev/null
-+++ httpd-2.2.4/server/mpm/experimental/itk/mpm_default.h
++include $(top_srcdir)/build/ltlib.mk
+diff -Nur apache2.2.orig/server/mpm/experimental/itk/mpm_default.h apache2.2/server/mpm/experimental/itk/mpm_default.h
+--- apache2.2.orig/server/mpm/experimental/itk/mpm_default.h 1970-01-01 01:00:00.000000000 +0100
++++ apache2.2/server/mpm/experimental/itk/mpm_default.h 2007-04-25 14:23:35.000000000 +0200
@@ -0,0 +1,77 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
@@ -1791,14 +1751,14 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/mpm_default.h
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
-+ *
-+ * Portions copyright 2005-2006 Steinar H. Gunderson <sgunderson@bigfoot.com>.
++ *
++ * Portions copyright 2005-2007 Steinar H. Gunderson <sgunderson@bigfoot.com>.
+ * Licensed under the same terms as the rest of Apache.
+ */
+
+/**
+ * @file itk/mpm_default.h
-+ * @brief Prefork MPM defaults
++ * @brief ITK MPM defaults
+ *
+ * @addtogroup APACHE_MPM_ITK
+ * @{
@@ -1854,3 +1814,72 @@ Index: httpd-2.2.4/server/mpm/experimental/itk/mpm_default.h
+
+#endif /* AP_MPM_DEFAULT_H */
+/** @} */
+diff -Nur apache2.2.orig/server/mpm/experimental/itk/mpm.h apache2.2/server/mpm/experimental/itk/mpm.h
+--- apache2.2.orig/server/mpm/experimental/itk/mpm.h 1970-01-01 01:00:00.000000000 +0100
++++ apache2.2/server/mpm/experimental/itk/mpm.h 2007-04-25 14:23:35.000000000 +0200
+@@ -0,0 +1,65 @@
++/* Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements. See the NOTICE file distributed with
++ * this work for additional information regarding copyright ownership.
++ * The ASF licenses this file to You under the Apache License, Version 2.0
++ * (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ *
++ * Portions copyright 2005-2007 Steinar H. Gunderson <sgunderson@bigfoot.com>.
++ * Licensed under the same terms as the rest of Apache.
++ */
++
++/**
++ * @file itk/mpm.h
++ * @brief ITK MPM (setuid per-vhost, no threads)
++ *
++ * @defgroup APACHE_MPM_ITK Apache ITK
++ * @ingroup APACHE_MPM APACHE_OS_UNIX
++ * @{
++ */
++
++#include "httpd.h"
++#include "mpm_default.h"
++#include "scoreboard.h"
++#include "unixd.h"
++
++#ifndef APACHE_MPM_ITK_H
++#define APACHE_MPM_ITK_H
++
++#define ITK_MPM
++
++#define MPM_NAME "ITK"
++
++#define AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
++#define AP_MPM_WANT_WAIT_OR_TIMEOUT
++#define AP_MPM_WANT_PROCESS_CHILD_STATUS
++#define AP_MPM_WANT_SET_PIDFILE
++#define AP_MPM_WANT_SET_SCOREBOARD
++#define AP_MPM_WANT_SET_LOCKFILE
++#define AP_MPM_WANT_SET_MAX_REQUESTS
++#define AP_MPM_WANT_SET_COREDUMPDIR
++#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH
++#define AP_MPM_WANT_SIGNAL_SERVER
++#define AP_MPM_WANT_SET_MAX_MEM_FREE
++#define AP_MPM_WANT_FATAL_SIGNAL_HANDLER
++#define AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN
++#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
++
++#define AP_MPM_USES_POD 1
++#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
++#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0)
++#define MPM_ACCEPT_FUNC unixd_accept
++
++extern int ap_threads_per_child;
++extern int ap_max_daemons_limit;
++extern server_rec *ap_server_conf;
++#endif /* APACHE_MPM_ITK_H */
++/** @} */