You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/05/19 01:25:08 UTC

cvs commit: apache-2.0/src/modules/mpm/prefork mpm.h prefork.c

rbb         00/05/18 16:25:07

  Modified:    src/build rules.mk
               src/lib/apr/lib Makefile.in
               src/lib/apr/network_io/unix Makefile.in
               src/lib/apr/threadproc/unix Makefile.in
               src/lib/pcre configure
               src/main Makefile.in
               src/modules/mpm/dexter dexter.c scoreboard.c
               src/modules/mpm/mpmt_pthread mpmt_pthread.c scoreboard.c
               src/modules/mpm/prefork prefork.c
  Added:       src/main mpm_common.c
               src/modules/mpm/dexter mpm.h
               src/modules/mpm/mpmt_pthread mpm.h
               src/modules/mpm/prefork mpm.h
  Removed:     src/modules/mpm/dexter dexter.h
               src/modules/mpm/mpmt_pthread mpmt_pthread.h
  Log:
  First function removed from Unix MPM's and moved to a common file.  This
  work is not anywhere near finished, but the cleanup has begun at least.
  Had to make a couple of variables non-static, so a name change was required
  since they are now viewable from outside the library.  The advantage to this
  is code that is much easier to maintain into the future, because it is
  duplicated less often.
  
  Revision  Changes    Path
  1.17      +1 -1      apache-2.0/src/build/rules.mk
  
  Index: rules.mk
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/build/rules.mk,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- rules.mk	2000/05/12 23:56:19	1.16
  +++ rules.mk	2000/05/18 23:24:53	1.17
  @@ -71,7 +71,7 @@
   APACHE_SH_COMPILE = $(SHLIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< && touch $@
   SHLINK = $(SHLIBTOOL) --mode=link $(CCLD) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@
   
  -DEFS = -I. -I$(srcdir)
  +DEFS = -I. -I$(srcdir) -I$(top_srcdir)/modules/mpm/$(MPM_NAME)
   
   .SUFFIXES:
   .SUFFIXES: .S .c .lo .o .s .y .l .slo
  
  
  
  1.20      +1 -1      apache-2.0/src/lib/apr/lib/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/Makefile.in,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Makefile.in	2000/05/18 11:21:22	1.19
  +++ Makefile.in	2000/05/18 23:24:53	1.20
  @@ -82,7 +82,7 @@
   apr_md5.o: apr_md5.c $(INCDIR)/apr_private.h $(INCDIR)/apr_md5.h \
    $(INCDIR)/apr_lib.h $(INCDIR)/apr_general.h $(INCDIR)/apr.h \
    $(INCDIR)/apr_errno.h $(INCDIR)/apr_file_io.h $(INCDIR)/apr_time.h \
  - $(INCDIR)/apr_thread_proc.h
  + $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_xlate.h
   apr_pools.o: apr_pools.c $(INCDIR)/apr_private.h \
    $(INCDIR)/apr_portable.h $(INCDIR)/apr_general.h $(INCDIR)/apr.h \
    $(INCDIR)/apr_errno.h $(INCDIR)/apr_thread_proc.h \
  
  
  
  1.14      +1 -0      apache-2.0/src/lib/apr/network_io/unix/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/Makefile.in,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Makefile.in	2000/04/30 17:58:30	1.13
  +++ Makefile.in	2000/05/18 23:24:55	1.14
  @@ -52,6 +52,7 @@
   	    && rm Makefile.new
   
   # DO NOT REMOVE
  +inet_aton.o: inet_aton.c $(INCDIR)/apr_private.h
   poll.o: poll.c networkio.h $(INCDIR)/apr_private.h \
    $(INCDIR)/apr_network_io.h $(INCDIR)/apr_general.h \
    $(INCDIR)/apr.h $(INCDIR)/apr_errno.h \
  
  
  
  1.17      +6 -0      apache-2.0/src/lib/apr/threadproc/unix/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/unix/Makefile.in,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Makefile.in	2000/05/17 23:12:56	1.16
  +++ Makefile.in	2000/05/18 23:24:55	1.17
  @@ -77,6 +77,12 @@
    ../../file_io/unix/fileio.h $(INCDIR)/apr_lib.h \
    $(INCDIR)/apr_portable.h $(INCDIR)/apr_network_io.h \
    $(INCDIR)/apr_lock.h
  +threadcancel.o: threadcancel.c threadproc.h \
  + $(INCDIR)/apr_private.h $(INCDIR)/apr_thread_proc.h \
  + $(INCDIR)/apr_file_io.h $(INCDIR)/apr_general.h \
  + $(INCDIR)/apr.h $(INCDIR)/apr_errno.h \
  + $(INCDIR)/apr_time.h ../../file_io/unix/fileio.h \
  + $(INCDIR)/apr_lib.h
   threadpriv.o: threadpriv.c threadproc.h $(INCDIR)/apr_private.h \
    $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \
    $(INCDIR)/apr_general.h $(INCDIR)/apr.h \
  
  
  
  1.3       +76 -42    apache-2.0/src/lib/pcre/Attic/configure
  
  
  
  
  1.9       +1 -1      apache-2.0/src/main/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/Makefile.in,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Makefile.in	2000/05/09 20:24:56	1.8
  +++ Makefile.in	2000/05/18 23:24:57	1.9
  @@ -7,7 +7,7 @@
   	buff.c http_config.c http_core.c http_log.c http_main.c \
   	http_protocol.c http_request.c http_vhost.c util.c util_date.c \
   	util_script.c util_uri.c util_md5.c util_cfgtree.c util_ebcdic.c \
  -	rfc1413.c http_connection.c iol_file.c listen.c
  +	rfc1413.c http_connection.c iol_file.c listen.c mpm_common.c
   
   include $(top_srcdir)/build/ltlib.mk
   
  
  
  
  1.1                  apache-2.0/src/main/mpm_common.c
  
  Index: mpm_common.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 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.
   */
  
  /* The purpose of this file is to store the code that MOST mpm's will need
   * this does not mean a function only goes into this file if every MPM needs
   * it.  It means that if a function is needed by more than one MPM, and
   * future maintenance would be served by making the code common, then the
   * function belongs here.
   *
   * This is going in src/main because it is not platform specific, it is
   * specific to multi-process servers, but NOT to Unix.  Which is why it
   * does not belong in src/os/unix
   */
  
  #include "apr_thread_proc.h"
  #include "httpd.h"
  #include "http_config.h"
  #include "http_log.h"
  #include "mpm.h"
  
  #ifdef DEXTER_MPM
  #define CHILD_INFO_TABLE     ap_child_table
  #elif defined(MPMT_PTHREAD_MPM) || defined (PREFORK_MPM)
  #define CHILD_INFO_TABLE     ap_scoreboard_image->parent
  #endif 
  
  
  void ap_reclaim_child_processes(int terminate)
  {
      int i, status;
      long int waittime = 1024 * 16;      /* in usecs */
      struct timeval tv;
      int waitret, tries;
      int not_dead_yet;
  
  #ifndef DEXTER_MPM
      ap_sync_scoreboard_image();
  #endif
  
      for (tries = terminate ? 4 : 1; tries <= 9; ++tries) {
          /* don't want to hold up progress any more than
           * necessary, but we need to allow children a few moments to exit.
           * Set delay with an exponential backoff.
           */
          tv.tv_sec = waittime / 1000000;
          tv.tv_usec = waittime % 1000000;
          waittime = waittime * 4;
          ap_select(0, NULL, NULL, NULL, &tv);
  
          /* now see who is done */
          not_dead_yet = 0;
          for (i = 0; i < ap_max_daemons_limit; ++i) {
              int pid = CHILD_INFO_TABLE[i].pid;
  
  #ifdef DEXTER_MPM
              if (ap_child_table[i].status == SERVER_DEAD)
  #elif defined(MPMT_PTHREAD_MPM) || defined (PREFORK_MPM)
              if (pid == ap_my_pid || pid == 0)
  #endif
                  continue;
  
              waitret = waitpid(pid, &status, WNOHANG);
              if (waitret == pid || waitret == -1) {
  #ifdef DEXTER_MPM
                  ap_child_table[i].status = SERVER_DEAD;
  #elif defined(MPMT_PTHREAD_MPM) || defined(PREFORK_MPM)
                  ap_scoreboard_image->parent[i].pid = 0;
  #endif
                  continue;
              }
              ++not_dead_yet;
              switch (tries) {
              case 1:     /*  16ms */
              case 2:     /*  82ms */
                  break;
              case 3:     /* 344ms */
              case 4:     /*  16ms */
              case 5:     /*  82ms */
              case 6:     /* 344ms */
              case 7:     /* 1.4sec */
                  /* ok, now it's being annoying */
                  ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
                              0, ap_server_conf,
                     "child process %d still did not exit, sending a SIGTERM",
                              pid);
                  kill(pid, SIGTERM);
                  break;
              case 8:     /*  6 sec */
                  /* die child scum */
                  ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf,
                     "child process %d still did not exit, sending a SIGKILL",
                              pid);
                  kill(pid, SIGKILL);
                  break;
              case 9:     /* 14 sec */
                  /* gave it our best shot, but alas...  If this really
                   * is a child we are trying to kill and it really hasn't
                   * exited, we will likely fail to bind to the port
                   * after the restart.
                   */
                  ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf,
                              "could not make child process %d exit, "
                              "attempting to continue anyway", pid);
                  break;
              }
          }
          ap_check_other_child();
          if (!not_dead_yet) {
              /* nothing left to wait for */
              break;
          }
      }
  }
  
  
  
  
  
  1.79      +70 -157   apache-2.0/src/modules/mpm/dexter/dexter.c
  
  Index: dexter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- dexter.c	2000/05/18 11:39:44	1.78
  +++ dexter.c	2000/05/18 23:24:59	1.79
  @@ -71,7 +71,7 @@
   #include "iol_socket.h"
   #include "ap_listen.h"
   #include "mpm_default.h"
  -#include "dexter.h"
  +#include "mpm.h"
   #include "scoreboard.h"
   
   #include <poll.h>
  @@ -97,15 +97,7 @@
   static int num_listenfds = 0;
   static struct pollfd *listenfds;
   
  -/* Table of child status */
  -#define SERVER_DEAD 0
  -#define SERVER_DYING 1
  -#define SERVER_ALIVE 2
  -
  -static struct {
  -    pid_t pid;
  -    unsigned char status;
  -} child_table[HARD_SERVER_LIMIT];
  +struct ap_ctable ap_child_table[HARD_SERVER_LIMIT];
   
   /*
    * The max child slot ever assigned, preserved across restarts.  Necessary
  @@ -115,7 +107,7 @@
    * XXX - It might not be worth keeping this code in. There aren't very
    * many child processes in this MPM.
    */
  -int max_daemons_limit = -1;
  +int ap_max_daemons_limit = -1;
   
   static char ap_coredump_dir[MAX_STRING_LEN];
   
  @@ -124,7 +116,7 @@
   
   /* *Non*-shared http_main globals... */
   
  -static server_rec *server_conf;
  +server_rec *ap_server_conf;
   
   /* one_process --- debugging mode variable; can be set from the command line
    * with the -X flag.  If set, this gets you the child_main loop running
  @@ -176,7 +168,7 @@
   
   API_EXPORT(const server_rec *) ap_get_server_conf(void)
   {
  -    return (server_conf);
  +    return (ap_server_conf);
   }
   
   /* a clean exit from a child with proper cleanup */
  @@ -188,85 +180,6 @@
       exit(code);
   }
   
  -static void reclaim_child_processes(int terminate)
  -{
  -    int i, status;
  -    long int waittime = 1024 * 16;	/* in usecs */
  -    struct timeval tv;
  -    int waitret, tries;
  -    int not_dead_yet;
  -
  -    for (tries = terminate ? 4 : 1; tries <= 9; ++tries) {
  -	/* don't want to hold up progress any more than 
  -	 * necessary, but we need to allow children a few moments to exit.
  -	 * Set delay with an exponential backoff.
  -	 */
  -	tv.tv_sec = waittime / 1000000;
  -	tv.tv_usec = waittime % 1000000;
  -	waittime = waittime * 4;
  -	ap_select(0, NULL, NULL, NULL, &tv);
  -
  -	/* now see who is done */
  -	not_dead_yet = 0;
  -	for (i = 0; i < max_daemons_limit; ++i) {
  -	    int pid;
  -
  -	    if (child_table[i].status == SERVER_DEAD)
  -		continue;
  -
  -            pid = child_table[i].pid;
  -
  -	    waitret = waitpid(pid, &status, WNOHANG);
  -	    if (waitret == pid || waitret == -1) {
  -		child_table[i].status = SERVER_DEAD;
  -		continue;
  -	    }
  -	    ++not_dead_yet;
  -	    switch (tries) {
  -	    case 1:     /*  16ms */
  -	    case 2:     /*  82ms */
  -		break;
  -	    case 3:     /* 344ms */
  -	    case 4:     /*  16ms */
  -	    case 5:     /*  82ms */
  -	    case 6:     /* 344ms */
  -	    case 7:     /* 1.4sec */
  -		/* ok, now it's being annoying */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno,
  -			    server_conf,
  -		   "child process %d still did not exit, sending a SIGTERM",
  -			    pid);
  -		kill(pid, SIGTERM);
  -		break;
  -	    case 8:     /*  6 sec */
  -		/* die child scum */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, errno,
  -                             server_conf,
  -		   "child process %d still did not exit, sending a SIGKILL",
  -			    pid);
  -		kill(pid, SIGKILL);
  -		break;
  -	    case 9:     /* 14 sec */
  -		/* gave it our best shot, but alas...  If this really 
  -		 * is a child we are trying to kill and it really hasn't
  -		 * exited, we will likely fail to bind to the port
  -		 * after the restart.
  -		 */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, errno,
  -                             server_conf,
  -			    "could not make child process %d exit, "
  -			    "attempting to continue anyway", pid);
  -		break;
  -	    }
  -	}
  -        ap_check_other_child();
  -	if (!not_dead_yet) {
  -	    /* nothing left to wait for */
  -	    break;
  -	}
  -    }
  -}
  -
   /* Finally, this routine is used by the caretaker process to wait for
    * a while...
    */
  @@ -405,46 +318,46 @@
   	sa.sa_flags = SA_RESETHAND;
   #endif
   	if (sigaction(SIGSEGV, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGSEGV)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGSEGV)");
   #ifdef SIGBUS
   	if (sigaction(SIGBUS, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGBUS)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGBUS)");
   #endif
   #ifdef SIGABORT
   	if (sigaction(SIGABORT, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABORT)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABORT)");
   #endif
   #ifdef SIGABRT
   	if (sigaction(SIGABRT, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABRT)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABRT)");
   #endif
   #ifdef SIGILL
   	if (sigaction(SIGILL, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGILL)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGILL)");
   #endif
   	sa.sa_flags = 0;
       }
       sa.sa_handler = sig_term;
       if (sigaction(SIGTERM, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGTERM)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
   #ifdef SIGINT
       if (sigaction(SIGINT, &sa, NULL) < 0)
  -        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGINT)");
  +        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
   #endif
   #ifdef SIGXCPU
       sa.sa_handler = SIG_DFL;
       if (sigaction(SIGXCPU, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXCPU)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXCPU)");
   #endif
   #ifdef SIGXFSZ
       sa.sa_handler = SIG_DFL;
       if (sigaction(SIGXFSZ, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXFSZ)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXFSZ)");
   #endif
   #ifdef SIGPIPE
       sa.sa_handler = SIG_IGN;
       if (sigaction(SIGPIPE, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGPIPE)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
   #endif
   
       /* we want to ignore HUPs and WINCH while we're busy processing one */
  @@ -452,9 +365,9 @@
       sigaddset(&sa.sa_mask, SIGWINCH);
       sa.sa_handler = restart;
       if (sigaction(SIGHUP, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGHUP)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
       if (sigaction(SIGWINCH, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGWINCH)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
   #else
       if (!one_process) {
   	ap_signal(SIGSEGV, sig_coredump);
  @@ -501,7 +414,7 @@
   	*/
       if ((WIFEXITED(status)) &&
   	WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
  -	ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, errno, ap_server_conf,
   			"Child %d returned a Fatal error... \n"
   			"Apache is exiting!",
   			pid);
  @@ -519,7 +432,7 @@
   #ifdef WCOREDUMP
   	    if (WCOREDUMP(status)) {
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
  -			     server_conf,
  +			     ap_server_conf,
   			     "child pid %d exit signal %s (%d), "
   			     "possible coredump in %s",
   			     pid, (WTERMSIG(status) >= NumSIG) ? "" : 
  @@ -529,7 +442,7 @@
   	    else {
   #endif
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
  -			     server_conf,
  +			     ap_server_conf,
   			     "child pid %d exit signal %s (%d)", pid,
   			     SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
   #ifdef WCOREDUMP
  @@ -537,7 +450,7 @@
   #endif
   #else
   	    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
  -			 server_conf,
  +			 ap_server_conf,
   			 "child pid %d exit signal %d",
   			 pid, WTERMSIG(status));
   #endif
  @@ -579,7 +492,7 @@
   
       if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no,
   		   sizeof(int)) < 0) {
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
   		    "setsockopt: (TCP_NODELAY)");
       }
   }
  @@ -630,7 +543,7 @@
       conn_io = ap_bcreate(p, B_RDWR);
       ap_bpush_iol(conn_io, iol);
   
  -    current_conn = ap_new_apr_connection(p, server_conf, conn_io, sock,
  +    current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
                                            conn_id);
   
       ap_process_connection(current_conn);
  @@ -648,7 +561,7 @@
       if (worker_thread_count < max_threads) {
           if (pthread_create(&thread, &worker_thread_attr, worker_thread,
   	  &worker_thread_free_ids[worker_thread_count])) {
  -            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf,
                            "pthread_create: unable to create worker thread");
               /* In case system resources are maxxed out, we don't want
                  Apache running away with the CPU trying to fork over and
  @@ -666,7 +579,7 @@
           static int reported = 0;
           
           if (!reported) {
  -            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, errno, server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, errno, ap_server_conf,
                            "server reached MaxThreadsPerChild setting, consider raising the"
                            " MaxThreadsPerChild or NumServers settings");
               reported = 1;
  @@ -744,7 +657,7 @@
           }
           if ((rv = SAFE_ACCEPT(ap_lock(process_accept_mutex)))
               != APR_SUCCESS) {
  -            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                            "ap_lock failed. Attempting to shutdown "
                            "process gracefully.");
               workers_may_exit = 1;
  @@ -802,7 +715,7 @@
               }
               if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex)))
                   != APR_SUCCESS) {
  -                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf,
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                                "ap_unlock failed. Attempting to shutdown "
                                "process gracefully.");
                   workers_may_exit = 1;
  @@ -823,7 +736,7 @@
   	} else {
               if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex)))
                   != APR_SUCCESS) {
  -                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf,
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                                "ap_unlock failed. Attempting to shutdown "
                                "process gracefully.");
                   workers_may_exit = 1;
  @@ -870,7 +783,7 @@
       rv = SAFE_ACCEPT(ap_child_init_lock(&process_accept_mutex, lock_fname,
                                           pchild));
       if (rv != APR_SUCCESS) {
  -        ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                        "Couldn't initialize cross-process lock in child");
           clean_child_exit(APEXIT_CHILDFATAL);
       }
  @@ -879,7 +792,7 @@
   	clean_child_exit(APEXIT_CHILDFATAL);
       }
   
  -    ap_child_init_hook(pchild, server_conf);
  +    ap_child_init_hook(pchild, ap_server_conf);
   
       /*done with init critical section */
   
  @@ -888,11 +801,11 @@
   
   #ifdef SIGPROCMASK_SETS_THREAD_MASK
       if (sigprocmask(SIG_SETMASK, &sig_mask, NULL) != 0) {
  -        ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf, "sigprocmask");
  +        ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, "sigprocmask");
       }
   #else
       if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) {
  -        ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf,
                        "pthread_sigmask");
       }
   #endif
  @@ -955,7 +868,7 @@
               just_die(signal_received);
               break;
           default:
  -            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf,
               "received impossible signal: %d", signal_received);
               just_die(SIGTERM);
       }
  @@ -965,14 +878,14 @@
   {
       int pid;
   
  -    if (slot + 1 > max_daemons_limit) {
  -        max_daemons_limit = slot + 1;
  +    if (slot + 1 > ap_max_daemons_limit) {
  +        ap_max_daemons_limit = slot + 1;
       }
   
       if (one_process) {
   	set_signals();
  -        child_table[slot].pid = getpid();
  -        child_table[slot].status = SERVER_ALIVE;
  +        ap_child_table[slot].pid = getpid();
  +        ap_child_table[slot].status = SERVER_ALIVE;
   	child_main(slot);
       }
   
  @@ -997,7 +910,7 @@
   			       PROCESSOR_CLASS_ANY);
   	if (status != OK)
   	    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, 
  -                         server_conf, "processor unbind failed %d", status);
  +                         ap_server_conf, "processor unbind failed %d", status);
   #endif
   
           RAISE_SIGSTOP(MAKE_CHILD);
  @@ -1010,8 +923,8 @@
   	return 0;
       }
       /* else */
  -    child_table[slot].pid = pid;
  -    child_table[slot].status = SERVER_ALIVE;
  +    ap_child_table[slot].pid = pid;
  +    ap_child_table[slot].status = SERVER_ALIVE;
   
       return 0;
   }
  @@ -1022,10 +935,10 @@
       int i;
   
       for (i = 0; number_to_start && i < num_daemons; ++i) {
  -	if (child_table[i].status != SERVER_DEAD) {
  +	if (ap_child_table[i].status != SERVER_DEAD) {
   	    continue;
   	}
  -	if (make_child(server_conf, i, 0) < 0) {
  +	if (make_child(ap_server_conf, i, 0) < 0) {
   	    break;
   	}
   	--number_to_start;
  @@ -1058,7 +971,7 @@
       free_length = 0;
       
       for (i = 0; i < num_daemons; ++i) {
  -        if (child_table[i].status == SERVER_DEAD) {
  +        if (ap_child_table[i].status == SERVER_DEAD) {
               if (free_length < spawn_rate) {
                   free_slots[free_length] = i;
                   ++free_length;
  @@ -1068,15 +981,15 @@
               last_non_dead = i;
           }
   
  -	if (i >= max_daemons_limit && free_length >= spawn_rate) {
  +	if (i >= ap_max_daemons_limit && free_length >= spawn_rate) {
   	    break;
   	}
       }
  -    max_daemons_limit = last_non_dead + 1;
  +    ap_max_daemons_limit = last_non_dead + 1;
   
       if (free_length > 0) {
   	for (i = 0; i < free_length; ++i) {
  -	    make_child(server_conf, free_slots[i], now);
  +	    make_child(ap_server_conf, free_slots[i], now);
   	}
   	/* the next time around we want to spawn twice as many if this
   	 * wasn't good enough, but not if we've just done a graceful
  @@ -1110,8 +1023,8 @@
               /* non-fatal death... note that it's gone in the child table and
                * clean out the status table. */
               child_slot = -1;
  -            for (i = 0; i < max_daemons_limit; ++i) {
  -        	if (child_table[i].pid == actual_pid) {
  +            for (i = 0; i < ap_max_daemons_limit; ++i) {
  +        	if (ap_child_table[i].pid == actual_pid) {
                       int j;
   
                       child_slot = i;
  @@ -1122,14 +1035,14 @@
                   }
               }
               if (child_slot >= 0) {
  -                child_table[child_slot].status = SERVER_DEAD;
  +                ap_child_table[child_slot].status = SERVER_DEAD;
                   
   		if (remaining_children_to_start
   		    && child_slot < num_daemons) {
   		    /* we're still doing a 1-for-1 replacement of dead
                        * children with new children
                        */
  -		    make_child(server_conf, child_slot, time(NULL));
  +		    make_child(ap_server_conf, child_slot, time(NULL));
   		    --remaining_children_to_start;
   		}
   #ifdef APR_HAS_OTHER_CHILD
  @@ -1144,7 +1057,7 @@
   		 * child.
   		 */
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, 
  -                             server_conf,
  +                             ap_server_conf,
   			    "long lost child came home! (pid %d)", pid);
   	    }
   	    /* Don't perform idle maintenance when a child dies,
  @@ -1187,10 +1100,10 @@
       ap_status_t rv;
   
       pconf = _pconf;
  -    server_conf = s;
  +    ap_server_conf = s;
       if (pipe(pipe_of_death) == -1) {
           ap_log_error(APLOG_MARK, APLOG_ERR, errno,
  -                     (const server_rec*) server_conf,
  +                     (const server_rec*) ap_server_conf,
                        "pipe: (pipe_of_death)");
           exit(1);
       }
  @@ -1198,12 +1111,12 @@
       ap_register_cleanup(pconf, &pipe_of_death[1], cleanup_fd, cleanup_fd);
       if (fcntl(pipe_of_death[0], F_SETFL, O_NONBLOCK) == -1) {
           ap_log_error(APLOG_MARK, APLOG_ERR, errno,
  -                     (const server_rec*) server_conf,
  +                     (const server_rec*) ap_server_conf,
                        "fcntl: O_NONBLOCKing (pipe_of_death)");
           exit(1);
       }
  -    server_conf = s;
  -    if ((num_listenfds = setup_listeners(server_conf)) < 1) {
  +    ap_server_conf = s;
  +    if ((num_listenfds = setup_listeners(ap_server_conf)) < 1) {
           /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, errno, s,
               "no listening sockets available, shutting down");
  @@ -1229,7 +1142,7 @@
       /* Initialize the child table */
       if (!is_graceful) {
           for (i = 0; i < HARD_SERVER_LIMIT; i++) {
  -            child_table[i].status = SERVER_DEAD;
  +            ap_child_table[i].status = SERVER_DEAD;
           }
       }
   
  @@ -1254,10 +1167,10 @@
   	hold_off_on_exponential_spawning = 10;
       }
   
  -    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, server_conf,
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, ap_server_conf,
   		"%s configured -- resuming normal operations",
   		ap_get_server_version());
  -    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, errno, server_conf,
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, errno, ap_server_conf,
   		"Server built: %s", ap_get_server_built());
       restart_pending = shutdown_pending = 0;
   
  @@ -1268,10 +1181,10 @@
            * Kill child processes, tell them to call child_exit, etc...
            */
           if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
  -            ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                            "killpg SIGTERM");
           }
  -        reclaim_child_processes(1);		/* Start with SIGTERM */
  +        ap_reclaim_child_processes(1);		/* Start with SIGTERM */
       
           /* cleanup pid file on normal shutdown */
           {
  @@ -1279,13 +1192,13 @@
               pidfile = ap_server_root_relative (pconf, ap_pid_fname);
               if ( pidfile != NULL && unlink(pidfile) == 0)
                   ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, errno,
  -            		 server_conf,
  +            		 ap_server_conf,
               		 "removed PID file %s (pid=%ld)",
               		 pidfile, (long)getpid());
           }
       
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
  -                     server_conf, "caught SIGTERM, shutting down");
  +                     ap_server_conf, "caught SIGTERM, shutting down");
       
   	return 1;
       }
  @@ -1301,7 +1214,7 @@
       if (is_graceful) {
           char char_of_death = '!';
   
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno, ap_server_conf,
   		    "SIGWINCH received.  Doing graceful restart");
   
   	/* This is mostly for debugging... so that we know what is still
  @@ -1309,15 +1222,15 @@
            */
   	
   	for (i = 0; i < num_daemons; ++i) {
  -	    if (child_table[i].status != SERVER_DEAD) {
  -	        child_table[i].status = SERVER_DYING;
  +	    if (ap_child_table[i].status != SERVER_DEAD) {
  +	        ap_child_table[i].status = SERVER_DYING;
   	    } 
   	}
   	/* give the children the signal to die */
           for (i = 0; i < num_daemons;) {
               if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
                   if (errno == EINTR) continue;
  -                ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
  +                ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                                "write pipe_of_death");
               }
               i++;
  @@ -1329,12 +1242,12 @@
          * pthreads are stealing signals from us left and right.
          */
   	if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                            "killpg SIGTERM");
   	}
  -        reclaim_child_processes(1);		/* Start with SIGTERM */
  +        ap_reclaim_child_processes(1);		/* Start with SIGTERM */
   	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, errno,
  -                     server_conf, "SIGHUP received.  Attempting to restart");
  +                     ap_server_conf, "SIGHUP received.  Attempting to restart");
       }
       return 0;
   }
  
  
  
  1.14      +3 -3      apache-2.0/src/modules/mpm/dexter/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/scoreboard.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- scoreboard.c	2000/04/14 15:59:00	1.13
  +++ scoreboard.c	2000/05/18 23:25:01	1.14
  @@ -66,7 +66,7 @@
   #include "http_conf_globals.h"
   #include "mpm_status.h"
   #include "scoreboard.h"
  -#include "dexter.h" /* for max_daemons_limit */
  +#include "mpm.h" /* for ap_max_daemons_limit */
   #include <sys/types.h>
   #ifdef USE_SHMGET_SCOREBOARD
   #include <sys/ipc.h>
  @@ -501,7 +501,7 @@
       /* We assume that there is a connection iff it has an entry in the status
        * table. Connections without any status sound problematic to me, so this
        * is probably for the best. - manoj */
  -    for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) {
  +    for (i = 0; i < ap_max_daemons_limit*HARD_THREAD_LIMIT; i++) {
   	if (ap_scoreboard_image->table[i][0].key[0] != '\0') {
               array_slot = ap_push_array(connection_list);
               *array_slot = i;
  @@ -575,7 +575,7 @@
        * aren't maintaining it. We can at least look at what children from
        * previous generations are up to. */
   
  -    for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) {
  +    for (i = 0; i < ap_max_daemons_limit*HARD_THREAD_LIMIT; i++) {
   	if (ap_scoreboard_image->table[i][0].key[0] == '\0')
   	    continue;
           array_slot = ap_push_array(server_status);
  
  
  
  1.1                  apache-2.0/src/modules/mpm/dexter/mpm.h
  
  Index: mpm.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 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"
  
  #ifndef APACHE_MPM_DEXTER_H
  #define APACHE_MPM_DEXTER_H
  
  #define DEXTER_MPM
  
  /* 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;
  
  extern int ap_max_daemons_limit;
  extern ap_ctable ap_child_table[HARD_SERVER_LIMIT];
  extern server_rec *ap_server_conf;
  #endif /* APACHE_MPM_DEXTER_H */
  
  
  
  1.72      +67 -144   apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- mpmt_pthread.c	2000/05/18 02:17:28	1.71
  +++ mpmt_pthread.c	2000/05/18 23:25:02	1.72
  @@ -112,16 +112,16 @@
    * to deal with MaxClients changes across SIGWINCH restarts.  We use this
    * value to optimize routines that have to scan the entire scoreboard.
    */
  -static int max_daemons_limit = -1;
  +int ap_max_daemons_limit = -1;
   
   static char ap_coredump_dir[MAX_STRING_LEN];
   
  -static int pipe_of_death[2];
  +int pipe_of_death[2];
   static pthread_mutex_t pipe_of_death_mutex;
   
   /* *Non*-shared http_main globals... */
   
  -static server_rec *server_conf;
  +server_rec *ap_server_conf;
   
   /* one_process --- debugging mode variable; can be set from the command line
    * with the -X flag.  If set, this gets you the child_main loop running
  @@ -143,7 +143,7 @@
   static ap_pool_t *pconf;		/* Pool for config stuff */
   static ap_pool_t *pchild;		/* Pool for httpd child stuff */
   
  -static int my_pid; /* Linux getpid() doesn't work except in main thread. Use
  +int ap_my_pid; /* Linux getpid() doesn't work except in main thread. Use
                         this instead */
   /* Keep track of the number of worker threads currently active */
   static int worker_thread_count;
  @@ -166,12 +166,12 @@
   
   API_EXPORT(const server_rec *) ap_get_server_conf(void)
   {
  -    return (server_conf);
  +    return (ap_server_conf);
   }
   
   API_EXPORT(int) ap_get_max_daemons(void)
   {
  -    return max_daemons_limit;
  +    return ap_max_daemons_limit;
   }
   
   /* a clean exit from a child with proper cleanup */ 
  @@ -184,83 +184,6 @@
       exit(code);
   }
   
  -static void reclaim_child_processes(int terminate)
  -{
  -    int i, status;
  -    long int waittime = 1024 * 16;	/* in usecs */
  -    struct timeval tv;
  -    int waitret, tries;
  -    int not_dead_yet;
  -
  -    ap_sync_scoreboard_image();
  -
  -    for (tries = terminate ? 4 : 1; tries <= 9; ++tries) {
  -	/* don't want to hold up progress any more than 
  -	 * necessary, but we need to allow children a few moments to exit.
  -	 * Set delay with an exponential backoff.
  -	 */
  -	tv.tv_sec = waittime / 1000000;
  -	tv.tv_usec = waittime % 1000000;
  -	waittime = waittime * 4;
  -	ap_select(0, NULL, NULL, NULL, &tv);
  -
  -	/* now see who is done */
  -	not_dead_yet = 0;
  -	for (i = 0; i < max_daemons_limit; ++i) {
  -	    int pid = ap_scoreboard_image->parent[i].pid;
  -
  -	    if (pid == my_pid || pid == 0)
  -		continue;
  -
  -	    waitret = waitpid(pid, &status, WNOHANG);
  -	    if (waitret == pid || waitret == -1) {
  -		ap_scoreboard_image->parent[i].pid = 0;
  -		continue;
  -	    }
  -	    ++not_dead_yet;
  -	    switch (tries) {
  -	    case 1:     /*  16ms */
  -	    case 2:     /*  82ms */
  -		break;
  -	    case 3:     /* 344ms */
  -	    case 4:     /*  16ms */
  -	    case 5:     /*  82ms */
  -	    case 6:     /* 344ms */
  -	    case 7:     /* 1.4sec */
  -		/* ok, now it's being annoying */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
  -			    0, server_conf,
  -		   "child process %d still did not exit, sending a SIGTERM",
  -			    pid);
  -		kill(pid, SIGTERM);
  -		break;
  -	    case 8:     /*  6 sec */
  -		/* die child scum */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
  -		   "child process %d still did not exit, sending a SIGKILL",
  -			    pid);
  -		kill(pid, SIGKILL);
  -		break;
  -	    case 9:     /* 14 sec */
  -		/* gave it our best shot, but alas...  If this really 
  -		 * is a child we are trying to kill and it really hasn't
  -		 * exited, we will likely fail to bind to the port
  -		 * after the restart.
  -		 */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
  -			    "could not make child process %d exit, "
  -			    "attempting to continue anyway", pid);
  -		break;
  -	    }
  -	}
  -        ap_check_other_child();
  -	if (!not_dead_yet) {
  -	    /* nothing left to wait for */
  -	    break;
  -	}
  -    }
  -}
  -
   /* Finally, this routine is used by the caretaker process to wait for
    * a while...
    */
  @@ -307,7 +230,7 @@
   {
       chdir(ap_coredump_dir);
       ap_signal(sig, SIG_DFL);
  -    kill(my_pid, sig);
  +    kill(ap_my_pid, sig);
       /* At this point we've got sig blocked, because we're still inside
        * the signal handler.  When we leave the signal handler it will
        * be unblocked, and we'll take the signal... and coredump or whatever
  @@ -405,46 +328,46 @@
   	sa.sa_flags = SA_RESETHAND;
   #endif
   	if (sigaction(SIGSEGV, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGSEGV)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGSEGV)");
   #ifdef SIGBUS
   	if (sigaction(SIGBUS, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGBUS)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGBUS)");
   #endif
   #ifdef SIGABORT
   	if (sigaction(SIGABORT, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABORT)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_ap_server_conf, "sigaction(SIGABORT)");
   #endif
   #ifdef SIGABRT
   	if (sigaction(SIGABRT, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABRT)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABRT)");
   #endif
   #ifdef SIGILL
   	if (sigaction(SIGILL, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGILL)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGILL)");
   #endif
   	sa.sa_flags = 0;
       }
       sa.sa_handler = sig_term;
       if (sigaction(SIGTERM, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGTERM)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
   #ifdef SIGINT
       if (sigaction(SIGINT, &sa, NULL) < 0)
  -        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGINT)");
  +        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
   #endif
   #ifdef SIGXCPU
       sa.sa_handler = SIG_DFL;
       if (sigaction(SIGXCPU, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXCPU)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXCPU)");
   #endif
   #ifdef SIGXFSZ
       sa.sa_handler = SIG_DFL;
       if (sigaction(SIGXFSZ, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXFSZ)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXFSZ)");
   #endif
   #ifdef SIGPIPE
       sa.sa_handler = SIG_IGN;
       if (sigaction(SIGPIPE, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGPIPE)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
   #endif
   
       /* we want to ignore HUPs and WINCH while we're busy processing one */
  @@ -452,9 +375,9 @@
       sigaddset(&sa.sa_mask, SIGWINCH);
       sa.sa_handler = restart;
       if (sigaction(SIGHUP, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGHUP)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
       if (sigaction(SIGWINCH, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGWINCH)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGWINCH)");
   #else
       if (!one_process) {
   	ap_signal(SIGSEGV, sig_coredump);
  @@ -501,7 +424,7 @@
   	*/
       if ((WIFEXITED(status)) &&
   	WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
  -	ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf,
   			"Child %d returned a Fatal error... \n"
   			"Apache is exiting!",
   			pid);
  @@ -519,7 +442,7 @@
   #ifdef WCOREDUMP
   	    if (WCOREDUMP(status)) {
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  -			     0, server_conf,
  +			     0, ap_server_conf,
   			     "child pid %d exit signal %s (%d), "
   			     "possible coredump in %s",
   			     pid, (WTERMSIG(status) >= NumSIG) ? "" : 
  @@ -529,7 +452,7 @@
   	    else {
   #endif
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  -			     0, server_conf,
  +			     0, ap_server_conf,
   			     "child pid %d exit signal %s (%d)", pid,
   			     SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
   #ifdef WCOREDUMP
  @@ -537,7 +460,7 @@
   #endif
   #else
   	    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  -			 server_conf,
  +			 ap_server_conf,
   			 "child pid %d exit signal %d",
   			 pid, WTERMSIG(status));
   #endif
  @@ -578,7 +501,7 @@
   
       if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no,
   		   sizeof(int)) < 0) {
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
   		    "setsockopt: (TCP_NODELAY)");
       }
   }
  @@ -630,7 +553,7 @@
       conn_io = ap_bcreate(p, B_RDWR);
       ap_bpush_iol(conn_io, iol);
   
  -    current_conn = ap_new_apr_connection(p, server_conf, conn_io, sock,
  +    current_conn = ap_new_apr_connection(p, ap_server_conf, conn_io, sock,
                                            conn_id);
   
       ap_process_connection(current_conn);
  @@ -700,7 +623,7 @@
           }
           if ((rv = SAFE_ACCEPT(ap_lock(process_accept_mutex)))
               != APR_SUCCESS) {
  -            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                            "ap_lock failed. Attempting to shutdown "
                            "process gracefully.");
               workers_may_exit = 1;
  @@ -760,7 +683,7 @@
               ap_accept(&csd, sd, ptrans);
               if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex)))
                   != APR_SUCCESS) {
  -                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf,
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                                "ap_unlock failed. Attempting to shutdown "
                                "process gracefully.");
                   workers_may_exit = 1;
  @@ -772,7 +695,7 @@
           else {
               if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex)))
                   != APR_SUCCESS) {
  -                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf,
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                                "ap_unlock failed. Attempting to shutdown "
                                "process gracefully.");
                   workers_may_exit = 1;
  @@ -791,7 +714,7 @@
       if (worker_thread_count == 0) {
           /* All the threads have exited, now finish the shutdown process
            * by signalling the sigwait thread */
  -        kill(my_pid, SIGTERM);
  +        kill(ap_my_pid, SIGTERM);
       }
       pthread_mutex_unlock(&worker_thread_count_mutex);
   
  @@ -812,7 +735,7 @@
       ap_status_t rv;
   
   
  -    my_pid = getpid();
  +    ap_my_pid = getpid();
       ap_create_pool(&pchild, pconf);
   
       /*stuff to do before we switch id's, so we have permissions.*/
  @@ -821,7 +744,7 @@
       rv = SAFE_ACCEPT(ap_child_init_lock(&process_accept_mutex, lock_fname,
                        pchild));
       if (rv != APR_SUCCESS) {
  -        ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                        "Couldn't initialize cross-process lock in child");
           clean_child_exit(APEXIT_CHILDFATAL);
       }
  @@ -830,7 +753,7 @@
   	clean_child_exit(APEXIT_CHILDFATAL);
       }
   
  -    ap_child_init_hook(pchild, server_conf);
  +    ap_child_init_hook(pchild, ap_server_conf);
   
       /*done with init critical section */
   
  @@ -839,11 +762,11 @@
   
   #ifdef SIGPROCMASK_SETS_THREAD_MASK
       if (sigprocmask(SIG_SETMASK, &sig_mask, NULL) != 0) {
  -        ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf, "sigprocmask");
  +        ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, "sigprocmask");
       }
   #else
       if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) {
  -        ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf, "pthread_sigmask");
  +        ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf, "pthread_sigmask");
       }
   #endif
   
  @@ -876,7 +799,7 @@
   
   	my_info = (proc_info *)malloc(sizeof(proc_info));
           if (my_info == NULL) {
  -            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf,
   		         "malloc: out of memory");
               clean_child_exit(APEXIT_CHILDFATAL);
           }
  @@ -890,7 +813,7 @@
   				      (request_rec *) NULL);
   #ifndef NO_THREADS
   	if (pthread_create(&thread, &thread_attr, worker_thread, my_info)) {
  -	    ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
  +	    ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf,
   			 "pthread_create: unable to create worker thread");
               /* In case system resources are maxxed out, we don't want
                  Apache running away with the CPU trying to fork over and
  @@ -922,7 +845,7 @@
               just_die(signal_received);
               break;
           default:
  -            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, server_conf,
  +            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf,
               "received impossible signal: %d", signal_received);
               just_die(SIGTERM);
       }
  @@ -932,8 +855,8 @@
   {
       int pid;
   
  -    if (slot + 1 > max_daemons_limit) {
  -	max_daemons_limit = slot + 1;
  +    if (slot + 1 > ap_max_daemons_limit) {
  +	ap_max_daemons_limit = slot + 1;
       }
   
       if (one_process) {
  @@ -971,7 +894,7 @@
           int status = bindprocessor(BINDPROCESS, (int)getpid(),
   			       PROCESSOR_CLASS_ANY);
   	if (status != OK)
  -	    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf,
  +	    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, ap_server_conf,
   			 "processor unbind failed %d", status);
   #endif
   
  @@ -996,7 +919,7 @@
   	if (ap_scoreboard_image->parent[i].pid != 0) {
   	    continue;
   	}
  -	if (make_child(server_conf, i, 0) < 0) {
  +	if (make_child(ap_server_conf, i, 0) < 0) {
   	    break;
   	}
   	--number_to_start;
  @@ -1043,7 +966,7 @@
   	int all_dead_threads = 1;
   	int idle_thread_addition = 0;
   
  -	if (i >= max_daemons_limit && free_length == idle_spawn_rate)
  +	if (i >= ap_max_daemons_limit && free_length == idle_spawn_rate)
   	    break;
   	for (j = 0; j < ap_threads_per_child; j++) {
               ss = &ap_scoreboard_image->servers[i][j];
  @@ -1075,13 +998,13 @@
   	    idle_thread_count += idle_thread_addition;
           }
       }
  -    max_daemons_limit = last_non_dead + 1;
  +    ap_max_daemons_limit = last_non_dead + 1;
   
       if (idle_thread_count > max_spare_threads) {
           /* Kill off one child */
           char char_of_death = '!';
           if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
  -            ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "write pipe_of_death");
  +            ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "write pipe_of_death");
           }
           idle_spawn_rate = 1;
       }
  @@ -1092,7 +1015,7 @@
   	    static int reported = 0;
   	    
   	    if (!reported) {
  -	        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
  +	        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf,
   			     "server reached MaxClients setting, consider"
   			     " raising the MaxClients setting");
   		reported = 1;
  @@ -1102,7 +1025,7 @@
   	else {
   	    
   	    if (idle_spawn_rate >= 8) {
  -	        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
  +	        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf,
   			     "server seems busy, (you may need "
   			     "to increase StartServers, ThreadsPerChild "
                                "or Min/MaxSparetThreads), "
  @@ -1111,7 +1034,7 @@
   			     idle_thread_count, total_non_dead);
   	    }
   	    for (i = 0; i < free_length; ++i) {
  -	        make_child(server_conf, free_slots[i], now);
  +	        make_child(ap_server_conf, free_slots[i], now);
   	    }
   	    /* the next time around we want to spawn twice as many if this
   	     * wasn't good enough, but not if we've just done a graceful
  @@ -1154,7 +1077,7 @@
   		    /* we're still doing a 1-for-1 replacement of dead
                        * children with new children
                        */
  -		    make_child(server_conf, child_slot, time(NULL));
  +		    make_child(ap_server_conf, child_slot, time(NULL));
   		    --remaining_children_to_start;
   		}
   #ifdef APR_HAS_OTHER_CHILD
  @@ -1168,7 +1091,7 @@
   		    * scoreboard.  Somehow we don't know about this
   		    * child.
   		    */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, server_conf,
  +		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, ap_server_conf,
   			    "long lost child came home! (pid %d)", pid);
   	    }
   	    /* Don't perform idle maintenance when a child dies,
  @@ -1202,22 +1125,22 @@
       ap_status_t rv;
   
       pconf = _pconf;
  -    server_conf = s;
  +    ap_server_conf = s;
       if (pipe(pipe_of_death) == -1) {
           ap_log_error(APLOG_MARK, APLOG_ERR, errno,
  -                     (const server_rec*) server_conf,
  +                     (const server_rec*) ap_server_conf,
                        "pipe: (pipe_of_death)");
           exit(1);
       }
   
       if (fcntl(pipe_of_death[0], F_SETFL, O_NONBLOCK) == -1) {
           ap_log_error(APLOG_MARK, APLOG_ERR, errno,
  -                     (const server_rec*) server_conf,
  +                     (const server_rec*) ap_server_conf,
                        "fcntl: O_NONBLOCKing (pipe_of_death)");
           exit(1);
       }
  -    server_conf = s;
  -    if ((num_listensocks = setup_listeners(server_conf)) < 1) {
  +    ap_server_conf = s;
  +    if ((num_listensocks = setup_listeners(ap_server_conf)) < 1) {
           /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
               "no listening sockets available, shutting down");
  @@ -1228,7 +1151,7 @@
       /* Initialize cross-process accept lock */
       lock_fname = ap_psprintf(_pconf, "%s.%lu",
                                ap_server_root_relative(_pconf, lock_fname),
  -                             my_pid);
  +                             ap_my_pid);
       rv = ap_create_lock(&process_accept_mutex, APR_MUTEX, APR_CROSS_PROCESS,
                      lock_fname, _pconf);
       if (rv != APR_SUCCESS) {
  @@ -1269,10 +1192,10 @@
   	hold_off_on_exponential_spawning = 10;
       }
   
  -    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
   		"%s configured -- resuming normal operations",
   		ap_get_server_version());
  -    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf,
   		"Server built: %s", ap_get_server_built());
       restart_pending = shutdown_pending = 0;
   
  @@ -1283,9 +1206,9 @@
            * Kill child processes, tell them to call child_exit, etc...
            */
           if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
  -            ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
  +            ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM");
           }
  -        reclaim_child_processes(1);		/* Start with SIGTERM */
  +        ap_reclaim_child_processes(1);		/* Start with SIGTERM */
       
           /* cleanup pid file on normal shutdown */
           {
  @@ -1293,12 +1216,12 @@
               pidfile = ap_server_root_relative (pconf, ap_pid_fname);
               if ( pidfile != NULL && unlink(pidfile) == 0)
                   ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0,
  -            		 server_conf,
  +            		 ap_server_conf,
               		 "removed PID file %s (pid=%ld)",
               		 pidfile, (long)getpid());
           }
       
  -        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
               "caught SIGTERM, shutting down");
       
   	return 1;
  @@ -1324,14 +1247,14 @@
   	int i, j;
           char char_of_death = '!';
   
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
   		    "SIGWINCH received.  Doing graceful restart");
   
   	/* give the children the signal to die */
           for (i = 0; i < ap_daemons_limit;) {
               if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
                   if (errno == EINTR) continue;
  -                ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "write pipe_of_death");
  +                ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "write pipe_of_death");
               }
               i++;
           }
  @@ -1354,10 +1277,10 @@
          * pthreads are stealing signals from us left and right.
          */
   	if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM");
   	}
  -        reclaim_child_processes(1);		/* Start with SIGTERM */
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
  +        ap_reclaim_child_processes(1);		/* Start with SIGTERM */
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
   		    "SIGHUP received.  Attempting to restart");
       }
       if (!is_graceful) {
  @@ -1379,7 +1302,7 @@
   	if (!one_process) {
   	    unixd_detach();
   	}
  -	my_pid = getpid();
  +	ap_my_pid = getpid();
       }
   
       unixd_pre_config();
  
  
  
  1.23      +1 -1      apache-2.0/src/modules/mpm/mpmt_pthread/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/scoreboard.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- scoreboard.c	2000/05/04 19:42:56	1.22
  +++ scoreboard.c	2000/05/18 23:25:03	1.23
  @@ -65,7 +65,7 @@
   #include "unixd.h"
   #include "http_conf_globals.h"
   #include "mpm_status.h"
  -#include "mpmt_pthread.h"
  +#include "mpm.h"
   #include "scoreboard.h"
   #include <sys/types.h>
   
  
  
  
  1.1                  apache-2.0/src/modules/mpm/mpmt_pthread/mpm.h
  
  Index: mpm.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 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 "scoreboard.h"
  
  #ifndef APACHE_MPM_MPMT_PTHREAD_H
  #define APACHE_MPM_MPMT_PTHREAD_H
  
  #define MPMT_PTHREAD_MPM
  
  extern int ap_threads_per_child;
  extern int ap_max_requests_per_child;
  extern int ap_pipe_of_death[2];
  extern int ap_extended_status;
  extern int ap_max_daemons_limit;
  extern int ap_my_pid;
  extern server_rec *ap_server_conf;
  extern scoreboard *ap_scoreboard_image;
  extern void clean_child_exit(int);
  
  #endif /* APACHE_MPM_MPMT_PTHREAD_H */
  
  
  
  1.86      +70 -159   apache-2.0/src/modules/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- prefork.c	2000/05/18 02:17:30	1.85
  +++ prefork.c	2000/05/18 23:25:06	1.86
  @@ -134,13 +134,13 @@
    * to deal with MaxClients changes across SIGUSR1 restarts.  We use this
    * value to optimize routines that have to scan the entire scoreboard.
    */
  -static int max_daemons_limit = -1;
  +int ap_max_daemons_limit = -1;
  +server_rec *ap_server_conf;
   
   static char ap_coredump_dir[MAX_STRING_LEN];
   
   /* *Non*-shared http_main globals... */
   
  -static server_rec *server_conf;
   static ap_socket_t *sd;
   static fd_set listenfds;
   static int listenmaxfd;
  @@ -161,7 +161,7 @@
   static ap_pool_t *pconf;		/* Pool for config stuff */
   static ap_pool_t *pchild;		/* Pool for httpd child stuff */
   
  -static int my_pid;	/* it seems silly to call getpid all the time */
  +int ap_my_pid;	/* it seems silly to call getpid all the time */
   #ifndef MULTITHREAD
   static int my_child_num;
   #endif
  @@ -184,7 +184,7 @@
   static void chdir_for_gprof(void)
   {
       core_server_config *sconf = 
  -	ap_get_module_config(server_conf->module_config, &core_module);    
  +	ap_get_module_config(ap_server_conf->module_config, &core_module);    
       char *dir = sconf->gprof_dir;
   
       if(dir) {
  @@ -196,7 +196,7 @@
   	} 
   	dir = ap_server_root_relative(pconf, buf[0] ? buf : dir);
   	if(mkdir(dir, 0755) < 0 && errno != EEXIST) {
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
  +	    ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf,
   			 "gprof: error creating directory %s", dir);
   	}
       }
  @@ -561,7 +561,7 @@
       }
   
       if (ret < 0) {
  -	ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_EMERG, errno, ap_server_conf,
   		    "fcntl: F_SETLKW: Error getting accept lock, exiting!  "
   		    "Perhaps you need to use the LockFile directive to place "
   		    "your lock file on a local disk!");
  @@ -577,7 +577,7 @@
   	/* nop */
       }
       if (ret < 0) {
  -	ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_EMERG, errno, ap_server_conf,
   		    "fcntl: F_SETLKW: Error freeing accept lock, exiting!  "
   		    "Perhaps you need to use the LockFile directive to place "
   		    "your lock file on a local disk!");
  @@ -607,7 +607,7 @@
   
       ret=ap_open(&tempfile, ap_lock_fname, APR_WRITE, APR_UREAD|APR_UWRITE, p);
       if (ret != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_EMERG, ret, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_EMERG, ret, ap_server_conf,
   		    "Child cannot open lock file: %s", ap_lock_fname);
   	clean_child_exit(APEXIT_CHILDINIT);
       }
  @@ -628,7 +628,7 @@
       ret=ap_open(&tempfile, ap_lock_fname, APR_CREATE|APR_WRITE|APR_EXCL,
   	    APR_UREAD|APR_UWRITE, p);
       if (ret != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_EMERG, ret, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_EMERG, ret, ap_server_conf,
   		    "Parent cannot open lock file: %s", ap_lock_fname);
   	exit(APEXIT_INIT);
       }
  @@ -644,7 +644,7 @@
   	continue;
   
       if (ret < 0) {
  -	ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_EMERG, errno, ap_ap_server_conf,
   		    "flock: LOCK_EX: Error getting accept lock. Exiting!");
   	clean_child_exit(APEXIT_CHILDFATAL);
       }
  @@ -653,7 +653,7 @@
   static void accept_mutex_off(void)
   {
       if (flock(lock_fd, LOCK_UN) < 0) {
  -	ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_EMERG, errno, ap_server_conf,
   		    "flock: LOCK_UN: Error freeing accept lock. Exiting!");
   	clean_child_exit(APEXIT_CHILDFATAL);
       }
  @@ -678,7 +678,7 @@
       int rc = DosOpenMutexSem(NULL, &lock_sem);
   
       if (rc != 0) {
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, ap_server_conf,
   		    "Child cannot open lock semaphore, rc=%d", rc);
   	clean_child_exit(APEXIT_CHILDINIT);
       } else {
  @@ -695,7 +695,7 @@
       int rc = DosCreateMutexSem(NULL, &lock_sem, DC_SEM_SHARED, FALSE);
   
       if (rc != 0) {
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, ap_server_conf,
   		    "Parent cannot create lock semaphore, rc=%d", rc);
   	exit(APEXIT_INIT);
       }
  @@ -708,7 +708,7 @@
       int rc = DosRequestMutexSem(lock_sem, SEM_INDEFINITE_WAIT);
   
       if (rc != 0) {
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, ap_server_conf,
   		    "OS2SEM: Error %d getting accept lock. Exiting!", rc);
   	clean_child_exit(APEXIT_CHILDFATAL);
       }
  @@ -719,7 +719,7 @@
       int rc = DosReleaseMutexSem(lock_sem);
       
       if (rc != 0) {
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, ap_server_conf,
   		    "OS2SEM: Error %d freeing accept lock. Exiting!", rc);
   	clean_child_exit(APEXIT_CHILDFATAL);
       }
  @@ -1021,102 +1021,13 @@
       int actual_pid;
   
       ap_get_os_proc(&actual_pid, pid);
  -    for (i = 0; i < max_daemons_limit; ++i)
  +    for (i = 0; i < ap_max_daemons_limit; ++i)
   	if (ap_scoreboard_image->parent[i].pid == actual_pid)
   	    return i;
   
       return -1;
   }
   
  -static void reclaim_child_processes(int terminate)
  -{
  -#ifndef MULTITHREAD
  -    int i, status;
  -    long int waittime = 1024 * 16;	/* in usecs */
  -    struct timeval tv;
  -    int waitret, tries;
  -    int not_dead_yet;
  -
  -    ap_sync_scoreboard_image();
  -
  -    for (tries = terminate ? 4 : 1; tries <= 9; ++tries) {
  -	/* don't want to hold up progress any more than 
  -	 * necessary, but we need to allow children a few moments to exit.
  -	 * Set delay with an exponential backoff.
  -	 */
  -	tv.tv_sec = waittime / 1000000;
  -	tv.tv_usec = waittime % 1000000;
  -	waittime = waittime * 4;
  -	ap_select(0, NULL, NULL, NULL, &tv);
  -
  -	/* now see who is done */
  -	not_dead_yet = 0;
  -	for (i = 0; i < max_daemons_limit; ++i) {
  -	    int pid = ap_scoreboard_image->parent[i].pid;
  -
  -	    if (pid == my_pid || pid == 0)
  -		continue;
  -
  -	    waitret = waitpid(pid, &status, WNOHANG);
  -	    if (waitret == pid || waitret == -1) {
  -		ap_scoreboard_image->parent[i].pid = 0;
  -		continue;
  -	    }
  -	    ++not_dead_yet;
  -	    switch (tries) {
  -	    case 1:     /*  16ms */
  -	    case 2:     /*  82ms */
  -		break;
  -	    case 3:     /* 344ms */
  -		/* perhaps it missed the SIGHUP, lets try again */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
  -			    0, server_conf,
  -		    "child process %d did not exit, sending another SIGHUP",
  -			    pid);
  -		kill(pid, SIGHUP);
  -		waittime = 1024 * 16;
  -		break;
  -	    case 4:     /*  16ms */
  -	    case 5:     /*  82ms */
  -	    case 6:     /* 344ms */
  -		break;
  -	    case 7:     /* 1.4sec */
  -		/* ok, now it's being annoying */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
  -			    0, server_conf,
  -		   "child process %d still did not exit, sending a SIGTERM",
  -			    pid);
  -		kill(pid, SIGTERM);
  -		break;
  -	    case 8:     /*  6 sec */
  -		/* die child scum */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
  -		   "child process %d still did not exit, sending a SIGKILL",
  -			    pid);
  -		kill(pid, SIGKILL);
  -		break;
  -	    case 9:     /* 14 sec */
  -		/* gave it our best shot, but alas...  If this really 
  -		 * is a child we are trying to kill and it really hasn't
  -		 * exited, we will likely fail to bind to the port
  -		 * after the restart.
  -		 */
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
  -			    "could not make child process %d exit, "
  -			    "attempting to continue anyway", pid);
  -		break;
  -	    }
  -	}
  -        ap_check_other_child();
  -	if (!not_dead_yet) {
  -	    /* nothing left to wait for */
  -	    break;
  -	}
  -    }
  -#endif /* ndef MULTITHREAD */
  -}
  -
  -
   #if defined(NEED_WAITPID)
   /*
      Systems without a real waitpid sometimes lose a child's exit while waiting
  @@ -1126,7 +1037,7 @@
   {
       int n, pid;
   
  -    for (n = 0; n < max_daemons_limit; ++n) {
  +    for (n = 0; n < ap_max_daemons_limit; ++n) {
           ap_sync_scoreboard_image();
   	if (ap_scoreboard_image->servers[n].status != SERVER_DEAD &&
   		kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) {
  @@ -1262,46 +1173,46 @@
   	sa.sa_flags = SA_RESETHAND;
   #endif
   	if (sigaction(SIGSEGV, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGSEGV)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGSEGV)");
   #ifdef SIGBUS
   	if (sigaction(SIGBUS, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGBUS)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGBUS)");
   #endif
   #ifdef SIGABORT
   	if (sigaction(SIGABORT, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABORT)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABORT)");
   #endif
   #ifdef SIGABRT
   	if (sigaction(SIGABRT, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGABRT)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGABRT)");
   #endif
   #ifdef SIGILL
   	if (sigaction(SIGILL, &sa, NULL) < 0)
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGILL)");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGILL)");
   #endif
   	sa.sa_flags = 0;
       }
       sa.sa_handler = sig_term;
       if (sigaction(SIGTERM, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGTERM)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
   #ifdef SIGINT
       if (sigaction(SIGINT, &sa, NULL) < 0)
  -        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGINT)");
  +        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
   #endif
   #ifdef SIGXCPU
       sa.sa_handler = SIG_DFL;
       if (sigaction(SIGXCPU, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXCPU)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXCPU)");
   #endif
   #ifdef SIGXFSZ
       sa.sa_handler = SIG_DFL;
       if (sigaction(SIGXFSZ, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGXFSZ)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXFSZ)");
   #endif
   #ifdef SIGPIPE
       sa.sa_handler = SIG_IGN;
       if (sigaction(SIGPIPE, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGPIPE)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
   #endif
   
       /* we want to ignore HUPs and USR1 while we're busy processing one */
  @@ -1309,9 +1220,9 @@
       sigaddset(&sa.sa_mask, SIGUSR1);
       sa.sa_handler = restart;
       if (sigaction(SIGHUP, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGHUP)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
       if (sigaction(SIGUSR1, &sa, NULL) < 0)
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "sigaction(SIGUSR1)");
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGUSR1)");
   #else
       if (!one_process) {
   	ap_signal(SIGSEGV, sig_coredump);
  @@ -1365,7 +1276,7 @@
   
       if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &just_say_no,
   		   sizeof(int)) < 0) {
  -	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
   		    "setsockopt: (TCP_NODELAY)");
       }
   }
  @@ -1407,7 +1318,7 @@
       ap_status_t stat;
       int sockdes;
   
  -    my_pid = getpid();
  +    ap_my_pid = getpid();
       csd = NULL;
       my_child_num = child_num_arg;
       requests_this_child = 0;
  @@ -1428,7 +1339,7 @@
   	clean_child_exit(APEXIT_CHILDFATAL);
       }
   
  -    ap_child_init_hook(pchild, server_conf);
  +    ap_child_init_hook(pchild, ap_server_conf);
   
       (void) ap_update_child_status(my_child_num, SERVER_READY, (request_rec *) NULL);
   
  @@ -1487,7 +1398,7 @@
   		     * on Linux 2.0.x we seem to end up with EFAULT
   		     * occasionally, and we'd loop forever due to it.
   		     */
  -		    ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "select: (listen)");
  +		    ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf, "select: (listen)");
   		    clean_child_exit(1);
   		}
   
  @@ -1615,24 +1526,24 @@
   		      * Ben Hyde noted that temporary ENETDOWN situations
   		      * occur in mobile IP.
   		      */
  -		    ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
  +		    ap_log_error(APLOG_MARK, APLOG_EMERG, errno, ap_server_conf,
   			"accept: giving up.");
   		    clean_child_exit(APEXIT_CHILDFATAL);
   #endif /*ENETDOWN*/
   
   #ifdef TPF
   		case EINACT:
  -		    ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf,
  +		    ap_log_error(APLOG_MARK, APLOG_EMERG, errno, ap_server_conf,
   			"offload device inactive");
   		    clean_child_exit(APEXIT_CHILDFATAL);
   		    break;
   		default:
  -		    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
  +		    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf,
   			"select/accept error (%u)", errno);
   		    clean_child_exit(APEXIT_CHILDFATAL);
   #else
   		default:
  -		    ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf,
  +		    ap_log_error(APLOG_MARK, APLOG_ERR, errno, ap_server_conf,
   				"accept: (client socket)");
   		    clean_child_exit(1);
   #endif
  @@ -1690,7 +1601,7 @@
   
   	ap_bpush_iol(conn_io, iol);
   
  -	current_conn = ap_new_apr_connection(ptrans, server_conf, conn_io, csd,
  +	current_conn = ap_new_apr_connection(ptrans, ap_server_conf, conn_io, csd,
   					 my_child_num);
   
   	ap_process_connection(current_conn);
  @@ -1703,8 +1614,8 @@
   {
       int pid;
   
  -    if (slot + 1 > max_daemons_limit) {
  -	max_daemons_limit = slot + 1;
  +    if (slot + 1 > ap_max_daemons_limit) {
  +	ap_max_daemons_limit = slot + 1;
       }
   
       if (one_process) {
  @@ -1752,7 +1663,7 @@
   	int status = bindprocessor(BINDPROCESS, (int)getpid(), 
   				   PROCESSOR_CLASS_ANY);
   	if (status != OK) {
  -	    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, server_conf,
  +	    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, ap_server_conf,
   			"processor unbind failed %d", status);
   	}
   #endif
  @@ -1788,7 +1699,7 @@
   	if (ap_scoreboard_image->servers[i].status != SERVER_DEAD) {
   	    continue;
   	}
  -	if (make_child(server_conf, i, now) < 0) {
  +	if (make_child(ap_server_conf, i, now) < 0) {
   	    break;
   	}
   	--number_to_start;
  @@ -1832,7 +1743,7 @@
       for (i = 0; i < ap_daemons_limit; ++i) {
   	int status;
   
  -	if (i >= max_daemons_limit && free_length == idle_spawn_rate)
  +	if (i >= ap_max_daemons_limit && free_length == idle_spawn_rate)
   	    break;
   	ss = &ap_scoreboard_image->servers[i];
   	status = ss->status;
  @@ -1865,7 +1776,7 @@
   	    last_non_dead = i;
   	}
       }
  -    max_daemons_limit = last_non_dead + 1;
  +    ap_max_daemons_limit = last_non_dead + 1;
       if (idle_count > ap_daemons_max_free) {
   	/* kill off one child... we use SIGUSR1 because that'll cause it to
   	 * shut down gracefully, in case it happened to pick up a request
  @@ -1881,7 +1792,7 @@
   	    static int reported = 0;
   
   	    if (!reported) {
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, server_conf,
  +		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, ap_server_conf,
   			    "server reached MaxClients setting, consider"
   			    " raising the MaxClients setting");
   		reported = 1;
  @@ -1890,7 +1801,7 @@
   	}
   	else {
   	    if (idle_spawn_rate >= 8) {
  -		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
  +		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf,
   		    "server seems busy, (you may need "
   		    "to increase StartServers, or Min/MaxSpareServers), "
   		    "spawning %d children, there are %d idle, and "
  @@ -1899,15 +1810,15 @@
   	    }
   	    for (i = 0; i < free_length; ++i) {
   #ifdef TPF
  -        if(make_child(server_conf, free_slots[i], now) == -1) {
  +        if(make_child(ap_server_conf, free_slots[i], now) == -1) {
               if(free_length == 1) {
                   shutdown_pending = 1;
  -                ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
  +                ap_log_error(APLOG_MARK, APLOG_EMERG, ap_server_conf,
                   "No active child processes: shutting down");
               }
           }
   #else
  -		make_child(server_conf, free_slots[i], now);
  +		make_child(ap_server_conf, free_slots[i], now);
   #endif /* TPF */
   	    }
   	    /* the next time around we want to spawn twice as many if this
  @@ -1936,7 +1847,7 @@
   	*/
       if ((WIFEXITED(status)) &&
   	WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
  -	ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf,
   			"Child %d returned a Fatal error... \n"
   			"Apache is exiting!",
   			pid);
  @@ -1954,7 +1865,7 @@
   #ifdef WCOREDUMP
   	    if (WCOREDUMP(status)) {
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  -			     0, server_conf,
  +			     0, ap_server_conf,
   			     "child pid %d exit signal %s (%d), "
   			     "possible coredump in %s",
   			     pid, (WTERMSIG(status) >= NumSIG) ? "" : 
  @@ -1964,7 +1875,7 @@
   	    else {
   #endif
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  -			     0, server_conf,
  +			     0, ap_server_conf,
   			     "child pid %d exit signal %s (%d)", pid,
   			     SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
   #ifdef WCOREDUMP
  @@ -1972,7 +1883,7 @@
   #endif
   #else
   	    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  -			 server_conf,
  +			 ap_server_conf,
   			 "child pid %d exit signal %d",
   			 pid, WTERMSIG(status));
   #endif
  @@ -2031,7 +1942,7 @@
   
       pconf = _pconf;
   
  -    server_conf = s;
  +    ap_server_conf = s;
    
       ap_log_pid(pconf, ap_pid_fname);
   
  @@ -2078,10 +1989,10 @@
   	hold_off_on_exponential_spawning = 10;
       }
   
  -    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
   		"%s configured -- resuming normal operations",
   		ap_get_server_version());
  -    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, server_conf,
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, 0, ap_server_conf,
   		"Server built: %s", ap_get_server_built());
       restart_pending = shutdown_pending = 0;
   
  @@ -2109,7 +2020,7 @@
   		    /* we're still doing a 1-for-1 replacement of dead
   			* children with new children
   			*/
  -		    make_child(server_conf, child_slot, time(0));
  +		    make_child(ap_server_conf, child_slot, time(0));
   		    --remaining_children_to_start;
   		}
   #ifdef APR_HAS_OTHER_CHILD
  @@ -2127,7 +2038,7 @@
   
                   ap_get_os_proc(&os_pid, pid);
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 
  -                            0, server_conf,
  +                            0, ap_server_conf,
   			    "long lost child came home! (pid %d)", os_pid);
   	    }
   	    /* Don't perform idle maintenance when a child dies,
  @@ -2164,9 +2075,9 @@
   	 * Kill child processes, tell them to call child_exit, etc...
   	 */
   	if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM");
   	}
  -	reclaim_child_processes(1);		/* Start with SIGTERM */
  +	ap_reclaim_child_processes(1);		/* Start with SIGTERM */
   
   	/* cleanup pid file on normal shutdown */
   	{
  @@ -2174,12 +2085,12 @@
   	    pidfile = ap_server_root_relative (pconf, ap_pid_fname);
   	    if ( pidfile != NULL && unlink(pidfile) == 0)
   		ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO,
  -				0, server_conf,
  +				0, ap_server_conf,
   				"removed PID file %s (pid=%ld)",
   				pidfile, (long)getpid());
   	}
   
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
   		    "caught SIGTERM, shutting down");
   	return 1;
       }
  @@ -2204,12 +2115,12 @@
   #ifndef SCOREBOARD_FILE
   	int i;
   #endif
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
   		    "SIGUSR1 received.  Doing graceful restart");
   
   	/* kill off the idle ones */
   	if (unixd_killpg(getpgrp(), SIGUSR1) < 0) {
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGUSR1");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGUSR1");
   	}
   #ifndef SCOREBOARD_FILE
   	/* This is mostly for debugging... so that we know what is still
  @@ -2228,10 +2139,10 @@
       else {
   	/* Kill 'em off */
   	if (unixd_killpg(getpgrp(), SIGHUP) < 0) {
  -	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGHUP");
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGHUP");
   	}
  -	reclaim_child_processes(0);		/* Not when just starting up */
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, server_conf,
  +	ap_reclaim_child_processes(0);		/* Not when just starting up */
  +	ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
   		    "SIGHUP received.  Attempting to restart");
       }
   
  @@ -2256,7 +2167,7 @@
   	    unixd_detach();
   	}
   
  -	my_pid = getpid();
  +	ap_my_pid = getpid();
       }
   
       unixd_pre_config();
  @@ -2450,7 +2361,7 @@
       /* We assume that there is a connection iff it has an entry in the status
        * table. Connections without any status sound problematic to me, so this
        * is probably for the best. - manoj */
  -    for (i = 0; i < max_daemons_limit; i++) {
  +    for (i = 0; i < ap_max_daemons_limit; i++) {
            if (ap_new_scoreboard_image->table[i][0].key[0] != '\0') {
               array_slot = ap_push_array(connection_list);
               *array_slot = i;
  @@ -2524,7 +2435,7 @@
        * aren't maintaining it. We can at least look at what children from
        * previous generations are up to. */
   
  -    for (i = 0; i < max_daemons_limit; i++) {
  +    for (i = 0; i < ap_max_daemons_limit; i++) {
           if (ap_new_scoreboard_image->table[i][0].key[0] == '\0')
               continue;
           array_slot = ap_push_array(server_status);
  
  
  
  1.1                  apache-2.0/src/modules/mpm/prefork/mpm.h
  
  Index: mpm.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 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"
  
  #ifndef APACHE_MPM_PREFORK_H
  #define APACHE_MPM_PREFORK_H
  
  #define PREFORK_MPM
  
  extern int ap_max_daemons_limit;
  extern scoreboard *ap_scoreboard_image;
  extern server_rec *ap_server_conf;
  extern int ap_my_pid;
  #endif /* APACHE_MPM_DEXTER_H */