/[Apache-SVN]/httpd/httpd/branches/2.2.x/server/mpm/worker/worker.c
ViewVC logotype

Diff of /httpd/httpd/branches/2.2.x/server/mpm/worker/worker.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- httpd/httpd/branches/2.2.x/server/mpm/worker/worker.c	2005/11/10 15:15:41	332307
+++ httpd/httpd/branches/2.2.x/server/mpm/worker/worker.c	2005/11/10 15:20:05	332309
@@ -40,7 +40,7 @@
 #include <sys/socket.h>
 #endif
 #if APR_HAVE_SYS_WAIT_H
-#include <sys/wait.h> 
+#include <sys/wait.h>
 #endif
 #ifdef HAVE_SYS_PROCESSOR_H
 #include <sys/processor.h> /* for bindprocessor() */
@@ -50,20 +50,20 @@
 #error The Worker MPM requires APR threads, but they are unavailable.
 #endif
 
-#define CORE_PRIVATE 
- 
+#define CORE_PRIVATE
+
 #include "ap_config.h"
-#include "httpd.h" 
-#include "http_main.h" 
-#include "http_log.h" 
-#include "http_config.h"        /* for read_config */ 
-#include "http_core.h"          /* for get_remote_host */ 
+#include "httpd.h"
+#include "http_main.h"
+#include "http_log.h"
+#include "http_config.h"        /* for read_config */
+#include "http_core.h"          /* for get_remote_host */
 #include "http_connection.h"
 #include "ap_mpm.h"
 #include "pod.h"
 #include "mpm_common.h"
 #include "ap_listen.h"
-#include "scoreboard.h" 
+#include "scoreboard.h"
 #include "fdqueue.h"
 #include "mpm_default.h"
 
@@ -100,7 +100,7 @@
  * the overhead.
  */
 #ifndef DEFAULT_THREAD_LIMIT
-#define DEFAULT_THREAD_LIMIT 64 
+#define DEFAULT_THREAD_LIMIT 64
 #endif
 
 /* Admin can't tune ThreadLimit beyond MAX_THREAD_LIMIT.  We want
@@ -143,7 +143,7 @@
     int sd;
 } proc_info;
 
-/* Structure used to pass information to the thread responsible for 
+/* Structure used to pass information to the thread responsible for
  * creating the rest of the threads.
  */
 typedef struct {
@@ -157,8 +157,8 @@
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We 
- * use this value to optimize routines that have to scan the entire 
+ * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We
+ * use this value to optimize routines that have to scan the entire
  * scoreboard.
  */
 int ap_max_daemons_limit = -1;
@@ -191,7 +191,7 @@
 static apr_pool_t *pconf;                 /* Pool for config stuff */
 static apr_pool_t *pchild;                /* Pool for httpd child stuff */
 
-static pid_t ap_my_pid; /* Linux getpid() doesn't work except in main 
+static pid_t ap_my_pid; /* Linux getpid() doesn't work except in main
                            thread. Use this instead */
 static pid_t parent_pid;
 static apr_os_thread_t *listener_os_thread;
@@ -205,9 +205,9 @@
 #define SAFE_ACCEPT(stmt) (stmt)
 #endif
 
-/* The LISTENER_SIGNAL signal will be sent from the main thread to the 
- * listener thread to wake it up for graceful termination (what a child 
- * process from an old generation does when the admin does "apachectl 
+/* The LISTENER_SIGNAL signal will be sent from the main thread to the
+ * listener thread to wake it up for graceful termination (what a child
+ * process from an old generation does when the admin does "apachectl
  * graceful").  This signal will be blocked in all threads of a child
  * process except for the listener thread.
  */
@@ -227,13 +227,13 @@
         }
     }
 }
-  
+
 static void wakeup_listener(void)
 {
     listener_may_exit = 1;
     if (!listener_os_thread) {
         /* XXX there is an obscure path that this doesn't handle perfectly:
-         *     right after listener thread is created but before 
+         *     right after listener thread is created but before
          *     listener_os_thread is set, the first worker thread hits an
          *     error and starts graceful termination
          */
@@ -241,7 +241,7 @@
     }
     /*
      * we should just be able to "kill(ap_my_pid, LISTENER_SIGNAL)" on all
-     * platforms and wake up the listener thread since it is the only thread 
+     * platforms and wake up the listener thread since it is the only thread
      * with SIGHUP unblocked, but that doesn't work on Linux
      */
 #ifdef HAVE_PTHREAD_KILL
@@ -306,7 +306,7 @@
         case AP_MPMQ_MIN_SPARE_DAEMONS:
             *result = 0;
             return APR_SUCCESS;
-        case AP_MPMQ_MIN_SPARE_THREADS:    
+        case AP_MPMQ_MIN_SPARE_THREADS:
             *result = min_spare_threads;
             return APR_SUCCESS;
         case AP_MPMQ_MAX_SPARE_DAEMONS:
@@ -328,7 +328,7 @@
     return APR_ENOTIMPL;
 }
 
-/* a clean exit from a child with proper cleanup */ 
+/* a clean exit from a child with proper cleanup */
 static void clean_child_exit(int code) __attribute__ ((noreturn));
 static void clean_child_exit(int code)
 {
@@ -357,8 +357,8 @@
 
 /*
  * ap_start_shutdown() and ap_start_restart(), below, are a first stab at
- * functions to initiate shutdown or restart without relying on signals. 
- * Previously this was initiated in sig_term() and restart() signal handlers, 
+ * functions to initiate shutdown or restart without relying on signals.
+ * Previously this was initiated in sig_term() and restart() signal handlers,
  * but we want to be able to start a shutdown/restart from other sources --
  * e.g. on Win32, from the service manager. Now the service manager can
  * call ap_start_shutdown() or ap_start_restart() as appropiate.  Note that
@@ -426,47 +426,47 @@
 
     sa.sa_handler = sig_term;
     if (sigaction(SIGTERM, &sa, NULL) < 0)
-        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, 
+        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                      "sigaction(SIGTERM)");
 #ifdef AP_SIG_GRACEFUL_STOP
     if (sigaction(AP_SIG_GRACEFUL_STOP, &sa, NULL) < 0)
-        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, 
+        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                      "sigaction(" AP_SIG_GRACEFUL_STOP_STRING ")");
 #endif
 #ifdef SIGINT
     if (sigaction(SIGINT, &sa, NULL) < 0)
-        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, 
+        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, ap_server_conf, 
+        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, ap_server_conf, 
+        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, ap_server_conf, 
+        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                      "sigaction(SIGPIPE)");
 #endif
 
-    /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy 
+    /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
      * processing one */
     sigaddset(&sa.sa_mask, SIGHUP);
     sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
     sa.sa_handler = restart;
     if (sigaction(SIGHUP, &sa, NULL) < 0)
-        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, 
+        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                      "sigaction(SIGHUP)");
     if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
-        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, 
+        ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                      "sigaction(" AP_SIG_GRACEFUL_STRING ")");
 #else
     if (!one_process) {
@@ -544,16 +544,16 @@
     else {
         /* wow! if you're executing this code, you may have set a record.
          * either this child process has served over 2 billion requests, or
-         * you're running a threaded 2.0 on a 16 bit machine.  
+         * you're running a threaded 2.0 on a 16 bit machine.
          *
          * I'll buy pizza and beers at Apachecon for the first person to do
          * the former without cheating (dorking with INT_MAX, or running with
-         * uncommitted performance patches, for example).    
+         * uncommitted performance patches, for example).
          *
          * for the latter case, you probably deserve a beer too.   Greg Ames
          */
-            
-        requests_this_child = INT_MAX;      /* keep going */ 
+
+        requests_this_child = INT_MAX;      /* keep going */
     }
 }
 
@@ -640,7 +640,7 @@
             }
             have_idle_worker = 1;
         }
-            
+
         /* We've already decremented the idle worker count inside
          * ap_queue_info_wait_for_idler. */
 
@@ -651,7 +651,7 @@
             if (listener_may_exit) {
                 break;
             }
-            if (ap_scoreboard_image->parent[process_slot].generation != 
+            if (ap_scoreboard_image->parent[process_slot].generation !=
                 ap_scoreboard_image->global->running_generation) {
                 level = APLOG_DEBUG; /* common to get these at restart time */
             }
@@ -742,7 +742,7 @@
                 if (listener_may_exit) {
                     break;
                 }
-                if (ap_scoreboard_image->parent[process_slot].generation != 
+                if (ap_scoreboard_image->parent[process_slot].generation !=
                     ap_scoreboard_image->global->running_generation) {
                     level = APLOG_DEBUG; /* common to get these at restart time */
                 }
@@ -755,7 +755,7 @@
                 rv = ap_queue_push(worker_queue, csd, ptrans);
                 if (rv) {
                     /* trash the connection; we couldn't queue the connected
-                     * socket to a worker 
+                     * socket to a worker
                      */
                     apr_socket_close(csd);
                     ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
@@ -771,7 +771,7 @@
                 != APR_SUCCESS) {
                 int level = APLOG_EMERG;
 
-                if (ap_scoreboard_image->parent[process_slot].generation != 
+                if (ap_scoreboard_image->parent[process_slot].generation !=
                     ap_scoreboard_image->global->running_generation) {
                     level = APLOG_DEBUG; /* common to get these at restart time */
                 }
@@ -979,14 +979,14 @@
             my_info->pid = my_child_num;
             my_info->tid = i;
             my_info->sd = 0;
-        
+
             /* We are creating threads right now */
             ap_update_child_status_from_indexes(my_child_num, i,
                                                 SERVER_STARTING, NULL);
             /* We let each thread update its own scoreboard entry.  This is
              * done because it lets us deal with tid better.
              */
-            rv = apr_thread_create(&threads[i], thread_attr, 
+            rv = apr_thread_create(&threads[i], thread_attr,
                                    worker_thread, my_info, pchild);
             if (rv != APR_SUCCESS) {
                 ap_log_error(APLOG_MARK, APLOG_ALERT, rv, ap_server_conf,
@@ -1017,15 +1017,15 @@
             prev_threads_created = threads_created;
         }
     }
-    
-    /* What state should this child_main process be listed as in the 
+
+    /* What state should this child_main process be listed as in the
      * scoreboard...?
-     *  ap_update_child_status_from_indexes(my_child_num, i, SERVER_STARTING, 
+     *  ap_update_child_status_from_indexes(my_child_num, i, SERVER_STARTING,
      *                                      (request_rec *) NULL);
-     * 
+     *
      *  This state should be listed separately in the scoreboard, in some kind
-     *  of process_status, not mixed in with the worker threads' status.   
-     *  "life_status" is almost right, but it's in the worker's structure, and 
+     *  of process_status, not mixed in with the worker threads' status.
+     *  "life_status" is almost right, but it's in the worker's structure, and
      *  the name could be clearer.   gla
      */
     apr_thread_exit(thd, APR_SUCCESS);
@@ -1039,7 +1039,7 @@
 
     if (listener) {
         int iter;
-        
+
         /* deal with a rare timing window which affects waking up the
          * listener thread...  if the signal sent to the listener thread
          * is delivered between the time it verifies that the
@@ -1049,7 +1049,7 @@
          */
 
         iter = 0;
-        while (iter < 10 && 
+        while (iter < 10 &&
 #ifdef HAVE_PTHREAD_KILL
                pthread_kill(*listener_os_thread, 0)
 #else
@@ -1073,7 +1073,7 @@
             }
         }
     }
-    
+
     for (i = 0; i < ap_threads_per_child; i++) {
         if (threads[i]) { /* if we ever created this thread */
             rv = apr_thread_join(&thread_rv, threads[i]);
@@ -1091,8 +1091,8 @@
 {
     apr_status_t rv, thread_rv;
 
-    start_thread_may_exit = 1; /* tell it to give up in case it is still 
-                                * trying to take over slots from a 
+    start_thread_may_exit = 1; /* tell it to give up in case it is still
+                                * trying to take over slots from a
                                 * previous generation
                                 */
     rv = apr_thread_join(&thread_rv, start_thread_id);
@@ -1155,13 +1155,13 @@
         /* coding a value of zero means infinity */
         requests_this_child = INT_MAX;
     }
-    
+
     /* Setup worker threads */
 
-    /* clear the storage; we may not create all our threads immediately, 
+    /* clear the storage; we may not create all our threads immediately,
      * and we want a 0 entry to indicate a thread which was not created
      */
-    threads = (apr_thread_t **)calloc(1, 
+    threads = (apr_thread_t **)calloc(1,
                                 sizeof(apr_thread_t *) * ap_threads_per_child);
     if (threads == NULL) {
         ap_log_error(APLOG_MARK, APLOG_ALERT, errno, ap_server_conf,
@@ -1178,7 +1178,7 @@
     if (ap_thread_stacksize != 0) {
         apr_threadattr_stacksize_set(thread_attr, ap_thread_stacksize);
     }
-    
+
     ts->threads = threads;
     ts->listener = NULL;
     ts->child_num_arg = child_num_arg;
@@ -1200,7 +1200,7 @@
     if (one_process) {
         /* Block until we get a terminating signal. */
         apr_signal_thread(check_signal);
-        /* make sure the start thread has finished; signal_threads() 
+        /* make sure the start thread has finished; signal_threads()
          * and join_workers() depend on that
          */
         /* XXX join_start_thread() won't be awakened if one of our
@@ -1243,7 +1243,7 @@
                 }
             }
             if (rv == AP_GRACEFUL || rv == AP_RESTART) {
-                /* make sure the start thread has finished; 
+                /* make sure the start thread has finished;
                  * signal_threads() and join_workers depend on that
                  */
                 join_start_thread(start_thread_id);
@@ -1267,7 +1267,7 @@
     clean_child_exit(resource_shortage ? APEXIT_CHILDSICK : 0);
 }
 
-static int make_child(server_rec *s, int slot) 
+static int make_child(server_rec *s, int slot)
 {
     int pid;
 
@@ -1282,7 +1282,7 @@
     }
 
     if ((pid = fork()) == -1) {
-        ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, 
+        ap_log_error(APLOG_MARK, APLOG_ERR, errno, s,
                      "fork: Unable to fork new process");
 
         /* fork didn't succeed. Fix the scoreboard or else
@@ -1306,7 +1306,7 @@
         int status = bindprocessor(BINDPROCESS, (int)getpid(),
                                PROCESSOR_CLASS_ANY);
         if (status != OK)
-            ap_log_error(APLOG_MARK, APLOG_WARNING, errno, 
+            ap_log_error(APLOG_MARK, APLOG_WARNING, errno,
                          ap_server_conf,
                          "processor unbind failed %d", status);
 #endif
@@ -1403,7 +1403,7 @@
             status = ws->status;
 
             /* XXX any_dying_threads is probably no longer needed    GLA */
-            any_dying_threads = any_dying_threads || 
+            any_dying_threads = any_dying_threads ||
                                 (status == SERVER_GRACEFUL);
             any_dead_threads = any_dead_threads || (status == SERVER_DEAD);
             all_dead_threads = all_dead_threads &&
@@ -1434,7 +1434,7 @@
                     || ps->quiescing)) {   /* or at least one is going away */
             if (all_dead_threads) {
                 /* great! we prefer these, because the new process can
-                 * start more threads sooner.  So prioritize this slot 
+                 * start more threads sooner.  So prioritize this slot
                  * by putting it ahead of any slots with active threads.
                  *
                  * first, make room by moving a slot that's potentially still
@@ -1465,7 +1465,7 @@
             sick_child_detected = 0;
         }
         else {
-            /* looks like a basket case.  give up.  
+            /* looks like a basket case.  give up.
              */
             shutdown_pending = 1;
             child_fatal = 1;
@@ -1477,7 +1477,7 @@
             return;
         }
     }
-                                                    
+
     ap_max_daemons_limit = last_non_dead + 1;
 
     if (idle_thread_count > max_spare_threads) {
@@ -1490,9 +1490,9 @@
         if (free_length == 0) {
             /* only report this condition once */
             static int reported = 0;
-            
+
             if (!reported) {
-                ap_log_error(APLOG_MARK, APLOG_ERR, 0, 
+                ap_log_error(APLOG_MARK, APLOG_ERR, 0,
                              ap_server_conf,
                              "server reached MaxClients setting, consider"
                              " raising the MaxClients setting");
@@ -1505,7 +1505,7 @@
                 free_length = idle_spawn_rate;
             }
             if (idle_spawn_rate >= 8) {
-                ap_log_error(APLOG_MARK, APLOG_INFO, 0, 
+                ap_log_error(APLOG_MARK, APLOG_INFO, 0,
                              ap_server_conf,
                              "server seems busy, (you may need "
                              "to increase StartServers, ThreadsPerChild "
@@ -1543,7 +1543,7 @@
 
     while (!restart_pending && !shutdown_pending) {
         ap_wait_or_timeout(&exitwhy, &status, &pid, pconf);
-        
+
         if (pid.pid != -1) {
             processed_status = ap_process_child_status(&pid, exitwhy, status);
             if (processed_status == APEXIT_CHILDFATAL) {
@@ -1561,9 +1561,9 @@
             child_slot = find_child_by_pid(&pid);
             if (child_slot >= 0) {
                 for (i = 0; i < ap_threads_per_child; i++)
-                    ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD, 
+                    ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD,
                                                         (request_rec *) NULL);
-                
+
                 ap_scoreboard_image->parent[child_slot].pid = 0;
                 ap_scoreboard_image->parent[child_slot].quiescing = 0;
                 if (processed_status == APEXIT_CHILDSICK) {
@@ -1637,13 +1637,13 @@
                      "ignored during restart");
         changed_limit_at_restart = 0;
     }
-    
+
     /* Initialize cross-process accept lock */
     ap_lock_fname = apr_psprintf(_pconf, "%s.%" APR_PID_T_FMT,
                                  ap_server_root_relative(_pconf, ap_lock_fname),
                                  ap_my_pid);
 
-    rv = apr_proc_mutex_create(&accept_mutex, ap_lock_fname, 
+    rv = apr_proc_mutex_create(&accept_mutex, ap_lock_fname,
                                ap_accept_lock_mech, _pconf);
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
@@ -1653,7 +1653,7 @@
     }
 
 #if APR_USE_SYSVSEM_SERIALIZE
-    if (ap_accept_lock_mech == APR_LOCK_DEFAULT || 
+    if (ap_accept_lock_mech == APR_LOCK_DEFAULT ||
         ap_accept_lock_mech == APR_LOCK_SYSVSEM) {
 #else
     if (ap_accept_lock_mech == APR_LOCK_SYSVSEM) {
@@ -1719,7 +1719,7 @@
 #endif
     restart_pending = shutdown_pending = 0;
     mpm_state = AP_MPMQ_RUNNING;
-    
+
     server_main_loop(remaining_children_to_start);
     mpm_state = AP_MPMQ_STOPPING;
 
@@ -1739,7 +1739,7 @@
                              ap_server_conf,
                              "removed PID file %s (pid=%" APR_PID_T_FMT ")",
                              pidfile, getpid());
-    
+
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0,
                          ap_server_conf, "caught SIGTERM, shutting down");
         }
@@ -1766,7 +1766,7 @@
                              ap_server_conf,
                              "removed PID file %s (pid=%" APR_PID_T_FMT ")",
                              pidfile, getpid());
-    
+
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0,
                          ap_server_conf, "caught SIGTERM, shutting down");
         }
@@ -1776,10 +1776,10 @@
         do {
             /* Pause for a second */
             apr_sleep(apr_time_from_sec(1));
-                
+
             /* Relieve any children which have now exited */
             ap_relieve_child_processes();
-            
+
             active_children = 0;
             for (index = 0; index < ap_daemons_limit; ++index) {
                 if (MPM_CHILD_PID(index) != 0) {
@@ -1817,21 +1817,21 @@
      */
     ++ap_my_generation;
     ap_scoreboard_image->global->running_generation = ap_my_generation;
-    
+
     if (is_graceful) {
         ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
                      AP_SIG_GRACEFUL_STRING " received.  Doing graceful restart");
         /* wake up the children...time to die.  But we'll have more soon */
         ap_mpm_pod_killpg(pod, ap_daemons_limit, TRUE);
-    
+
 
         /* This is mostly for debugging... so that we know what is still
          * gracefully dealing with existing request.
          */
-        
+
     }
     else {
-        /* Kill 'em all.  Since the child acts the same on the parents SIGTERM 
+        /* Kill 'em all.  Since the child acts the same on the parents SIGTERM
          * and a SIGHUP, we may as well use the same signal, because some user
          * pthreads are stealing signals from us left and right.
          */
@@ -1871,7 +1871,7 @@
     return OK;
 }
 
-static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog, 
+static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
                              apr_pool_t *ptemp)
 {
     static int restart_num = 0;
@@ -1904,7 +1904,7 @@
                 pdir->args = max_clients->args;
                 pdir->filename = max_clients->filename;
                 pdir->line_num = max_clients->line_num;
-                
+
                 max_clients->directive = temp.directive;
                 max_clients->args = temp.args;
                 max_clients->filename = temp.filename;
@@ -1983,7 +1983,7 @@
 }
 
 static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy,
-                                        const char *arg) 
+                                        const char *arg)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
@@ -2004,15 +2004,15 @@
 
     min_spare_threads = atoi(arg);
     if (min_spare_threads <= 0) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: detected MinSpareThreads set to non-positive.");
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "Resetting to 1 to avoid almost certain Apache failure.");
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "Please read the documentation.");
        min_spare_threads = 1;
     }
-       
+
     return NULL;
 }
 
@@ -2029,7 +2029,7 @@
 }
 
 static const char *set_max_clients (cmd_parms *cmd, void *dummy,
-                                     const char *arg) 
+                                     const char *arg)
 {
     int max_clients;
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -2041,47 +2041,47 @@
      * sure that it gets set before MaxClients in the pre_config stage. */
     max_clients = atoi(arg);
     if (max_clients < ap_threads_per_child) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: MaxClients (%d) must be at least as large",
                     max_clients);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " as ThreadsPerChild (%d). Automatically",
                     ap_threads_per_child);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " increasing MaxClients to %d.",
                     ap_threads_per_child);
        max_clients = ap_threads_per_child;
     }
     ap_daemons_limit = max_clients / ap_threads_per_child;
     if ((max_clients > 0) && (max_clients % ap_threads_per_child)) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: MaxClients (%d) is not an integer multiple",
                     max_clients);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " of ThreadsPerChild (%d), lowering MaxClients to %d",
                     ap_threads_per_child,
                     ap_daemons_limit * ap_threads_per_child);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " for a maximum of %d child processes,",
                     ap_daemons_limit);
-       max_clients = ap_daemons_limit * ap_threads_per_child; 
+       max_clients = ap_daemons_limit * ap_threads_per_child;
     }
     if (ap_daemons_limit > server_limit) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: MaxClients of %d would require %d servers,",
                     max_clients, ap_daemons_limit);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " and would exceed the ServerLimit value of %d.",
                     server_limit);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " Automatically lowering MaxClients to %d.  To increase,",
                     server_limit * ap_threads_per_child);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " please see the ServerLimit directive.");
        ap_daemons_limit = server_limit;
-    } 
+    }
     else if (ap_daemons_limit < 1) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      "WARNING: Require MaxClients > 0, setting to 1");
         ap_daemons_limit = 1;
     }
@@ -2089,7 +2089,7 @@
 }
 
 static const char *set_threads_per_child (cmd_parms *cmd, void *dummy,
-                                          const char *arg) 
+                                          const char *arg)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
@@ -2098,29 +2098,29 @@
 
     ap_threads_per_child = atoi(arg);
     if (ap_threads_per_child > thread_limit) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      "WARNING: ThreadsPerChild of %d exceeds ThreadLimit "
                      "value of %d", ap_threads_per_child,
                      thread_limit);
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      "threads, lowering ThreadsPerChild to %d. To increase, please"
                      " see the", thread_limit);
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      " ThreadLimit directive.");
         ap_threads_per_child = thread_limit;
     }
     else if (ap_threads_per_child < 1) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      "WARNING: Require ThreadsPerChild > 0, setting to 1");
         ap_threads_per_child = 1;
     }
     return NULL;
 }
 
-static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *arg) 
+static const char *set_server_limit (cmd_parms *cmd, void *dummy, const char *arg)
 {
     int tmp_server_limit;
-    
+
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
         return err;
@@ -2140,27 +2140,27 @@
         return NULL;
     }
     server_limit = tmp_server_limit;
-    
+
     if (server_limit > MAX_SERVER_LIMIT) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: ServerLimit of %d exceeds compile time limit "
                     "of %d servers,", server_limit, MAX_SERVER_LIMIT);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " lowering ServerLimit to %d.", MAX_SERVER_LIMIT);
        server_limit = MAX_SERVER_LIMIT;
-    } 
+    }
     else if (server_limit < 1) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      "WARNING: Require ServerLimit > 0, setting to 1");
         server_limit = 1;
     }
     return NULL;
 }
 
-static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *arg) 
+static const char *set_thread_limit (cmd_parms *cmd, void *dummy, const char *arg)
 {
     int tmp_thread_limit;
-    
+
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
         return err;
@@ -2180,17 +2180,17 @@
         return NULL;
     }
     thread_limit = tmp_thread_limit;
-    
+
     if (thread_limit > MAX_THREAD_LIMIT) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: ThreadLimit of %d exceeds compile time limit "
                     "of %d servers,", thread_limit, MAX_THREAD_LIMIT);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " lowering ThreadLimit to %d.", MAX_THREAD_LIMIT);
        thread_limit = MAX_THREAD_LIMIT;
-    } 
+    }
     else if (thread_limit < 1) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      "WARNING: Require ThreadLimit > 0, setting to 1");
         thread_limit = 1;
     }

 

apache@apache.org
ViewVC Help
Powered by ViewVC 1.1.2