httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r332306 [10/14] - in /httpd/httpd/trunk: modules/aaa/ modules/arch/netware/ modules/arch/win32/ modules/cache/ modules/dav/fs/ modules/dav/lock/ modules/dav/main/ modules/debug/ modules/echo/ modules/experimental/ modules/filters/ modules/g...
Date Thu, 10 Nov 2005 15:13:26 GMT
Modified: httpd/httpd/trunk/server/mpm/mpmt_os2/mpmt_os2.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/mpmt_os2/mpmt_os2.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/mpmt_os2/mpmt_os2.c (original)
+++ httpd/httpd/trunk/server/mpm/mpmt_os2/mpmt_os2.c Thu Nov 10 07:11:44 2005
@@ -58,8 +58,8 @@
 #include <os2.h>
 #include <process.h>
 
-/* We don't need many processes, 
- * they're only for redundancy in the event of a crash 
+/* We don't need many processes,
+ * they're only for redundancy in the event of a crash
  */
 #define HARD_SERVER_LIMIT 10
 
@@ -441,10 +441,10 @@
             return APR_SUCCESS;
         case AP_MPMQ_MAX_REQUESTS_DAEMON:
             *result = ap_max_requests_per_child;
-            return APR_SUCCESS; 
+            return APR_SUCCESS;
     }
     return APR_ENOTIMPL;
-} 
+}
 
 
 
@@ -459,7 +459,7 @@
 
 static int mpmt_os2_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
 {
-    one_process = ap_exists_config_define("ONE_PROCESS") || 
+    one_process = ap_exists_config_define("ONE_PROCESS") ||
                   ap_exists_config_define("DEBUG");
     is_graceful = 0;
     ap_listen_pre_config();
@@ -512,15 +512,15 @@
     ap_min_spare_threads = atoi(arg);
 
     if (ap_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.");
        ap_min_spare_threads = 1;
     }
-       
+
     return NULL;
 }
 
@@ -550,7 +550,7 @@
 
 static const command_rec mpmt_os2_cmds[] = {
 LISTEN_COMMANDS,
-AP_INIT_TAKE1( "StartServers", set_daemons_to_start, NULL, RSRC_CONF, 
+AP_INIT_TAKE1( "StartServers", set_daemons_to_start, NULL, RSRC_CONF,
   "Number of child processes launched at server startup" ),
 AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF,
   "Minimum number of idle children, to handle request spikes"),

Modified: httpd/httpd/trunk/server/mpm/mpmt_os2/mpmt_os2_child.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/mpmt_os2/mpmt_os2_child.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/mpmt_os2/mpmt_os2_child.c (original)
+++ httpd/httpd/trunk/server/mpm/mpmt_os2/mpmt_os2_child.c Thu Nov 10 07:11:44 2005
@@ -39,8 +39,8 @@
 
 /* XXXXXX move these to header file private to this MPM */
 
-/* We don't need many processes, 
- * they're only for redundancy in the event of a crash 
+/* We don't need many processes,
+ * they're only for redundancy in the event of a crash
  */
 #define HARD_SERVER_LIMIT 10
 
@@ -332,7 +332,7 @@
         kill(getpid(), SIGHUP);
         DosUnwindException(UNWIND_ALL, 0, 0);
     }
-  
+
     return XCPT_CONTINUE_SEARCH;
 }
 
@@ -355,7 +355,7 @@
     int thread_slot = (int)vpArg;
     EXCEPTIONREGISTRATIONRECORD reg_rec = { NULL, thread_exception_handler };
     ap_sb_handle_t *sbh;
-  
+
     /* Trap exceptions in this thread so we don't take down the whole process */
     DosSetExceptionHandler( &reg_rec );
 
@@ -369,7 +369,7 @@
     }
 
     conn_id = ID_FROM_CHILD_THREAD(child_slot, thread_slot);
-    ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_READY, 
+    ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_READY,
                                         NULL);
 
     apr_allocator_create(&allocator);
@@ -390,11 +390,11 @@
         }
 
         apr_pool_destroy(pconn);
-        ap_update_child_status_from_indexes(child_slot, thread_slot, 
+        ap_update_child_status_from_indexes(child_slot, thread_slot,
                                             SERVER_READY, NULL);
     }
 
-    ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_DEAD, 
+    ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_DEAD,
                                         NULL);
 
     apr_bucket_alloc_destroy(bucket_alloc);

Modified: httpd/httpd/trunk/server/mpm/netware/mpm_netware.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/netware/mpm_netware.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/netware/mpm_netware.c (original)
+++ httpd/httpd/trunk/server/mpm/netware/mpm_netware.c Thu Nov 10 07:11:44 2005
@@ -17,15 +17,15 @@
 /*
  * httpd.c: simple http daemon for answering WWW file requests
  *
- * 
+ *
  * 03-21-93  Rob McCool wrote original code (up to NCSA HTTPd 1.3)
- * 
+ *
  * 03-06-95  blong
  *  changed server number for child-alone processes to 0 and changed name
  *   of processes
  *
  * 03-10-95  blong
- *      Added numerous speed hacks proposed by Robert S. Thau (rst@ai.mit.edu) 
+ *      Added numerous speed hacks proposed by Robert S. Thau (rst@ai.mit.edu)
  *      including set group before fork, and call gettime before to fork
  *      to set up libraries.
  *
@@ -174,9 +174,9 @@
 ap_generation_t volatile ap_my_generation=0;
 
 /* a clean exit from a child with proper cleanup */
-static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans, 
+static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans,
                              apr_bucket_alloc_t *bucket_alloc) __attribute__ ((noreturn));
-static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans, 
+static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans,
                              apr_bucket_alloc_t *bucket_alloc)
 {
     apr_bucket_alloc_destroy(bucket_alloc);
@@ -186,7 +186,7 @@
 
     atomic_dec (&worker_thread_count);
     if (worker_num >=0)
-        ap_update_child_status_from_indexes(0, worker_num, WORKER_DEAD, 
+        ap_update_child_status_from_indexes(0, worker_num, WORKER_DEAD,
                                             (request_rec *) NULL);
     NXThreadExit((void*)&code);
 }
@@ -370,7 +370,7 @@
             clean_child_exit(0, my_worker_num, ptrans, bucket_alloc);
         }
 
-        ap_update_child_status_from_indexes(0, my_worker_num, WORKER_READY, 
+        ap_update_child_status_from_indexes(0, my_worker_num, WORKER_READY,
                                             (request_rec *) NULL);
 
         /*
@@ -431,7 +431,7 @@
                 }
                 else {
                     /* if the error is a wouldblock then maybe we were too
-                        quick try to pull the next request from the listen 
+                        quick try to pull the next request from the listen
                         queue.  Try a few more times then return to our idle
                         listen state. */
                     if (!APR_STATUS_IS_EAGAIN(stat)) {
@@ -490,7 +490,7 @@
                         */
                         ap_log_error(APLOG_MARK, APLOG_EMERG, stat, ap_server_conf,
                             "apr_socket_accept: giving up.");
-                        clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, ptrans, 
+                        clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, ptrans,
                                          bucket_alloc);
                 }
 #endif
@@ -507,7 +507,7 @@
         * We now have a connection, so set it up with the appropriate
         * socket options, file descriptors, and read/write buffers.
         */
-        current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd, 
+        current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd,
                                                 my_worker_num, sbh,
                                                 bucket_alloc);
         if (current_conn) {
@@ -530,7 +530,7 @@
         ap_max_workers_limit = slot + 1;
     }
 
-    ap_update_child_status_from_indexes(0, slot, WORKER_STARTING, 
+    ap_update_child_status_from_indexes(0, slot, WORKER_STARTING,
                                         (request_rec *) NULL);
 
     if (ctx = NXContextAlloc((void (*)(void *)) worker_main, (void*)slot, NX_PRIO_MED, ap_thread_stacksize, NX_CTX_NORMAL, &err)) {
@@ -548,7 +548,7 @@
         /* create thread didn't succeed. Fix the scoreboard or else
         * it will say SERVER_STARTING forever and ever
         */
-        ap_update_child_status_from_indexes(0, slot, WORKER_DEAD, 
+        ap_update_child_status_from_indexes(0, slot, WORKER_DEAD,
                                             (request_rec *) NULL);
 
         /* In case system resources are maxxed out, we don't want
@@ -661,7 +661,7 @@
         * while we were counting
         */
         idle_spawn_rate = 1;
-        ap_update_child_status_from_indexes(0, last_non_dead, WORKER_IDLE_KILL, 
+        ap_update_child_status_from_indexes(0, last_non_dead, WORKER_IDLE_KILL,
                                             (request_rec *) NULL);
         DBPRINT1("\nKilling idle thread: %d\n", last_non_dead);
     }
@@ -716,9 +716,9 @@
     int reqs = request_count;
 #ifdef DBINFO_ON
     int wblock = would_block;
-    
+
     would_block = 0;
-#endif    
+#endif
 
     request_count = 0;
 
@@ -779,7 +779,7 @@
     }
     printf ("Total Running:\t%d\tout of: \t%d\n", total, ap_threads_limit);
     printf ("Requests per interval:\t%d\n", reqs);
-    
+
 #ifdef DBINFO_ON
     printf ("Would blocks:\t%d\n", wblock);
     printf ("Successful retries:\t%d\n", retry_success);
@@ -805,9 +805,9 @@
        printf(" %d", lr->bind_addr->port);
        lr = lr->next;
     } while(lr && lr != ap_listeners);
-    
+
     /* Display dynamic modules loaded */
-    printf("\n");    
+    printf("\n");
     for (m = ap_loaded_modules; *m != NULL; m++) {
         if (((module*)*m)->dynamic_load_handle) {
             printf("   Loaded dynamic module %s\n", ((module*)*m)->name);
@@ -921,7 +921,7 @@
     mpm_state = AP_MPMQ_STOPPING;
 
 
-    /* Shutdown the listen sockets so that we don't get stuck in a blocking call. 
+    /* Shutdown the listen sockets so that we don't get stuck in a blocking call.
     shutdown_listeners();*/
 
     if (shutdown_pending) { /* Got an unload from the console */
@@ -929,7 +929,7 @@
             "caught SIGTERM, shutting down");
 
         while (worker_thread_count > 0) {
-            printf ("\rShutdown pending. Waiting for %d thread(s) to terminate...", 
+            printf ("\rShutdown pending. Waiting for %d thread(s) to terminate...",
                     worker_thread_count);
             apr_thread_yield();
         }
@@ -1000,7 +1000,7 @@
     ap_hook_pre_config(netware_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
 }
 
-void netware_rewrite_args(process_rec *process) 
+void netware_rewrite_args(process_rec *process)
 {
     char *def_server_root;
     char optbuf[3];
@@ -1015,10 +1015,10 @@
     /* Make sure to hold the Apache screen open if exit() is called */
     hold_screen_on_exit = 1;
 
-    /* Rewrite process->argv[]; 
+    /* Rewrite process->argv[];
      *
      * add default -d serverroot from the path of this executable
-     * 
+     *
      * The end result will look like:
      *     The -d serverroot default from the running executable
      */
@@ -1030,14 +1030,14 @@
             for (i=len; i; i--) {
                 if (s[i] == '\\' || s[i] == '/') {
                     s[i] = '\0';
-                    apr_filepath_merge(&def_server_root, NULL, s, 
+                    apr_filepath_merge(&def_server_root, NULL, s,
                         APR_FILEPATH_TRUENAME, process->pool);
                     break;
                 }
             }
             /* Use process->pool so that the rewritten argv
             * lasts for the lifetime of the server process,
-            * because pconf will be destroyed after the 
+            * because pconf will be destroyed after the
             * initial pre-flight of the config parser.
             */
             mpm_new_argv = apr_array_make(process->pool, process->argc + 2,
@@ -1069,7 +1069,7 @@
                     break;
                 }
             }
-            process->argc = mpm_new_argv->nelts; 
+            process->argc = mpm_new_argv->nelts;
             process->argv = (const char * const *) mpm_new_argv->elts;
         }
     }
@@ -1096,14 +1096,14 @@
     if (!strnicmp(szCommand, szcommandLine, iCommandLen)) {
         ActivateScreen (getscreenhandle());
 
-        /* If an instance id was not given but the nlm is loaded in 
+        /* If an instance id was not given but the nlm is loaded in
             protected space, then the the command belongs to the
             OS address space instance to pass it on. */
         pID = strstr (szcommandLine, "-p");
         if ((pID == NULL) && nlmisloadedprotected())
             return NOTMYCOMMAND;
 
-        /* If we got an instance id but it doesn't match this 
+        /* If we got an instance id but it doesn't match this
             instance of the nlm, pass it on. */
         if (pID) {
             pID = &pID[2];
@@ -1195,7 +1195,7 @@
     NX_UNWRAP_INTERFACE(ConsoleHandler.parser);
 }
 
-static const char *set_threads_to_start(cmd_parms *cmd, void *dummy, const char *arg) 
+static const char *set_threads_to_start(cmd_parms *cmd, void *dummy, const char *arg)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
@@ -1215,15 +1215,15 @@
 
     ap_threads_min_free = atoi(arg);
     if (ap_threads_min_free <= 0) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: detected MinSpareServers 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.");
        ap_threads_min_free = 1;
     }
-       
+
     return NULL;
 }
 
@@ -1238,7 +1238,7 @@
     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)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
@@ -1247,19 +1247,19 @@
 
     ap_threads_limit = atoi(arg);
     if (ap_threads_limit > HARD_THREAD_LIMIT) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: MaxThreads of %d exceeds compile time limit "
                     "of %d threads,", ap_threads_limit, HARD_THREAD_LIMIT);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " lowering MaxThreads to %d.  To increase, please "
                     "see the", HARD_THREAD_LIMIT);
        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " HARD_THREAD_LIMIT define in %s.",
                     AP_MPM_HARD_LIMITS_FILE);
        ap_threads_limit = HARD_THREAD_LIMIT;
-    } 
+    }
     else if (ap_threads_limit < 1) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
             "WARNING: Require MaxThreads > 0, setting to 1");
         ap_threads_limit = 1;
     }

Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
+++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Thu Nov 10 07:11:44 2005
@@ -104,7 +104,7 @@
 
 /*
  * The max child slot ever assigned, preserved across restarts.  Necessary
- * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts.  We 
+ * 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;
@@ -141,7 +141,7 @@
 static volatile int die_now = 0;
 
 #ifdef GPROF
-/* 
+/*
  * change directory for gprof to plop the gmon.out file
  * configure in httpd.conf:
  * GprofDir $RuntimeDir/   -> $ServerRoot/$RuntimeDir/gmon.out
@@ -149,8 +149,8 @@
  */
 static void chdir_for_gprof(void)
 {
-    core_server_config *sconf = 
-        ap_get_module_config(ap_server_conf->module_config, &core_module); 
+    core_server_config *sconf =
+        ap_get_module_config(ap_server_conf->module_config, &core_module);
     char *dir = sconf->gprof_dir;
     const char *use_dir;
 
@@ -184,7 +184,7 @@
 
 /* XXX - I don't know if TPF will ever use this module or not, so leave
  * the ap_check_signals calls in but disable them - manoj */
-#define ap_check_signals() 
+#define ap_check_signals()
 
 /* a clean exit from a child with proper cleanup */
 static void clean_child_exit(int code) __attribute__ ((noreturn));
@@ -206,7 +206,7 @@
     if (rv != APR_SUCCESS) {
         const char *msg = "couldn't grab the accept mutex";
 
-        if (ap_my_generation != 
+        if (ap_my_generation !=
             ap_scoreboard_image->global->running_generation) {
             ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg);
             clean_child_exit(0);
@@ -224,7 +224,7 @@
     if (rv != APR_SUCCESS) {
         const char *msg = "couldn't release the accept mutex";
 
-        if (ap_my_generation != 
+        if (ap_my_generation !=
             ap_scoreboard_image->global->running_generation) {
             ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg);
             /* don't exit here... we have a connection to
@@ -386,7 +386,7 @@
         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
@@ -409,7 +409,7 @@
         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);
@@ -478,7 +478,7 @@
     mpm_state = AP_MPMQ_STARTING; /* for benefit of any hooks that run as this
                                    * child initializes
                                    */
-    
+
     my_child_num = child_num_arg;
     ap_my_pid = getpid();
     requests_this_child = 0;
@@ -533,7 +533,7 @@
     }
 
     mpm_state = AP_MPMQ_RUNNING;
-    
+
     bucket_alloc = apr_bucket_alloc_create(pchild);
 
     while (!die_now) {
@@ -640,7 +640,7 @@
             ap_process_connection(current_conn, csd);
             ap_lingering_close(current_conn);
         }
-        
+
         /* Check the pod and the generation number after processing a
          * connection so that we'll go away if a graceful restart occurred
          * while we were processing the connection or we are the lucky
@@ -715,10 +715,10 @@
         /* by default AIX binds to a single processor
          * this bit unbinds children which will then bind to another cpu
          */
-        int status = bindprocessor(BINDPROCESS, (int)getpid(), 
+        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
@@ -729,7 +729,7 @@
          */
         apr_signal(SIGHUP, just_die);
         apr_signal(SIGTERM, just_die);
-        /* The child process just closes listeners on AP_SIG_GRACEFUL.  
+        /* The child process just closes listeners on AP_SIG_GRACEFUL.
          * The pod is used for signalling the graceful restart.
          */
         apr_signal(AP_SIG_GRACEFUL, stop_listening);
@@ -912,7 +912,7 @@
                                  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,
@@ -923,7 +923,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) {
@@ -996,7 +996,7 @@
     restart_pending = shutdown_pending = 0;
 
     mpm_state = AP_MPMQ_RUNNING;
-    
+
     while (!restart_pending && !shutdown_pending) {
         int child_slot;
         apr_exit_why_e exitwhy;
@@ -1024,9 +1024,9 @@
                                                            (request_rec *) NULL);
                 if (processed_status == APEXIT_CHILDSICK) {
                     /* child detected a resource shortage (E[NM]FILE, ENOBUFS, etc)
-                     * cut the fork rate to the minimum 
+                     * cut the fork rate to the minimum
                      */
-                    idle_spawn_rate = 1; 
+                    idle_spawn_rate = 1;
                 }
                 else if (remaining_children_to_start
                     && child_slot < ap_daemons_limit) {
@@ -1047,7 +1047,7 @@
                  * scoreboard.  Somehow we don't know about this
                  * child.
                  */
-                ap_log_error(APLOG_MARK, APLOG_WARNING, 
+                ap_log_error(APLOG_MARK, APLOG_WARNING,
                             0, ap_server_conf,
                             "long lost child came home! (pid %ld)", (long)pid.pid);
             }
@@ -1150,7 +1150,7 @@
            "caught " AP_SIG_GRACEFUL_STOP_STRING ", shutting down gracefully");
 
         if (ap_graceful_shutdown_timeout) {
-            cutoff = apr_time_now() + 
+            cutoff = apr_time_now() +
                      apr_time_from_sec(ap_graceful_shutdown_timeout);
         }
 
@@ -1159,10 +1159,10 @@
         do {
             /* Pause for a second */
             sleep(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) {
@@ -1199,7 +1199,7 @@
      */
     ++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,
                     "Graceful restart requested, doing restart");
@@ -1250,7 +1250,7 @@
     ap_server_conf = s;
 
     if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) {
-        ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_STARTUP, 0, 
+        ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_STARTUP, 0,
                      NULL, "no listening sockets available, shutting down");
         return DONE;
     }
@@ -1339,7 +1339,7 @@
     ap_hook_pre_config(prefork_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST);
 }
 
-static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, const char *arg) 
+static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, const char *arg)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
@@ -1359,15 +1359,15 @@
 
     ap_daemons_min_free = atoi(arg);
     if (ap_daemons_min_free <= 0) {
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "WARNING: detected MinSpareServers 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.");
        ap_daemons_min_free = 1;
     }
-       
+
     return NULL;
 }
 
@@ -1382,7 +1382,7 @@
     return NULL;
 }
 
-static const char *set_max_clients (cmd_parms *cmd, void *dummy, const char *arg) 
+static const char *set_max_clients (cmd_parms *cmd, void *dummy, const char *arg)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
@@ -1391,28 +1391,28 @@
 
     ap_daemons_limit = atoi(arg);
     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 exceeds ServerLimit value "
                     "of %d servers,", ap_daemons_limit, server_limit);
-       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " lowering MaxClients to %d.  To increase, please "
                     "see the ServerLimit", server_limit);
        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     " 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;
     }
     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;
@@ -1432,17 +1432,17 @@
         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;
     }

Modified: httpd/httpd/trunk/server/mpm/winnt/Win9xConHook.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/winnt/Win9xConHook.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/Win9xConHook.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/Win9xConHook.c Thu Nov 10 07:11:44 2005
@@ -21,16 +21,16 @@
  *
  * It is well(?) documented by Microsoft that the Win9x HandlerRoutine
  * hooked by the SetConsoleCtrlHandler never receives the CTRL_CLOSE_EVENT,
- * CTRL_LOGOFF_EVENT or CTRL_SHUTDOWN_EVENT signals.  
+ * CTRL_LOGOFF_EVENT or CTRL_SHUTDOWN_EVENT signals.
  *
- * It is possible to have a second window to monitor the WM_ENDSESSION 
+ * It is possible to have a second window to monitor the WM_ENDSESSION
  * message, but the close button still fails..
- * 
+ *
  * There is a 16bit polling method for the close window option, but this
  * is CPU intensive and requires thunking.
  *
  * Attempts to subclass the 'tty' console fail, since that message thread
- * is actually owned by the 16 bit winoldap.mod process, although the 
+ * is actually owned by the 16 bit winoldap.mod process, although the
  * window reports it is owned by the process/thread of the console app.
  *
  * Win9xConHook is thunks the WM_CLOSE and WM_ENDSESSION messages,
@@ -102,16 +102,16 @@
 #define gwltty_phandler 0
 #define gwltty_ttywnd 4
 
-/* Forward declaration prototypes for internal functions 
+/* Forward declaration prototypes for internal functions
  */
 static BOOL CALLBACK EnumttyWindow(HWND wnd, LPARAM retwnd);
 static LRESULT WINAPI RegisterWindows9xService(BOOL set_service);
-static LRESULT CALLBACK ttyConsoleCtrlWndProc(HWND hwnd, UINT msg, 
+static LRESULT CALLBACK ttyConsoleCtrlWndProc(HWND hwnd, UINT msg,
                                               WPARAM wParam, LPARAM lParam);
 static DWORD WINAPI ttyConsoleCtrlThread(LPVOID tty);
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, 
+static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
                                 WPARAM wParam, LPARAM lParam);
-static int HookProc(int hc, HWND *hwnd, UINT *msg, 
+static int HookProc(int hc, HWND *hwnd, UINT *msg,
                     WPARAM *wParam, LPARAM *lParam);
 #ifdef DBG
 static VOID DbgPrintf(LPTSTR fmt, ...);
@@ -122,10 +122,10 @@
  * by our window hooks, notably the tty processes' context, and by the user
  * who wants tty messages (the app).  Keep it light and simple.
  */
-BOOL __declspec(dllexport) APIENTRY DllMain(HINSTANCE hModule, ULONG ulReason, 
+BOOL __declspec(dllexport) APIENTRY DllMain(HINSTANCE hModule, ULONG ulReason,
                                             LPVOID pctx)
 {
-    if (ulReason == DLL_PROCESS_ATTACH) 
+    if (ulReason == DLL_PROCESS_ATTACH)
     {
         //hmodThis = hModule;
         if (!hookwndmsg) {
@@ -134,18 +134,18 @@
             hookwndmsg = RegisterWindowMessage("Win9xConHookMsg");
         }
 #ifdef DBG
-//        DbgPrintf("H ProcessAttach:%8.8x\r\n", 
+//        DbgPrintf("H ProcessAttach:%8.8x\r\n",
 //                  GetCurrentProcessId());
 #endif
     }
-    else if ( ulReason == DLL_PROCESS_DETACH ) 
+    else if ( ulReason == DLL_PROCESS_DETACH )
     {
 #ifdef DBG
-//        DbgPrintf("H ProcessDetach:%8.8x\r\n", GetCurrentProcessId());                
+//        DbgPrintf("H ProcessDetach:%8.8x\r\n", GetCurrentProcessId());
 #endif
         if (monitor_hwnd)
             SendMessage(monitor_hwnd, WM_DESTROY, 0, 0);
-        if (is_subclassed) 
+        if (is_subclassed)
             SendMessage(hwtty, hookwndmsg, 0, (LPARAM)hwtty);
         if (hmodHook)
         {
@@ -254,12 +254,12 @@
             tty.name = "ttyService";
             RegisterWindows9xService(TRUE);
         }
-        else 
+        else
             tty.name = "ttyMonitor";
         hThread = CreateThread(NULL, 0, ttyConsoleCtrlThread,
                                (LPVOID)&tty, 0, &tid);
         if (!hThread)
-            return FALSE;        
+            return FALSE;
         CloseHandle(hThread);
         hmodHook = LoadLibrary("Win9xConHook.dll");
         if (hmodHook)
@@ -268,7 +268,7 @@
               (HOOKPROC)GetProcAddress(hmodHook, "GetMsgProc"), hmodHook, 0);
             //hhkCallWndProc = SetWindowsHookEx(WH_CALLWNDPROC,
             //  (HOOKPROC)GetProcAddress(hmodHook, "CallWndProc"), hmodHook, 0);
-        }        
+        }
         return TRUE;
     }
     else /* remove */
@@ -302,7 +302,7 @@
 
 /* ttyConsoleCreateThread is the process that runs within the user app's
  * context.  It creates and pumps the messages of a hidden monitor window,
- * watching for messages from the system, or the associated subclassed tty 
+ * watching for messages from the system, or the associated subclassed tty
  * window.  Things can happen in our context that can't be done from the
  * tty's context, and visa versa, so the subclass procedure and this hidden
  * window work together to make it all happen.
@@ -312,9 +312,9 @@
     WNDCLASS wc;
     MSG msg;
     wc.style         = CS_GLOBALCLASS;
-    wc.lpfnWndProc   = ttyConsoleCtrlWndProc; 
+    wc.lpfnWndProc   = ttyConsoleCtrlWndProc;
     wc.cbClsExtra    = 0;
-    wc.cbWndExtra    = 8; 
+    wc.cbWndExtra    = 8;
     wc.hInstance     = NULL;
     wc.hIcon         = NULL;
     wc.hCursor       = NULL;
@@ -324,33 +324,33 @@
         wc.lpszClassName = "ttyConHookChild";
     else
         wc.lpszClassName = "ApacheWin95ServiceMonitor";
-        
-    if (!RegisterClass(&wc)) { 
+
+    if (!RegisterClass(&wc)) {
 #ifdef DBG
-        DbgPrintf("A proc %8.8x Error creating class %s (%d)\r\n", 
+        DbgPrintf("A proc %8.8x Error creating class %s (%d)\r\n",
                   GetCurrentProcessId(), wc.lpszClassName, GetLastError());
 #endif
         return 0;
     }
 
     /* Create an invisible window */
-    monitor_hwnd = CreateWindow(wc.lpszClassName, ((tty_info*)tty)->name, 
+    monitor_hwnd = CreateWindow(wc.lpszClassName, ((tty_info*)tty)->name,
                                 WS_OVERLAPPED & ~WS_VISIBLE,
-                                CW_USEDEFAULT, CW_USEDEFAULT, 
-                                CW_USEDEFAULT, CW_USEDEFAULT, 
-                                NULL, NULL, 
+                                CW_USEDEFAULT, CW_USEDEFAULT,
+                                CW_USEDEFAULT, CW_USEDEFAULT,
+                                NULL, NULL,
                                 ((tty_info*)tty)->instance, tty);
 
     if (!monitor_hwnd) {
 #ifdef DBG
-        DbgPrintf("A proc %8.8x Error creating window %s %s (%d)\r\n", 
-                  GetCurrentProcessId(), wc.lpszClassName, 
+        DbgPrintf("A proc %8.8x Error creating window %s %s (%d)\r\n",
+                  GetCurrentProcessId(), wc.lpszClassName,
                   ((tty_info*)tty)->name, GetLastError());
 #endif
         return 0;
     }
 
-    while (GetMessage(&msg, NULL, 0, 0)) 
+    while (GetMessage(&msg, NULL, 0, 0))
     {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
@@ -365,10 +365,10 @@
 /* This is the WndProc procedure for our invisible window.
  * When our subclasssed tty window receives the WM_CLOSE, WM_ENDSESSION,
  * or WM_QUERYENDSESSION messages, the message is dispatched to our hidden
- * window (this message process), and we call the installed HandlerRoutine 
+ * window (this message process), and we call the installed HandlerRoutine
  * that was registered by the app.
  */
-static LRESULT CALLBACK ttyConsoleCtrlWndProc(HWND hwnd, UINT msg, 
+static LRESULT CALLBACK ttyConsoleCtrlWndProc(HWND hwnd, UINT msg,
                                               WPARAM wParam, LPARAM lParam)
 {
     if (msg == WM_CREATE)
@@ -377,14 +377,14 @@
         SetWindowLong(hwnd, gwltty_phandler, (LONG)tty->phandler);
         SetWindowLong(hwnd, gwltty_ttywnd, (LONG)tty->parent);
 #ifdef DBG
-        DbgPrintf("A proc %8.8x created %8.8x %s for tty wnd %8.8x\r\n", 
-                  GetCurrentProcessId(), hwnd, 
+        DbgPrintf("A proc %8.8x created %8.8x %s for tty wnd %8.8x\r\n",
+                  GetCurrentProcessId(), hwnd,
                   tty->name, tty->parent);
 #endif
         if (tty->parent) {
             SetProp(tty->parent, hookwndprop, hwnd);
-            PostMessage(tty->parent, hookwndmsg, 
-                        tty->type, (LPARAM)tty->parent); 
+            PostMessage(tty->parent, hookwndmsg,
+                        tty->type, (LPARAM)tty->parent);
         }
         return 0;
     }
@@ -397,13 +397,13 @@
 #endif
         if (parent) {
             RemoveProp(parent, hookwndprop);
-            SendMessage(parent, hookwndmsg, 0, (LPARAM)parent); 
+            SendMessage(parent, hookwndmsg, 0, (LPARAM)parent);
         }
         monitor_hwnd = NULL;
     }
     else if (msg == WM_CLOSE)
     {
-        PHANDLER_ROUTINE phandler = 
+        PHANDLER_ROUTINE phandler =
             (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler);
         LRESULT rv = phandler(CTRL_CLOSE_EVENT);
 #ifdef DBG
@@ -416,9 +416,9 @@
     }
     else if ((msg == WM_QUERYENDSESSION) || (msg == WM_ENDSESSION))
     {
-        if (lParam & ENDSESSION_LOGOFF) 
+        if (lParam & ENDSESSION_LOGOFF)
         {
-            PHANDLER_ROUTINE phandler = 
+            PHANDLER_ROUTINE phandler =
                 (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler);
             LRESULT rv = phandler(CTRL_LOGOFF_EVENT);
 #ifdef DBG
@@ -431,7 +431,7 @@
         }
         else
         {
-            PHANDLER_ROUTINE phandler = 
+            PHANDLER_ROUTINE phandler =
                 (PHANDLER_ROUTINE)GetWindowLong(hwnd, gwltty_phandler);
             LRESULT rv = phandler(CTRL_SHUTDOWN_EVENT);
 #ifdef DBG
@@ -449,7 +449,7 @@
 /*  The following internal helpers are invoked by the hooked tty and our app
  */
 
- 
+
 /*  Register or deregister the current process as a Windows9x style service.
  *  Experience shows this call is ignored across processes, so the second
  *  arg to RegisterServiceProcess (process group id) is effectively useless.
@@ -475,7 +475,7 @@
         hkernel = LoadLibrary("KERNEL32.DLL");
         if (!hkernel)
             return 0;
-    
+
         /* Find the RegisterServiceProcess function */
         register_service_process = (DWORD (WINAPI *)(DWORD, DWORD))
                          GetProcAddress(hkernel, "RegisterServiceProcess");
@@ -484,12 +484,12 @@
             return 0;
         }
     }
-    
+
     /* Register this process as a service */
     rv = register_service_process(0, set_service != FALSE);
     if (rv)
         is_service = set_service;
-    
+
     if (!is_service)
     {
         /* Unload the kernel library */
@@ -500,15 +500,15 @@
 }
 
 
-/* 
- * This function only works when this process is the active process 
- * (e.g. once it is running a child process, it can no longer determine 
+/*
+ * This function only works when this process is the active process
+ * (e.g. once it is running a child process, it can no longer determine
  * which console window is its own.)
  */
 static BOOL CALLBACK EnumttyWindow(HWND wnd, LPARAM retwnd)
 {
     char tmp[8];
-    if (GetClassName(wnd, tmp, sizeof(tmp)) && !strcmp(tmp, "tty")) 
+    if (GetClassName(wnd, tmp, sizeof(tmp)) && !strcmp(tmp, "tty"))
     {
         DWORD wndproc, thisproc = GetCurrentProcessId();
         GetWindowThreadProcessId(wnd, &wndproc);
@@ -534,19 +534,19 @@
  * to origwndprop property atom we set against the window when we
  * injected this subclass.  This trick did not work with simply a hook.
  */
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, 
+static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg,
                                 WPARAM wParam, LPARAM lParam)
 {
     WNDPROC origproc = (WNDPROC) GetProp(hwnd, origwndprop);
     if (!origproc)
         return 0;
 
-    if (msg == WM_NCDESTROY 
+    if (msg == WM_NCDESTROY
         || (msg == hookwndmsg && !LOWORD(wParam) && (HWND)lParam == hwnd))
     {
         if (is_subclassed) {
 #ifdef DBG
-            DbgPrintf("W proc %08x hwnd:%08x Subclass removed\r\n", 
+            DbgPrintf("W proc %08x hwnd:%08x Subclass removed\r\n",
                       GetCurrentProcessId(), hwnd);
 #endif
             if (is_service)
@@ -560,13 +560,13 @@
             //hmodLock = NULL;
         }
     }
-    else if (msg == WM_CLOSE || msg == WM_ENDSESSION 
+    else if (msg == WM_CLOSE || msg == WM_ENDSESSION
                              || msg == WM_QUERYENDSESSION)
     {
         HWND child = (HWND)GetProp(hwnd, hookwndprop);
         if (child) {
 #ifdef DBG
-            DbgPrintf("W proc %08x hwnd:%08x forwarded msg:%d\r\n", 
+            DbgPrintf("W proc %08x hwnd:%08x forwarded msg:%d\r\n",
                       GetCurrentProcessId(), hwnd, msg);
 #endif
             return SendMessage(child, msg, wParam, lParam);
@@ -586,18 +586,18 @@
  */
 int HookProc(int hc, HWND *hwnd, UINT *msg, WPARAM *wParam, LPARAM *lParam)
 {
-    if (is_tty == -1 && *hwnd) 
+    if (is_tty == -1 && *hwnd)
     {
         char ttybuf[8];
         HWND htty;
         hwtty = *hwnd;
         while (htty = GetParent(hwtty))
             hwtty = htty;
-        is_tty = (GetClassName(hwtty, ttybuf, sizeof(ttybuf)) 
+        is_tty = (GetClassName(hwtty, ttybuf, sizeof(ttybuf))
                   && !strcmp(ttybuf, "tty"));
 #ifdef DBG
         if (is_tty)
-            DbgPrintf("H proc %08x tracking hwnd %08x\r\n", 
+            DbgPrintf("H proc %08x tracking hwnd %08x\r\n",
                       GetCurrentProcessId(), hwtty);
 #endif
     }
@@ -607,12 +607,12 @@
         WNDPROC origproc = (WNDPROC)GetWindowLong(hwtty, GWL_WNDPROC);
         //char myname[MAX_PATH];
         //if (GetModuleFileName(hmodThis, myname, sizeof(myname)))
-        //    hmodLock = LoadLibrary(myname);        
+        //    hmodLock = LoadLibrary(myname);
         SetProp(hwtty, origwndprop, origproc);
         SetWindowLong(hwtty, GWL_WNDPROC, (LONG)WndProc);
         is_subclassed = TRUE;
 #ifdef DBG
-        DbgPrintf("H proc %08x hwnd:%08x Subclassed\r\n", 
+        DbgPrintf("H proc %08x hwnd:%08x Subclassed\r\n",
                   GetCurrentProcessId(), hwtty);
 #endif
         if (LOWORD(*wParam) == 2)
@@ -626,7 +626,7 @@
 /*
  * PostMessage Hook:
  */
-LRESULT __declspec(dllexport) CALLBACK GetMsgProc(INT hc, WPARAM wParam, 
+LRESULT __declspec(dllexport) CALLBACK GetMsgProc(INT hc, WPARAM wParam,
                                                   LPARAM lParam)
 {
     PMSG pmsg;
@@ -634,12 +634,12 @@
     pmsg = (PMSG)lParam;
 
     if (pmsg) {
-        int rv = HookProc(hc, &pmsg->hwnd, &pmsg->message, 
+        int rv = HookProc(hc, &pmsg->hwnd, &pmsg->message,
                           &pmsg->wParam, &pmsg->lParam);
         if (rv != -1)
             return rv;
     }
-    /* 
+    /*
      * CallNextHookEx apparently ignores the hhook argument, so pass NULL
      */
     return CallNextHookEx(NULL, hc, wParam, lParam);
@@ -649,18 +649,18 @@
 /*
  * SendMessage Hook:
  */
-LRESULT __declspec(dllexport) CALLBACK CallWndProc(INT hc, WPARAM wParam, 
+LRESULT __declspec(dllexport) CALLBACK CallWndProc(INT hc, WPARAM wParam,
                                                    LPARAM lParam)
 {
     PCWPSTRUCT pcwps = (PCWPSTRUCT)lParam;
-    
+
     if (pcwps) {
-        int rv = HookProc(hc, &pcwps->hwnd, &pcwps->message, 
+        int rv = HookProc(hc, &pcwps->hwnd, &pcwps->message,
                           &pcwps->wParam, &pcwps->lParam);
         if (rv != -1)
             return rv;
     }
-    /* 
+    /*
      * CallNextHookEx apparently ignores the hhook argument, so pass NULL
      */
     return CallNextHookEx(NULL, hc, wParam, lParam);

Modified: httpd/httpd/trunk/server/mpm/winnt/child.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/winnt/child.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/child.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/child.c Thu Nov 10 07:11:44 2005
@@ -16,12 +16,12 @@
 
 #ifdef WIN32
 
-#define CORE_PRIVATE 
-#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 */ 
+#define CORE_PRIVATE
+#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 "apr_portable.h"
 #include "apr_thread_proc.h"
@@ -74,8 +74,8 @@
     /* Recycle the completion context.
      * - clear the ptrans pool
      * - put the context on the queue to be consumed by the accept thread
-     * Note: 
-     * context->accept_socket may be in a disconnected but reusable 
+     * Note:
+     * context->accept_socket may be in a disconnected but reusable
      * state so -don't- close it.
      */
     if (context) {
@@ -111,11 +111,11 @@
             ResetEvent(qwait_event);
         }
         apr_thread_mutex_unlock(qlock);
-  
+
         if (!context) {
             /* We failed to grab a context off the queue, consider allocating
-             * a new one out of the child pool. There may be up to 
-             * (ap_threads_per_child + num_listeners) contexts in the system 
+             * a new one out of the child pool. There may be up to
+             * (ap_threads_per_child + num_listeners) contexts in the system
              * at once.
              */
             if (num_completion_contexts >= max_num_completion_contexts) {
@@ -148,7 +148,7 @@
 
                 apr_thread_mutex_lock(child_lock);
                 context = (PCOMP_CONTEXT) apr_pcalloc(pchild, sizeof(COMP_CONTEXT));
-  
+
                 context->Overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
                 if (context->Overlapped.hEvent == NULL) {
                     /* Hopefully this is a temporary condition ... */
@@ -158,7 +158,7 @@
                     apr_thread_mutex_unlock(child_lock);
                     return NULL;
                 }
- 
+
                 /* Create the tranaction pool */
                 apr_allocator_create(&allocator);
                 apr_allocator_max_free_set(allocator, ap_max_mem_free);
@@ -173,10 +173,10 @@
                 }
                 apr_allocator_owner_set(allocator, context->ptrans);
                 apr_pool_tag(context->ptrans, "transaction");
- 
+
                 context->accept_socket = INVALID_SOCKET;
                 context->ba = apr_bucket_alloc_create(pchild);
-                apr_atomic_inc32(&num_completion_contexts); 
+                apr_atomic_inc32(&num_completion_contexts);
 
                 apr_thread_mutex_unlock(child_lock);
                 break;
@@ -190,7 +190,7 @@
     return context;
 }
 
-apr_status_t mpm_post_completion_context(PCOMP_CONTEXT context, 
+apr_status_t mpm_post_completion_context(PCOMP_CONTEXT context,
                                          io_state_e state)
 {
     LPOVERLAPPED pOverlapped;
@@ -206,7 +206,7 @@
 
 /*
  * find_ready_listener()
- * Only used by Win9* and should go away when the win9*_accept() function is 
+ * Only used by Win9* and should go away when the win9*_accept() function is
  * reimplemented using apr_poll().
  */
 static ap_listen_rec *head_listener;
@@ -236,19 +236,19 @@
 
 
 /* Windows 9x specific code...
- * Accept processing for on Windows 95/98 uses a producer/consumer queue 
- * model. A single thread accepts connections and queues the accepted socket 
+ * Accept processing for on Windows 95/98 uses a producer/consumer queue
+ * model. A single thread accepts connections and queues the accepted socket
  * to the accept queue for consumption by a pool of worker threads.
  *
  * win9x_accept()
- *    The accept threads runs this function, which accepts connections off 
+ *    The accept threads runs this function, which accepts connections off
  *    the network and calls add_job() to queue jobs to the accept_queue.
  * add_job()/remove_job()
- *    Add or remove an accepted socket from the list of sockets 
+ *    Add or remove an accepted socket from the list of sockets
  *    connected to clients. allowed_globals.jobmutex protects
  *    against multiple concurrent access to the linked list of jobs.
  * win9x_get_connection()
- *    Calls remove_job() to pull a job from the accept queue. All the worker 
+ *    Calls remove_job() to pull a job from the accept queue. All the worker
  *    threads block on remove_job.
  */
 
@@ -276,7 +276,7 @@
 
     new_job = (joblist *) malloc(sizeof(joblist));
     if (new_job == NULL) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      "Ouch!  Out of memory in add_job()!");
         return;
     }
@@ -340,7 +340,7 @@
     struct sockaddr_in sa_client;
 #endif
 
-    /* Setup the listeners 
+    /* Setup the listeners
      * ToDo: Use apr_poll()
      */
     FD_ZERO(&listenfds);
@@ -364,7 +364,7 @@
         rc = select(0, &main_fds, NULL, NULL, &tv);
 
         if (rc == 0 || (rc == SOCKET_ERROR && APR_STATUS_IS_EINTR(apr_get_netos_error()))) {
-            count_select_errors = 0;    /* reset count of errors */            
+            count_select_errors = 0;    /* reset count of errors */
             continue;
         }
         else if (rc == SOCKET_ERROR) {
@@ -372,7 +372,7 @@
              * select errors. This count is used to ensure we don't go into
              * a busy loop of continuous errors.
              */
-            ap_log_error(APLOG_MARK, APLOG_INFO, apr_get_netos_error(), ap_server_conf, 
+            ap_log_error(APLOG_MARK, APLOG_INFO, apr_get_netos_error(), ap_server_conf,
                          "select failed with error %d", apr_get_netos_error());
             count_select_errors++;
             if (count_select_errors > MAX_SELECT_ERRORS) {
@@ -435,18 +435,18 @@
         context->ba = apr_bucket_alloc_create(pchild);
         apr_thread_mutex_unlock(child_lock);
     }
-    
+
     while (1) {
-        apr_pool_clear(context->ptrans);        
+        apr_pool_clear(context->ptrans);
         context->accept_socket = remove_job();
         if (context->accept_socket == INVALID_SOCKET) {
             return NULL;
         }
         len = salen;
         context->sa_server = apr_palloc(context->ptrans, len);
-        if (getsockname(context->accept_socket, 
+        if (getsockname(context->accept_socket,
                         context->sa_server, &len)== SOCKET_ERROR) {
-            ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), ap_server_conf, 
+            ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), ap_server_conf,
                          "getsockname failed");
             continue;
         }
@@ -454,7 +454,7 @@
         context->sa_client = apr_palloc(context->ptrans, len);
         if ((getpeername(context->accept_socket,
                          context->sa_client, &len)) == SOCKET_ERROR) {
-            ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), ap_server_conf, 
+            ap_log_error(APLOG_MARK, APLOG_WARNING, apr_get_netos_error(), ap_server_conf,
                          "getpeername failed");
             memset(&context->sa_client, '\0', sizeof(context->sa_client));
         }
@@ -471,21 +471,21 @@
 
 
 /* Windows NT/2000 specific code...
- * Accept processing for on Windows NT uses a producer/consumer queue 
+ * Accept processing for on Windows NT uses a producer/consumer queue
  * model. An accept thread accepts connections off the network then issues
- * PostQueuedCompletionStatus() to awake a thread blocked on the ThreadDispatch 
+ * PostQueuedCompletionStatus() to awake a thread blocked on the ThreadDispatch
  * IOCompletionPort.
  *
  * winnt_accept()
- *    One or more accept threads run in this function, each of which accepts 
+ *    One or more accept threads run in this function, each of which accepts
  *    connections off the network and calls PostQueuedCompletionStatus() to
  *    queue an io completion packet to the ThreadDispatch IOCompletionPort.
  * winnt_get_connection()
- *    Worker threads block on the ThreadDispatch IOCompletionPort awaiting 
+ *    Worker threads block on the ThreadDispatch IOCompletionPort awaiting
  *    connections to service.
  */
 #define MAX_ACCEPTEX_ERR_COUNT 100
-static unsigned int __stdcall winnt_accept(void *lr_) 
+static unsigned int __stdcall winnt_accept(void *lr_)
 {
     ap_listen_rec *lr = (ap_listen_rec *)lr_;
     apr_os_sock_info_t sockinfo;
@@ -501,7 +501,7 @@
     apr_os_sock_get(&nlsd, lr->sd);
 
 #if APR_HAVE_IPV6
-    if (getsockname(nlsd, (struct sockaddr *)&ss_listen, &namelen) == SOCKET_ERROR) { 
+    if (getsockname(nlsd, (struct sockaddr *)&ss_listen, &namelen) == SOCKET_ERROR) {
         ap_log_error(APLOG_MARK,APLOG_ERR, apr_get_netos_error(), ap_server_conf,
                     "winnt_accept: getsockname error on listening socket, is IPv6 available?");
         return 1;
@@ -526,7 +526,7 @@
             context->accept_socket = socket(ss_listen.ss_family, SOCK_STREAM, IPPROTO_TCP);
             context->socket_family = ss_listen.ss_family;
         }
-        else if (context->socket_family != ss_listen.ss_family) { 
+        else if (context->socket_family != ss_listen.ss_family) {
             closesocket(context->accept_socket);
             context->accept_socket = socket(ss_listen.ss_family, SOCK_STREAM, IPPROTO_TCP);
             context->socket_family = ss_listen.ss_family;
@@ -552,13 +552,13 @@
             }
         }
 #endif
-        /* AcceptEx on the completion context. The completion context will be 
-         * signaled when a connection is accepted. 
+        /* AcceptEx on the completion context. The completion context will be
+         * signaled when a connection is accepted.
          */
         if (!AcceptEx(nlsd, context->accept_socket,
                       context->buff,
                       0,
-                      PADDED_ADDR_SIZE, 
+                      PADDED_ADDR_SIZE,
                       PADDED_ADDR_SIZE,
                       &BytesRead,
                       &context->Overlapped)) {
@@ -581,13 +581,13 @@
                                  "Possible causes: dynamic address renewal, or incompatible VPN or firewall software. "
                                  "Try using the Win32DisableAcceptEx directive.", my_pid);
                     err_count = 0;
-                }          
+                }
                 continue;
             }
             else if ((rv != APR_FROM_OS_ERROR(ERROR_IO_PENDING)) &&
                      (rv != APR_FROM_OS_ERROR(WSA_IO_PENDING))) {
                 ++err_count;
-                if (err_count > MAX_ACCEPTEX_ERR_COUNT) { 
+                if (err_count > MAX_ACCEPTEX_ERR_COUNT) {
                     ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf,
                                  "Child %d: Encountered too many errors accepting client connections. "
                                  "Possible causes: Unknown. "
@@ -598,9 +598,9 @@
                 context->accept_socket = INVALID_SOCKET;
                 continue;
             }
-            err_count = 0;  
+            err_count = 0;
 
-            /* Wait for pending i/o. 
+            /* Wait for pending i/o.
              * Wake up once per second to check for shutdown .
              * XXX: We should be waiting on exit_event instead of polling
              */
@@ -611,10 +611,10 @@
                         /* socket already closed */
                         break;
                     }
-                    if (!GetOverlappedResult((HANDLE)context->accept_socket, 
-                                             &context->Overlapped, 
+                    if (!GetOverlappedResult((HANDLE)context->accept_socket,
+                                             &context->Overlapped,
                                              &BytesRead, FALSE)) {
-                        ap_log_error(APLOG_MARK, APLOG_WARNING, 
+                        ap_log_error(APLOG_MARK, APLOG_WARNING,
                                      apr_get_os_error(), ap_server_conf,
                              "winnt_accept: Asynchronous AcceptEx failed.");
                         closesocket(context->accept_socket);
@@ -633,9 +633,9 @@
                 continue;
             }
         }
-        err_count = 0;  
-        /* Inherit the listen socket settings. Required for 
-         * shutdown() to work 
+        err_count = 0;
+        /* Inherit the listen socket settings. Required for
+         * shutdown() to work
          */
         if (setsockopt(context->accept_socket, SOL_SOCKET,
                        SO_UPDATE_ACCEPT_CONTEXT, (char *)&nlsd,
@@ -729,7 +729,7 @@
 
 /*
  * worker_main()
- * Main entry point for the worker threads. Worker threads block in 
+ * Main entry point for the worker threads. Worker threads block in
  * win*_get_connection() awaiting a connection to service.
  */
 static unsigned int __stdcall worker_main(void *thread_num_val)
@@ -752,7 +752,7 @@
         else {
             context = win9x_get_connection(context);
         }
-        
+
         if (!context) {
             /* Time for the thread to exit */
             break;
@@ -773,17 +773,17 @@
 
         if (c) {
             ap_process_connection(c, context->sock);
-            apr_socket_opt_get(context->sock, APR_SO_DISCONNECTED, 
+            apr_socket_opt_get(context->sock, APR_SO_DISCONNECTED,
                                &disconnected);
             if (!disconnected) {
                 context->accept_socket = INVALID_SOCKET;
                 ap_lingering_close(c);
             }
             else if (!use_acceptex) {
-                /* If the socket is disconnected but we are not using acceptex, 
+                /* If the socket is disconnected but we are not using acceptex,
                  * we cannot reuse the socket. Disconnected sockets are removed
                  * from the apr_socket_t struct by apr_sendfile() to prevent the
-                 * socket descriptor from being inadvertently closed by a call 
+                 * socket descriptor from being inadvertently closed by a call
                  * to apr_socket_close(), so close it directly.
                  */
                 closesocket(context->accept_socket);
@@ -796,7 +796,7 @@
         }
     }
 
-    ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD, 
+    ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD,
                                         (request_rec *) NULL);
 
     return 0;
@@ -815,8 +815,8 @@
 
 
 /*
- * child_main() 
- * Entry point for the main control thread for the child process. 
+ * child_main()
+ * Entry point for the main control thread for the child process.
  * This thread creates the accept thread, worker threads and
  * monitors the child process for maintenance and shutdown
  * events.
@@ -829,7 +829,7 @@
         _beginthreadex(NULL, 0, win9x_accept,
                        NULL, 0, &tid);
     } else {
-        /* Start an accept thread per listener 
+        /* Start an accept thread per listener
          * XXX: Why would we have a NULL sd in our listeners?
          */
         ap_listen_rec *lr;
@@ -838,7 +838,7 @@
          * (ap_threads_per_child + num_listeners). We need the additional
          * completion contexts to prevent server hangs when ThreadsPerChild
          * is configured to something less than or equal to the number
-         * of listeners. This is not a usual case, but people have 
+         * of listeners. This is not a usual case, but people have
          * encountered it.
          * */
         for (lr = ap_listeners; lr ; lr = lr->next) {
@@ -889,7 +889,7 @@
     child_events[1] = max_requests_per_child_event;
 
     allowed_globals.jobsemaphore = CreateSemaphore(NULL, 0, 1000000, NULL);
-    apr_thread_mutex_create(&allowed_globals.jobmutex, 
+    apr_thread_mutex_create(&allowed_globals.jobmutex,
                             APR_THREAD_MUTEX_DEFAULT, pchild);
 
     /*
@@ -903,7 +903,7 @@
                      "Child %d: Failed to acquire the start_mutex. Process will exit.", my_pid);
         exit(APEXIT_CHILDINIT);
     }
-    ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, 
+    ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                  "Child %d: Acquired the start mutex.", my_pid);
 
     /*
@@ -925,10 +925,10 @@
         }
     }
 
-    /* 
+    /*
      * Create the pool of worker threads
      */
-    ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, 
+    ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                  "Child %d: Starting %d worker threads.", my_pid, ap_threads_per_child);
     child_handles = (HANDLE) apr_pcalloc(pchild, ap_threads_per_child * sizeof(HANDLE));
     apr_thread_mutex_create(&child_lock, APR_THREAD_MUTEX_DEFAULT, pchild);
@@ -946,13 +946,13 @@
             if (child_handles[i] == 0) {
                 ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,
                              "Child %d: _beginthreadex failed. Unable to create all worker threads. "
-                             "Created %d of the %d threads requested with the ThreadsPerChild configuration directive.", 
+                             "Created %d of the %d threads requested with the ThreadsPerChild configuration directive.",
                              my_pid, threads_created, ap_threads_per_child);
                 ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
                 goto shutdown;
             }
             threads_created++;
-            /* Save the score board index in ht keyed to the thread handle. We need this 
+            /* Save the score board index in ht keyed to the thread handle. We need this
              * when cleaning up threads down below...
              */
             apr_thread_mutex_lock(child_lock);
@@ -979,11 +979,11 @@
     }
 
     /* Wait for one of three events:
-     * exit_event: 
-     *    The exit_event is signaled by the parent process to notify 
+     * exit_event:
+     *    The exit_event is signaled by the parent process to notify
      *    the child that it is time to exit.
      *
-     * max_requests_per_child_event: 
+     * max_requests_per_child_event:
      *    This event is signaled by the worker threads to indicate that
      *    the process has handled MaxRequestsPerChild connections.
      *
@@ -998,8 +998,8 @@
      *      named well, it's more like a_p_o_c_died.)
      *
      * XXX: however - if we get a_p_o_c handle inheritance working, and
-     *      the parent process creates other children and passes the pipes 
-     *      to our worker processes, then we have no business doing such 
+     *      the parent process creates other children and passes the pipes
+     *      to our worker processes, then we have no business doing such
      *      things in the child_main loop, but should happen in master_main.
      */
     while (1) {
@@ -1012,7 +1012,7 @@
         if (rv == WAIT_TIMEOUT) {
             apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING);
         }
-        else 
+        else
 #endif
             if (rv == WAIT_FAILED) {
             /* Something serious is wrong */
@@ -1039,14 +1039,14 @@
         }
     }
 
-    /* 
-     * Time to shutdown the child process 
+    /*
+     * Time to shutdown the child process
      */
 
  shutdown:
 
     winnt_mpm_state = AP_MPMQ_STOPPING;
-    /* Setting is_graceful will cause threads handling keep-alive connections 
+    /* Setting is_graceful will cause threads handling keep-alive connections
      * to close the connection after handling the current request.
      */
     is_graceful = 1;
@@ -1059,7 +1059,7 @@
         apr_socket_close(lr->sd);
     }
 
-    /* Shutdown listener threads and pending AcceptEx socksts 
+    /* Shutdown listener threads and pending AcceptEx socksts
      * but allow the worker threads to continue consuming from
      * the queue of accepted connections.
      */
@@ -1071,15 +1071,15 @@
     workers_may_exit = 1;
 
     /* Release the start_mutex to let the new process (in the restart
-     * scenario) a chance to begin accepting and servicing requests 
+     * scenario) a chance to begin accepting and servicing requests
      */
     rv = apr_proc_mutex_unlock(start_mutex);
     if (rv == APR_SUCCESS) {
-        ap_log_error(APLOG_MARK,APLOG_NOTICE, rv, ap_server_conf, 
+        ap_log_error(APLOG_MARK,APLOG_NOTICE, rv, ap_server_conf,
                      "Child %d: Released the start mutex", my_pid);
     }
     else {
-        ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf, 
+        ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf,
                      "Child %d: Failure releasing the start mutex", my_pid);
     }
 
@@ -1092,7 +1092,7 @@
     else { /* Windows NT/2000 */
         /* Post worker threads blocked on the ThreadDispatch IOCompletion port */
         while (g_blocked_threads > 0) {
-            ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, ap_server_conf, 
+            ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, ap_server_conf,
                          "Child %d: %d threads blocked on the completion port", my_pid, g_blocked_threads);
             for (i=g_blocked_threads; i > 0; i--) {
                 PostQueuedCompletionStatus(ThreadDispatchIOCP, 0, IOCP_SHUTDOWN, NULL);
@@ -1110,7 +1110,7 @@
     }
 
     /* Give busy worker threads a chance to service their connections */
-    ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, 
+    ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                  "Child %d: Waiting for %d worker threads to exit.", my_pid, threads_created);
     end_time = time(NULL) + 180;
     while (threads_created) {
@@ -1126,7 +1126,7 @@
 
     /* Kill remaining threads off the hard way */
     if (threads_created) {
-        ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, 
+        ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                      "Child %d: Terminating %d threads that failed to exit.",
                      my_pid, threads_created);
     }
@@ -1136,9 +1136,9 @@
         CloseHandle(child_handles[i]);
         /* Reset the scoreboard entry for the thread we just whacked */
         score_idx = apr_hash_get(ht, &child_handles[i], sizeof(HANDLE));
-        ap_update_child_status_from_indexes(0, *score_idx, SERVER_DEAD, NULL);        
+        ap_update_child_status_from_indexes(0, *score_idx, SERVER_DEAD, NULL);
     }
-    ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf, 
+    ap_log_error(APLOG_MARK,APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                  "Child %d: All worker threads have exited.", my_pid);
 
     CloseHandle(allowed_globals.jobsemaphore);



Mime
View raw message