diff options
author | 2010-09-01 05:49:03 +0000 | |
---|---|---|
committer | 2010-09-01 05:49:03 +0000 | |
commit | 68a2fd7aef2840ae86779dbb2ce55c0384e1c8ea (patch) | |
tree | 8597318e321735b42efa3c971791c3746ea67bb7 | |
parent | fix #295916 (diff) | |
download | apache-68a2fd7aef2840ae86779dbb2ce55c0384e1c8ea.tar.gz apache-68a2fd7aef2840ae86779dbb2ce55c0384e1c8ea.tar.bz2 apache-68a2fd7aef2840ae86779dbb2ce55c0384e1c8ea.zip |
dump peruser to 0.4.0-rc1 wrt #294098
-rw-r--r-- | 2.2/patches/20_all_peruser_0.4.0-rc1.patch (renamed from 2.2/patches/20_all_peruser_0.4.0b1.patch) | 540 |
1 files changed, 367 insertions, 173 deletions
diff --git a/2.2/patches/20_all_peruser_0.4.0b1.patch b/2.2/patches/20_all_peruser_0.4.0-rc1.patch index 8e30e64..782bab5 100644 --- a/2.2/patches/20_all_peruser_0.4.0b1.patch +++ b/2.2/patches/20_all_peruser_0.4.0-rc1.patch @@ -1,6 +1,102 @@ -diff -Nur httpd-2.2.13/modules/ssl/mod_ssl.h httpd-2.2.13-peruser/modules/ssl/mod_ssl.h ---- httpd-2.2.13/modules/ssl/mod_ssl.h 2006-07-12 06:38:44.000000000 +0300 -+++ httpd-2.2.13-peruser/modules/ssl/mod_ssl.h 2009-09-01 16:19:22.000000000 +0300 +diff -ruN httpd-2.2.14/docs/conf/extra/httpd-mpm.conf.in peruser-0.4rc1/docs/conf/extra/httpd-mpm.conf.in +--- httpd-2.2.14/docs/conf/extra/httpd-mpm.conf.in 2007-12-29 04:08:28.000000000 +0100 ++++ peruser-0.4rc1/docs/conf/extra/httpd-mpm.conf.in 2009-11-21 21:38:45.000000000 +0100 +@@ -27,6 +27,24 @@ + # active mpm. + # + ++# peruser MPM ++# IdleTimeout: maximum time before a child is killed after being idle, 0 to disable ++# ExpireTimeout: maximum time a child can live, 0 to disable ++# MinSpareProcessors: minimum number of idle children, to handle request spikes ++# MaxProcessors: Maximum number of processors per vhost ++# ServerLimit: maximum value of MaxClients for this run of Apache ++# MaxClients: maximum number of children alive at the same time ++# MaxMultiplexers: maximum number of multiplexers the server can have ++<IfModule mpm_peruser_module> ++ IdleTimeout 900 ++ ExpireTimeout 1800 ++ MinSpareProcessors 2 ++ MaxProcessors 10 ++ ServerLimit 256 ++ MaxClients 256 ++ MaxMultiplexers 20 ++</IfModule> ++ + # prefork MPM + # StartServers: number of server processes to start + # MinSpareServers: minimum number of server processes which are kept spare +diff -ruN httpd-2.2.14/modules/generators/mod_status.c peruser-0.4rc1/modules/generators/mod_status.c +--- httpd-2.2.14/modules/generators/mod_status.c 2008-01-02 10:43:52.000000000 +0100 ++++ peruser-0.4rc1/modules/generators/mod_status.c 2009-11-21 21:07:28.000000000 +0100 +@@ -205,6 +205,7 @@ + #define STAT_OPT_REFRESH 0 + #define STAT_OPT_NOTABLE 1 + #define STAT_OPT_AUTO 2 ++#define STAT_OPT_STATS 3 + + struct stat_opt { + int id; +@@ -217,6 +218,7 @@ + {STAT_OPT_REFRESH, "refresh", "Refresh"}, + {STAT_OPT_NOTABLE, "notable", NULL}, + {STAT_OPT_AUTO, "auto", NULL}, ++ {STAT_OPT_STATS, "stats", NULL}, + {STAT_OPT_END, NULL, NULL} + }; + +@@ -241,6 +243,7 @@ + #endif + int short_report; + int no_table_report; ++ int stats_report; + worker_score *ws_record; + process_score *ps_record; + char *stat_buffer; +@@ -268,7 +271,8 @@ + kbcount = 0; + short_report = 0; + no_table_report = 0; +- ++ stats_report=0; ++ + pid_buffer = apr_palloc(r->pool, server_limit * sizeof(pid_t)); + stat_buffer = apr_palloc(r->pool, server_limit * thread_limit * sizeof(char)); + +@@ -312,6 +316,9 @@ + case STAT_OPT_NOTABLE: + no_table_report = 1; + break; ++ case STAT_OPT_STATS: ++ stats_report = 1; ++ break; + case STAT_OPT_AUTO: + ap_set_content_type(r, "text/plain; charset=ISO-8859-1"); + short_report = 1; +@@ -819,7 +826,8 @@ + int flags = + (short_report ? AP_STATUS_SHORT : 0) | + (no_table_report ? AP_STATUS_NOTABLE : 0) | +- (ap_extended_status ? AP_STATUS_EXTENDED : 0); ++ (ap_extended_status ? AP_STATUS_EXTENDED : 0) | ++ (stats_report ? AP_STATUS_STATS : 0); + + ap_run_status_hook(r, flags); + } +diff -ruN httpd-2.2.14/modules/generators/mod_status.h peruser-0.4rc1/modules/generators/mod_status.h +--- httpd-2.2.14/modules/generators/mod_status.h 2006-07-12 05:38:44.000000000 +0200 ++++ peruser-0.4rc1/modules/generators/mod_status.h 2009-11-21 21:07:28.000000000 +0100 +@@ -32,6 +32,7 @@ + #define AP_STATUS_SHORT (0x1) /* short, non-HTML report requested */ + #define AP_STATUS_NOTABLE (0x2) /* HTML report without tables */ + #define AP_STATUS_EXTENDED (0x4) /* detailed report */ ++#define AP_STATUS_STATS (0x8) /* extended user statistics report */ + + #if !defined(WIN32) + #define STATUS_DECLARE(type) type +diff -ruN httpd-2.2.14/modules/ssl/mod_ssl.h peruser-0.4rc1/modules/ssl/mod_ssl.h +--- httpd-2.2.14/modules/ssl/mod_ssl.h 2006-07-12 05:38:44.000000000 +0200 ++++ peruser-0.4rc1/modules/ssl/mod_ssl.h 2009-11-21 14:29:17.000000000 +0100 @@ -50,6 +50,10 @@ * is using SSL/TLS. */ APR_DECLARE_OPTIONAL_FN(int, ssl_is_https, (conn_rec *)); @@ -12,9 +108,9 @@ diff -Nur httpd-2.2.13/modules/ssl/mod_ssl.h httpd-2.2.13-peruser/modules/ssl/mo /** The ssl_proxy_enable() and ssl_engine_disable() optional functions * are used by mod_proxy to enable use of SSL for outgoing * connections. */ -diff -Nur httpd-2.2.13/modules/ssl/ssl_engine_vars.c httpd-2.2.13-peruser/modules/ssl/ssl_engine_vars.c ---- httpd-2.2.13/modules/ssl/ssl_engine_vars.c 2009-08-06 10:28:47.000000000 +0300 -+++ httpd-2.2.13-peruser/modules/ssl/ssl_engine_vars.c 2009-09-01 16:19:22.000000000 +0300 +diff -ruN httpd-2.2.14/modules/ssl/ssl_engine_vars.c peruser-0.4rc1/modules/ssl/ssl_engine_vars.c +--- httpd-2.2.14/modules/ssl/ssl_engine_vars.c 2009-09-06 13:19:05.000000000 +0200 ++++ peruser-0.4rc1/modules/ssl/ssl_engine_vars.c 2009-11-21 14:33:56.000000000 +0100 @@ -58,6 +58,12 @@ return sslconn && sslconn->ssl; } @@ -36,9 +132,9 @@ diff -Nur httpd-2.2.13/modules/ssl/ssl_engine_vars.c httpd-2.2.13-peruser/module APR_REGISTER_OPTIONAL_FN(ssl_var_lookup); APR_REGISTER_OPTIONAL_FN(ssl_ext_lookup); -diff -Nur httpd-2.2.13/server/mpm/config.m4 httpd-2.2.13-peruser/server/mpm/config.m4 ---- httpd-2.2.13/server/mpm/config.m4 2005-10-30 19:05:26.000000000 +0200 -+++ httpd-2.2.13-peruser/server/mpm/config.m4 2009-09-01 16:19:22.000000000 +0300 +diff -ruN httpd-2.2.14/server/mpm/config.m4 peruser-0.4rc1/server/mpm/config.m4 +--- httpd-2.2.14/server/mpm/config.m4 2005-10-30 18:05:26.000000000 +0100 ++++ peruser-0.4rc1/server/mpm/config.m4 2009-11-21 14:29:17.000000000 +0100 @@ -1,7 +1,7 @@ AC_MSG_CHECKING(which MPM to use) AC_ARG_WITH(mpm, @@ -57,9 +153,9 @@ diff -Nur httpd-2.2.13/server/mpm/config.m4 httpd-2.2.13-peruser/server/mpm/conf return 0 else return 1 -diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/AUTHORS httpd-2.2.13-peruser/server/mpm/experimental/peruser/AUTHORS ---- httpd-2.2.13/server/mpm/experimental/peruser/AUTHORS 1970-01-01 03:00:00.000000000 +0300 -+++ httpd-2.2.13-peruser/server/mpm/experimental/peruser/AUTHORS 2009-09-01 16:19:22.000000000 +0300 +diff -ruN httpd-2.2.14/server/mpm/experimental/peruser/AUTHORS peruser-0.4rc1/server/mpm/experimental/peruser/AUTHORS +--- httpd-2.2.14/server/mpm/experimental/peruser/AUTHORS 1970-01-01 01:00:00.000000000 +0100 ++++ peruser-0.4rc1/server/mpm/experimental/peruser/AUTHORS 2009-11-21 14:29:17.000000000 +0100 @@ -0,0 +1,11 @@ +Enrico Weigelt <weigelt [at] metux.de> (MetuxMPM maintainer) +Sean Gabriel Heacock <gabriel [at] telana.com> (Peruser maintainer) @@ -72,25 +168,136 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/AUTHORS httpd-2.2.13-peru +Steve Amerige <mpm [at] fatbear.com> +Stefan Klingner <stefan.klingner [at] mephisto23.com> (Peruser maintainer) +Michal Grzedzicki <lazy404 [at] gmail.com> -diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/config.m4 httpd-2.2.13-peruser/server/mpm/experimental/peruser/config.m4 ---- httpd-2.2.13/server/mpm/experimental/peruser/config.m4 1970-01-01 03:00:00.000000000 +0300 -+++ httpd-2.2.13-peruser/server/mpm/experimental/peruser/config.m4 2009-09-01 16:19:22.000000000 +0300 -@@ -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.13/server/mpm/experimental/peruser/Makefile.in httpd-2.2.13-peruser/server/mpm/experimental/peruser/Makefile.in ---- httpd-2.2.13/server/mpm/experimental/peruser/Makefile.in 1970-01-01 03:00:00.000000000 +0300 -+++ httpd-2.2.13-peruser/server/mpm/experimental/peruser/Makefile.in 2009-09-01 16:19:22.000000000 +0300 +diff -ruN httpd-2.2.14/server/mpm/experimental/peruser/Makefile.in peruser-0.4rc1/server/mpm/experimental/peruser/Makefile.in +--- httpd-2.2.14/server/mpm/experimental/peruser/Makefile.in 1970-01-01 01:00:00.000000000 +0100 ++++ peruser-0.4rc1/server/mpm/experimental/peruser/Makefile.in 2009-11-21 14:29:17.000000000 +0100 @@ -0,0 +1,5 @@ + +LTLIBRARY_NAME = libperuser.la +LTLIBRARY_SOURCES = peruser.c + +include $(top_srcdir)/build/ltlib.mk -diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/mpm_default.h httpd-2.2.13-peruser/server/mpm/experimental/peruser/mpm_default.h ---- httpd-2.2.13/server/mpm/experimental/peruser/mpm_default.h 1970-01-01 03:00:00.000000000 +0300 -+++ httpd-2.2.13-peruser/server/mpm/experimental/peruser/mpm_default.h 2009-09-01 16:19:22.000000000 +0300 +diff -ruN httpd-2.2.14/server/mpm/experimental/peruser/config.m4 peruser-0.4rc1/server/mpm/experimental/peruser/config.m4 +--- httpd-2.2.14/server/mpm/experimental/peruser/config.m4 1970-01-01 01:00:00.000000000 +0100 ++++ peruser-0.4rc1/server/mpm/experimental/peruser/config.m4 2009-11-21 14:29:17.000000000 +0100 +@@ -0,0 +1,3 @@ ++if test "$MPM_NAME" = "peruser" ; then ++ APACHE_FAST_OUTPUT(server/mpm/experimental/$MPM_NAME/Makefile) ++fi +diff -ruN httpd-2.2.14/server/mpm/experimental/peruser/mpm.h peruser-0.4rc1/server/mpm/experimental/peruser/mpm.h +--- httpd-2.2.14/server/mpm/experimental/peruser/mpm.h 1970-01-01 01:00:00.000000000 +0100 ++++ peruser-0.4rc1/server/mpm/experimental/peruser/mpm.h 2009-11-21 21:10:39.000000000 +0100 +@@ -0,0 +1,107 @@ ++/* ==================================================================== ++ * The Apache Software License, Version 1.1 ++ * ++ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights ++ * reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * ++ * 3. The end-user documentation included with the redistribution, ++ * if any, must include the following acknowledgment: ++ * "This product includes software developed by the ++ * Apache Software Foundation (http://www.apache.org/)." ++ * Alternately, this acknowledgment may appear in the software itself, ++ * if and wherever such third-party acknowledgments normally appear. ++ * ++ * 4. The names "Apache" and "Apache Software Foundation" must ++ * not be used to endorse or promote products derived from this ++ * software without prior written permission. For written ++ * permission, please contact apache@apache.org. ++ * ++ * 5. Products derived from this software may not be called "Apache", ++ * nor may "Apache" appear in their name, without prior written ++ * permission of the Apache Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ++ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ++ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ++ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ==================================================================== ++ * ++ * This software consists of voluntary contributions made by many ++ * individuals on behalf of the Apache Software Foundation. For more ++ * information on the Apache Software Foundation, please see ++ * <http://www.apache.org/>. ++ * ++ * Portions of this software are based upon public domain software ++ * originally written at the National Center for Supercomputing Applications, ++ * University of Illinois, Urbana-Champaign. ++ */ ++ ++#include "httpd.h" ++#include "mpm_default.h" ++#include "scoreboard.h" ++#include "unixd.h" ++ ++#ifndef APACHE_MPM_PERUSER_H ++#define APACHE_MPM_PERUSER_H ++ ++#define PERUSER_MPM ++ ++#define MPM_NAME "Peruser" ++ ++#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 ++ ++#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_VALID_PID(p) (getpgid(p) == getpgrp()) ++#define MPM_ACCEPT_FUNC unixd_accept ++ ++extern int ap_threads_per_child; ++extern int ap_max_daemons_limit; ++extern server_rec *ap_server_conf; ++ ++/* Table of child status */ ++#define SERVER_DEAD 0 ++#define SERVER_DYING 1 ++#define SERVER_ALIVE 2 ++ ++typedef struct ap_ctable { ++ pid_t pid; ++ unsigned char status; ++} ap_ctable; ++ ++static const char* child_clone(); ++ ++ ++#endif /* APACHE_MPM_PERUSER_H */ +diff -ruN httpd-2.2.14/server/mpm/experimental/peruser/mpm_default.h peruser-0.4rc1/server/mpm/experimental/peruser/mpm_default.h +--- httpd-2.2.14/server/mpm/experimental/peruser/mpm_default.h 1970-01-01 01:00:00.000000000 +0100 ++++ peruser-0.4rc1/server/mpm/experimental/peruser/mpm_default.h 2009-11-21 14:29:17.000000000 +0100 @@ -0,0 +1,162 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 @@ -254,118 +461,10 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/mpm_default.h httpd-2.2.1 +#endif + +#endif /* AP_MPM_DEFAULT_H */ -diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/mpm.h httpd-2.2.13-peruser/server/mpm/experimental/peruser/mpm.h ---- httpd-2.2.13/server/mpm/experimental/peruser/mpm.h 1970-01-01 03:00:00.000000000 +0300 -+++ httpd-2.2.13-peruser/server/mpm/experimental/peruser/mpm.h 2009-09-01 16:19:22.000000000 +0300 -@@ -0,0 +1,104 @@ -+/* ==================================================================== -+ * The Apache Software License, Version 1.1 -+ * -+ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights -+ * reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in -+ * the documentation and/or other materials provided with the -+ * distribution. -+ * -+ * 3. The end-user documentation included with the redistribution, -+ * if any, must include the following acknowledgment: -+ * "This product includes software developed by the -+ * Apache Software Foundation (http://www.apache.org/)." -+ * Alternately, this acknowledgment may appear in the software itself, -+ * if and wherever such third-party acknowledgments normally appear. -+ * -+ * 4. The names "Apache" and "Apache Software Foundation" must -+ * not be used to endorse or promote products derived from this -+ * software without prior written permission. For written -+ * permission, please contact apache@apache.org. -+ * -+ * 5. Products derived from this software may not be called "Apache", -+ * nor may "Apache" appear in their name, without prior written -+ * permission of the Apache Software Foundation. -+ * -+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ * ==================================================================== -+ * -+ * This software consists of voluntary contributions made by many -+ * individuals on behalf of the Apache Software Foundation. For more -+ * information on the Apache Software Foundation, please see -+ * <http://www.apache.org/>. -+ * -+ * Portions of this software are based upon public domain software -+ * originally written at the National Center for Supercomputing Applications, -+ * University of Illinois, Urbana-Champaign. -+ */ -+ -+#include "httpd.h" -+#include "mpm_default.h" -+#include "scoreboard.h" -+#include "unixd.h" -+ -+#ifndef APACHE_MPM_PERUSER_H -+#define APACHE_MPM_PERUSER_H -+ -+#define PERUSER_MPM -+ -+#define MPM_NAME "Peruser" -+ -+#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 -+ -+#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_VALID_PID(p) (getpgid(p) == getpgrp()) -+#define MPM_ACCEPT_FUNC unixd_accept -+ -+extern int ap_threads_per_child; -+extern int ap_max_daemons_limit; -+extern server_rec *ap_server_conf; -+ -+/* Table of child status */ -+#define SERVER_DEAD 0 -+#define SERVER_DYING 1 -+#define SERVER_ALIVE 2 -+ -+typedef struct ap_ctable { -+ pid_t pid; -+ unsigned char status; -+} ap_ctable; -+ -+#endif /* APACHE_MPM_PERUSER_H */ -diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-peruser/server/mpm/experimental/peruser/peruser.c ---- httpd-2.2.13/server/mpm/experimental/peruser/peruser.c 1970-01-01 03:00:00.000000000 +0300 -+++ httpd-2.2.13-peruser/server/mpm/experimental/peruser/peruser.c 2009-09-10 11:52:39.000000000 +0300 -@@ -0,0 +1,3884 @@ +diff -ruN httpd-2.2.14/server/mpm/experimental/peruser/peruser.c peruser-0.4rc1/server/mpm/experimental/peruser/peruser.c +--- httpd-2.2.14/server/mpm/experimental/peruser/peruser.c 1970-01-01 01:00:00.000000000 +0100 ++++ peruser-0.4rc1/server/mpm/experimental/peruser/peruser.c 2009-11-21 22:02:27.000000000 +0100 +@@ -0,0 +1,3979 @@ + +/* ==================================================================== + * The Apache Software License, Version 1.1 @@ -1278,6 +1377,35 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + return total; +} + ++static int active_processors(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].pid > 0 ) ) ++ total++; ++ } ++ ++ return total; ++} ++ ++static int active_env_processors(int env_num) ++{ ++ int i, total; ++ ++ if(env_num >= NUM_SENV) ++ return -1; ++ ++ for(i = 0, total = 0; i < NUM_CHILDS; ++i) ++ { ++ if((CHILD_INFO_TABLE[i].senv == &SENV[env_num]) && (CHILD_INFO_TABLE[i].pid > 0)) ++ total++; ++ } ++ ++ return total; ++} ++ +static int idle_processors(int child_num) +{ + int i, total; @@ -1294,6 +1422,20 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + return total; +} + ++static int idle_env_processors(int env_num) ++{ ++ int i, total; ++ ++ for(i = 0, total = 0; i < NUM_CHILDS; ++i) ++ { ++ if(CHILD_INFO_TABLE[i].senv == &SENV[env_num] && (CHILD_INFO_TABLE[i].status == CHILD_STATUS_READY) ) ++ total++; ++ } ++ ++ return total; ++} ++ ++ +static int wait_for_workers(child_info_t *processor) { + int i, wait_step_size, wait_time; + @@ -1469,7 +1611,7 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + child_info_t *processor; + apr_pool_t *ptrans; + peruser_server_conf *sconf; -+ int ssl_on; ++ int ssl_on = 0; + + _DBG("Creating dummy connection to use the vhost lookup api", 0); + @@ -1481,12 +1623,11 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + 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"); ++ ++ // check for ssl configuration for this server (ssl_server_is_https is NULL if we have no mod_ssl) ++ if(ssl_server_is_https) ssl_on = ssl_server_is_https(current_conn->base_server); + } + -+ // check for ssl configuration for this server (ssl_server_is_https is NULL if we have no mod_ssl) -+ if(ssl_server_is_https) ssl_on = ssl_server_is_https(current_conn->base_server); -+ else ssl_on = 0; -+ + if (current_conn && (!current_conn->vhost_lookup_data || ssl_on) && CHILD_INFO_TABLE[my_child_num].type == CHILD_TYPE_MULTIPLEXER) { + _DBG("We are not using name based vhosts (or SSL is enabled), we'll directly pass the socket."); + @@ -2128,8 +2269,6 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + return APR_SUCCESS; +} + -+static const char* child_clone(); -+ +static void child_main(int child_num_arg) +{ + apr_pool_t *ptrans; @@ -2997,6 +3136,7 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + } + + perform_idle_server_maintenance(pconf); ++ +#ifdef TPF + shutdown_pending = os_check_server(tpf_server_name); + ap_check_signals(); @@ -3407,7 +3547,7 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + senv.chroot = multiplexer_chroot; + senv.cgroup = NULL; + senv.nice_lvl = 0; -+ senv.name = NULL; ++ senv.name = "Multiplexer"; + + senv.min_processors = ap_min_multiplexers; + senv.min_free_processors = ap_min_free_processors; @@ -3565,6 +3705,12 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + return OK; +} + ++ ++int senv_active_cmp(const void *a, const void *b) { ++ _DBG("CMP %d %d", *(int *) a,*(int *) b); ++ return active_env_processors(*(int *)a)<active_env_processors(*(int *)b); ++} ++ +static int peruser_status_hook(request_rec *r, int flags) +{ + int x; @@ -3572,45 +3718,77 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + + if (flags & AP_STATUS_SHORT) + return OK; -+ ++ ++ ++ if (flags & AP_STATUS_STATS) { ++ ++ int *sorted_senv; ++ int i; ++ sorted_senv=(int *) apr_palloc(r->pool, NUM_SENV*sizeof(int)); ++ ++ if(!sorted_senv) { ++ ap_rputs("peruser_status_hook(): Out of memory",r); ++ return OK; ++ } ++ /* Initial senv table */ ++ for(i=0; i < NUM_SENV; i++) ++ sorted_senv[i]=i; ++ ++ /* sort env by number of processors */ ++ qsort(sorted_senv, NUM_SENV, sizeof(int), senv_active_cmp); ++ ++ ap_rputs("<h3>Processors statistics:</h3><table border=\"0\"><tr><th>Environment</th><th>Pss</th><th>Avail</th></tr>", r); ++ /* just a mockup to se what data will be usefull here will put code layter, yes I know we need to iterate ON ENV[] NUM_ENV times */ ++ for (x = 0; x < NUM_SENV; x++) ++ { ++ senv = &SENV[sorted_senv[x]]; ++ if(senv==NULL) ++ continue; ++ ap_rprintf(r, "<tr><td nowrap>%s</td><td nowrap>%d/%d/%d</td>" ++ "<td>%d%%</td></tr>", ++ senv == NULL ? NULL : ( senv->name == NULL ? "" : senv->name ), ++ active_env_processors(sorted_senv[x]), idle_env_processors(sorted_senv[x]), senv == NULL ? 0 : senv->max_processors, ++ senv == NULL ? 0 : senv->availability ); ++ } ++ ap_rputs("</table><tr/>", r); ++ ++ ap_rputs("<hr/><table>" ++ "<tr><th>Pss</th><td>Number of processors active/idle/max</td></tr>" ++ "</table><hr/>",r); ++ }else { + ap_rputs("<hr>\n", r); -+ ap_rputs("<h2>peruser status</h2>\n", r); ++ ap_rputs("<h3>peruser status</h3>\n", r); + ap_rputs("<table border=\"0\">\n", r); -+ ap_rputs("<tr><td>ID</td><td>PID</td><td>STATUS</td><td>SB STATUS</td><td>TYPE</td><td>UID</td>" -+ "<td>GID</td><td>CHROOT</td><td>NICE</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>" -+ "<td>AVAIL</td>" ++ ap_rputs("<tr><th>ID</th><th>PID</th><th>STATUS</th><th>SB STATUS</th><th>Type</th><th>Processor</th>" ++ "<th>Pss</th>" ++ "<th>AVAIL</th>" + "</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>%8s</td><td>%12s</td>" -+ "<td>%4d</td><td>%4d</td><td>%25s</td><td>%3d</td><td>%5d</td>" -+ "<td>%6d</td><td>%7d</td><td>%d</td><td>%d</td>" -+ "<td>%d</td><td>%d</td><td>%3d</td></tr>\n", ++ ap_rprintf(r, "<tr><td>%3d</td><td>%5d</td><td>%8s</td><td>%8s</td><td>%12s</td><td nowrap>%48s</td>" ++ "<td>%d/%d/%d</td>" ++ "<td>%3d%%</td></tr>\n", + CHILD_INFO_TABLE[x].id, + CHILD_INFO_TABLE[x].pid, + child_status_string(CHILD_INFO_TABLE[x].status), + scoreboard_status_string(SCOREBOARD_STATUS(x)), + 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 ? 0 : senv->nice_lvl, -+ 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, ++ senv == NULL ? NULL : ( senv->name == NULL ? "" : senv->name ), ++ active_processors(x), + idle_processors(x), -+ senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->min_free_processors, -+ senv == NULL ? -1 : CHILD_INFO_TABLE[x].senv->availability ++ senv == NULL ? 0 : CHILD_INFO_TABLE[x].senv->max_processors, ++ senv == NULL ? 0 : CHILD_INFO_TABLE[x].senv->availability + ); + } + ap_rputs("</table>\n", r); -+ ++ ++ ap_rputs("<hr/><table>" ++ "<tr><th>STATUS</th><td>Processor status</td></tr>" ++ "<tr><th>Pss</th><td>Number of processors active/idle/max</td></tr>" ++ "</table><hr/>",r); ++ } ++ + if (grace_children > 0) { + ap_rputs("<h2>peruser graceful children status</h2>\n", r); + ap_rprintf(r, "%d of total %d still living<br />\n", grace_children_alive, grace_children); @@ -3960,7 +4138,11 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + + if (ap_check_cmd_context(cmd, NOT_IN_VIRTUALHOST) != NULL) { + sconf = PERUSER_SERVER_CONF(cmd->server->module_config); -+ sconf->senv->min_processors = min_procs; ++ if(sconf->senv != NULL) ++ sconf->senv->min_processors = min_procs; ++ else ++ ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, ++ "WARNING: MinProcessors must be set after ServerEnvironment to take effect"); + } + else { + ap_min_processors = min_procs; @@ -3989,7 +4171,11 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + + if (ap_check_cmd_context(cmd, NOT_IN_VIRTUALHOST) != NULL) { + sconf = PERUSER_SERVER_CONF(cmd->server->module_config); -+ sconf->senv->min_free_processors = min_free_procs; ++ if(sconf->senv != NULL) ++ sconf->senv->min_free_processors = min_free_procs; ++ else ++ ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, ++ "WARNING: MinSpareProcessors must be set after ServerEnvironment to take effect"); + } + else { + ap_min_free_processors = min_free_procs; @@ -4018,7 +4204,11 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + + if (ap_check_cmd_context(cmd, NOT_IN_VIRTUALHOST) != NULL) { + sconf = PERUSER_SERVER_CONF(cmd->server->module_config); -+ sconf->senv->max_free_processors = max_free_procs; ++ if(sconf!=NULL) ++ sconf->senv->max_free_processors = max_free_procs; ++ else ++ ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, ++ "WARNING: MaxSpareProcessors must be set after ServerEnvironment to take effect"); + } + else { + ap_max_free_processors = max_free_procs; @@ -4047,7 +4237,11 @@ diff -Nur httpd-2.2.13/server/mpm/experimental/peruser/peruser.c httpd-2.2.13-pe + + if (ap_check_cmd_context(cmd, NOT_IN_VIRTUALHOST) != NULL) { + sconf = PERUSER_SERVER_CONF(cmd->server->module_config); -+ sconf->senv->max_processors = max_procs; ++ if(sconf->senv != NULL) ++ sconf->senv->max_processors = max_procs; ++ else ++ ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, ++ "WARNING: MaxProcessors must be set after ServerEnvironment to take effect"); + } + else { + ap_max_processors = max_procs; |