httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r332306 [11/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/winnt/mpm_winnt.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.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"
@@ -71,7 +71,7 @@
 ap_generation_t volatile ap_my_generation=0;
 
 
-/* shared by service.c as global, although 
+/* shared by service.c as global, although
  * perhaps it should be private.
  */
 apr_pool_t *pconf;
@@ -85,7 +85,7 @@
  * so they ultimately should not be shared with child.c
  */
 extern apr_proc_mutex_t *start_mutex;
-extern HANDLE exit_event;  
+extern HANDLE exit_event;
 
 
 /* Stub functions until this MPM supports the connection status API */
@@ -107,11 +107,11 @@
     return NULL;
 }
 
-/* 
- * Command processors 
+/*
+ * Command processors
  */
 
-static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg) 
+static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
@@ -120,28 +120,28 @@
 
     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 threads,", ap_threads_per_child, 
+                     "value of %d threads,", ap_threads_per_child,
                      thread_limit);
         ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                      " 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_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;
@@ -161,23 +161,23 @@
         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 threads,", 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;
     }
     return NULL;
 }
-static const char *set_disable_acceptex(cmd_parms *cmd, void *dummy, char *arg) 
+static const char *set_disable_acceptex(cmd_parms *cmd, void *dummy, char *arg)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
     if (err != NULL) {
@@ -185,7 +185,7 @@
     }
     if (use_acceptex) {
         use_acceptex = 0;
-        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL,
                      "Disabled use of AcceptEx() WinSock2 API");
     }
     return NULL;
@@ -229,24 +229,24 @@
  * It can be called by any child or parent process, since it does not
  * rely on global variables.
  *
- * On entry, type gives the event to signal. 0 means shutdown, 1 means 
+ * On entry, type gives the event to signal. 0 means shutdown, 1 means
  * graceful restart.
  */
 /*
- * Initialise the signal names, in the global variables signal_name_prefix, 
+ * Initialise the signal names, in the global variables signal_name_prefix,
  * signal_restart_name and signal_shutdown_name.
  */
 #define MAX_SIGNAL_NAME 30  /* Long enough for apPID_shutdown, where PID is an int */
 char signal_name_prefix[MAX_SIGNAL_NAME];
-char signal_restart_name[MAX_SIGNAL_NAME]; 
+char signal_restart_name[MAX_SIGNAL_NAME];
 char signal_shutdown_name[MAX_SIGNAL_NAME];
 void setup_signal_names(char *prefix)
 {
-    apr_snprintf(signal_name_prefix, sizeof(signal_name_prefix), prefix);    
-    apr_snprintf(signal_shutdown_name, sizeof(signal_shutdown_name), 
-        "%s_shutdown", signal_name_prefix);    
-    apr_snprintf(signal_restart_name, sizeof(signal_restart_name), 
-        "%s_restart", signal_name_prefix);    
+    apr_snprintf(signal_name_prefix, sizeof(signal_name_prefix), prefix);
+    apr_snprintf(signal_shutdown_name, sizeof(signal_shutdown_name),
+        "%s_shutdown", signal_name_prefix);
+    apr_snprintf(signal_restart_name, sizeof(signal_restart_name),
+        "%s_restart", signal_name_prefix);
 }
 
 int volatile is_graceful = 0;
@@ -260,20 +260,20 @@
 {
     HANDLE e;
     char *signal_name;
-    
+
     if (parent_pid == my_pid) {
         switch(type) {
-           case SIGNAL_PARENT_SHUTDOWN: 
+           case SIGNAL_PARENT_SHUTDOWN:
            {
-               SetEvent(shutdown_event); 
+               SetEvent(shutdown_event);
                break;
            }
            /* This MPM supports only graceful restarts right now */
-           case SIGNAL_PARENT_RESTART: 
+           case SIGNAL_PARENT_RESTART:
            case SIGNAL_PARENT_RESTART_GRACEFUL:
            {
                is_graceful = 1;
-               SetEvent(restart_event); 
+               SetEvent(restart_event);
                break;
            }
         }
@@ -281,20 +281,20 @@
     }
 
     switch(type) {
-       case SIGNAL_PARENT_SHUTDOWN: 
+       case SIGNAL_PARENT_SHUTDOWN:
        {
-           signal_name = signal_shutdown_name; 
+           signal_name = signal_shutdown_name;
            break;
        }
        /* This MPM supports only graceful restarts right now */
-       case SIGNAL_PARENT_RESTART: 
+       case SIGNAL_PARENT_RESTART:
        case SIGNAL_PARENT_RESTART_GRACEFUL:
        {
-           signal_name = signal_restart_name;     
+           signal_name = signal_restart_name;
            is_graceful = 1;
            break;
        }
-       default: 
+       default:
            return;
     }
 
@@ -337,7 +337,7 @@
     DWORD BytesRead;
     void *sb_shared;
     apr_status_t rv;
-    
+
     pipe = GetStdHandle(STD_INPUT_HANDLE);
     if (!ReadFile(pipe, &ready_event, sizeof(HANDLE),
                   &BytesRead, (LPOVERLAPPED) NULL)
@@ -381,7 +381,7 @@
         exit(APEXIT_CHILDINIT);
     }
     *scoreboard_shm = NULL;
-    if ((rv = apr_os_shm_put(scoreboard_shm, &hScore, s->process->pool)) 
+    if ((rv = apr_os_shm_put(scoreboard_shm, &hScore, s->process->pool))
             != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
                      "Child %d: Unable to access the scoreboard from the parent", my_pid);
@@ -390,7 +390,7 @@
 
     rv = ap_reopen_scoreboard(s->process->pool, scoreboard_shm, 1);
     if (rv || !(sb_shared = apr_shm_baseaddr_get(*scoreboard_shm))) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, 
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
                      "Child %d: Unable to reopen the scoreboard from the parent", my_pid);
         exit(APEXIT_CHILDINIT);
     }
@@ -404,12 +404,12 @@
 }
 
 
-static int send_handles_to_child(apr_pool_t *p, 
+static int send_handles_to_child(apr_pool_t *p,
                                  HANDLE child_ready_event,
-                                 HANDLE child_exit_event, 
+                                 HANDLE child_exit_event,
                                  apr_proc_mutex_t *child_start_mutex,
                                  apr_shm_t *scoreboard_shm,
-                                 HANDLE hProcess, 
+                                 HANDLE hProcess,
                                  apr_file_t *child_in)
 {
     apr_status_t rv;
@@ -484,7 +484,7 @@
 }
 
 
-/* 
+/*
  * get_listeners_from_parent()
  * The listen sockets are opened in the parent. This function, which runs
  * exclusively in the child process, receives them from the parent and
@@ -514,7 +514,7 @@
     pipe = GetStdHandle(STD_INPUT_HANDLE);
 
     for (lr = ap_listeners; lr; lr = lr->next, ++lcnt) {
-        if (!ReadFile(pipe, &WSAProtocolInfo, sizeof(WSAPROTOCOL_INFO), 
+        if (!ReadFile(pipe, &WSAProtocolInfo, sizeof(WSAPROTOCOL_INFO),
                       &BytesRead, (LPOVERLAPPED) NULL)) {
             ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,
                          "setup_inherited_listeners: Unable to read socket data from parent");
@@ -531,15 +531,15 @@
         if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
             HANDLE hProcess = GetCurrentProcess();
             HANDLE dup;
-            if (DuplicateHandle(hProcess, (HANDLE) nsd, hProcess, &dup, 
+            if (DuplicateHandle(hProcess, (HANDLE) nsd, hProcess, &dup,
                                 0, FALSE, DUPLICATE_SAME_ACCESS)) {
                 closesocket(nsd);
                 nsd = (SOCKET) dup;
             }
         }
         else {
-            /* A different approach.  Many users report errors such as 
-             * (32538)An operation was attempted on something that is not 
+            /* A different approach.  Many users report errors such as
+             * (32538)An operation was attempted on something that is not
              * a socket.  : Parent: WSADuplicateSocket failed...
              *
              * This appears that the duplicated handle is no longer recognized
@@ -560,7 +560,7 @@
 }
 
 
-static int send_listeners_to_child(apr_pool_t *p, DWORD dwProcessId, 
+static int send_listeners_to_child(apr_pool_t *p, DWORD dwProcessId,
                                    apr_file_t *child_in)
 {
     apr_status_t rv;
@@ -569,8 +569,8 @@
     LPWSAPROTOCOL_INFO  lpWSAProtocolInfo;
     apr_size_t BytesWritten;
 
-    /* Run the chain of open sockets. For each socket, duplicate it 
-     * for the target process then send the WSAPROTOCOL_INFO 
+    /* Run the chain of open sockets. For each socket, duplicate it
+     * for the target process then send the WSAPROTOCOL_INFO
      * (returned by dup socket) to the child.
      */
     for (lr = ap_listeners; lr; lr = lr->next, ++lcnt) {
@@ -578,7 +578,7 @@
         lpWSAProtocolInfo = apr_pcalloc(p, sizeof(WSAPROTOCOL_INFO));
         apr_os_sock_get(&nsd,lr->sd);
         ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, ap_server_conf,
-                     "Parent: Duplicating socket %d and sending it to child process %d", 
+                     "Parent: Duplicating socket %d and sending it to child process %d",
                      nsd, dwProcessId);
         if (WSADuplicateSocket(nsd, dwProcessId,
                                lpWSAProtocolInfo) == SOCKET_ERROR) {
@@ -587,7 +587,7 @@
             return -1;
         }
 
-        if ((rv = apr_file_write_full(child_in, lpWSAProtocolInfo, 
+        if ((rv = apr_file_write_full(child_in, lpWSAProtocolInfo,
                                       sizeof(WSAPROTOCOL_INFO), &BytesWritten))
                 != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
@@ -606,10 +606,10 @@
     waitlist_term = 1
 };
 
-static int create_process(apr_pool_t *p, HANDLE *child_proc, HANDLE *child_exit_event, 
+static int create_process(apr_pool_t *p, HANDLE *child_proc, HANDLE *child_exit_event,
                           DWORD *child_pid)
 {
-    /* These NEVER change for the lifetime of this parent 
+    /* These NEVER change for the lifetime of this parent
      */
     static char **args = NULL;
     static char **env = NULL;
@@ -629,7 +629,7 @@
     apr_pool_create_ex(&ptemp, p, NULL, NULL);
 
     /* Build the command line. Should look something like this:
-     * C:/apache/bin/apache.exe -f ap_server_confname 
+     * C:/apache/bin/apache.exe -f ap_server_confname
      * First, get the path to the executable...
      */
     apr_procattr_create(&attr, ptemp);
@@ -642,20 +642,20 @@
     }
 
     if (!args) {
-        /* Build the args array, only once since it won't change 
+        /* Build the args array, only once since it won't change
          * for the lifetime of this parent process.
          */
         if ((rv = ap_os_proc_filepath(&cmd, ptemp))
                 != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_CRIT, ERROR_BAD_PATHNAME, ap_server_conf,
-                         "Parent: Failed to get full path of %s", 
+                         "Parent: Failed to get full path of %s",
                          ap_server_conf->process->argv[0]);
             apr_pool_destroy(ptemp);
             return -1;
         }
-        
+
         args = malloc((ap_server_conf->process->argc + 1) * sizeof (char*));
-        memcpy(args + 1, ap_server_conf->process->argv + 1, 
+        memcpy(args + 1, ap_server_conf->process->argv + 1,
                (ap_server_conf->process->argc - 1) * sizeof (char*));
         args[0] = malloc(strlen(cmd) + 1);
         strcpy(args[0], cmd);
@@ -666,7 +666,7 @@
     }
 
     /* Create a pipe to send handles to the child */
-    if ((rv = apr_procattr_io_set(attr, APR_FULL_BLOCK, 
+    if ((rv = apr_procattr_io_set(attr, APR_FULL_BLOCK,
                                   APR_NO_PIPE, APR_NO_PIPE)) != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
                         "Parent: Unable to create child stdin pipe.");
@@ -675,9 +675,9 @@
     }
 
     /* Open a null handle to soak info from the child */
-    if (((rv = apr_file_open(&child_out, "NUL", APR_READ | APR_WRITE, 
+    if (((rv = apr_file_open(&child_out, "NUL", APR_READ | APR_WRITE,
                              APR_OS_DEFAULT, ptemp)) != APR_SUCCESS)
-        || ((rv = apr_procattr_child_out_set(attr, child_out, NULL)) 
+        || ((rv = apr_procattr_child_out_set(attr, child_out, NULL))
                 != APR_SUCCESS)) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
                         "Parent: Unable to connect child stdout to NUL.");
@@ -685,7 +685,7 @@
         return -1;
     }
 
-    /* Connect the child's initial stderr to our main server error log 
+    /* Connect the child's initial stderr to our main server error log
      * or share our own stderr handle.
      */
     if (ap_server_conf->error_log) {
@@ -723,9 +723,9 @@
         return -1;
     }
 
-    if (!env) 
+    if (!env)
     {
-        /* Build the env array, only once since it won't change 
+        /* Build the env array, only once since it won't change
          * for the lifetime of this parent process.
          */
         int envc;
@@ -758,7 +758,7 @@
                               new_child.hproc, new_child.in)) {
         /*
          * This error is fatal, mop up the child and move on
-         * We toggle the child's exit event to cause this child 
+         * We toggle the child's exit event to cause this child
          * to quit even as it is attempting to start.
          */
         SetEvent(hExitEvent);
@@ -771,7 +771,7 @@
 
     /* Important:
      * Give the child process a chance to run before dup'ing the sockets.
-     * We have already set the listening sockets noninheritable, but if 
+     * We have already set the listening sockets noninheritable, but if
      * WSADuplicateSocket runs before the child process initializes
      * the listeners will be inherited anyway.
      */
@@ -779,7 +779,7 @@
     rv = WaitForMultipleObjects(2, waitlist, FALSE, INFINITE);
     CloseHandle(waitlist[waitlist_ready]);
     if (rv != WAIT_OBJECT_0) {
-        /* 
+        /*
          * Outch... that isn't a ready signal. It's dead, Jim!
          */
         SetEvent(hExitEvent);
@@ -792,7 +792,7 @@
     if (send_listeners_to_child(ptemp, new_child.pid, new_child.in)) {
         /*
          * This error is fatal, mop up the child and move on
-         * We toggle the child's exit event to cause this child 
+         * We toggle the child's exit event to cause this child
          * to quit even as it is attempting to start.
          */
         SetEvent(hExitEvent);
@@ -811,8 +811,8 @@
 
 /***********************************************************************
  * master_main()
- * master_main() runs in the parent process.  It creates the child 
- * process which handles HTTP requests then waits on one of three 
+ * master_main() runs in the parent process.  It creates the child
+ * process which handles HTTP requests then waits on one of three
  * events:
  *
  * restart_event
@@ -821,15 +821,15 @@
  * tells the old child process to exit (by setting the child_exit_event).
  * The restart event is set as a result of one of the following:
  * 1. An apache -k restart command on the command line
- * 2. A command received from Windows service manager which gets 
+ * 2. A command received from Windows service manager which gets
  *    translated into an ap_signal_parent(SIGNAL_PARENT_RESTART)
  *    call by code in service.c.
  * 3. The child process calling ap_signal_parent(SIGNAL_PARENT_RESTART)
  *    as a result of hitting MaxRequestsPerChild.
  *
- * shutdown_event 
+ * shutdown_event
  * --------------
- * The shutdown event causes master_main to tell the child process to 
+ * The shutdown event causes master_main to tell the child process to
  * exit and that the server is shutting down. The shutdown event is
  * set as a result of one of the following:
  * 1. An apache -k shutdown command on the command line
@@ -839,11 +839,11 @@
  *
  * child process handle
  * --------------------
- * The child process handle will be signaled if the child process 
+ * The child process handle will be signaled if the child process
  * exits for any reason. In a normal running server, the signaling
  * of this event means that the child process has exited prematurely
  * due to a seg fault or other irrecoverable error. For server
- * robustness, master_main will restart the child process under this 
+ * robustness, master_main will restart the child process under this
  * condtion.
  *
  * master_main uses the child_exit_event to signal the child process
@@ -868,9 +868,9 @@
     event_handles[RESTART_HANDLE] = restart_event;
 
     /* Create a single child process */
-    rv = create_process(pconf, &event_handles[CHILD_HANDLE], 
+    rv = create_process(pconf, &event_handles[CHILD_HANDLE],
                         &child_exit_event, &child_pid);
-    if (rv < 0) 
+    if (rv < 0)
     {
         ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,
                      "master_main: create child process failed. Exiting.");
@@ -906,7 +906,7 @@
     else if (cld == SHUTDOWN_HANDLE) {
         /* shutdown_event signalled */
         shutdown_pending = 1;
-        ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, s, 
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, s,
                      "Parent: Received shutdown signal -- Shutting down the server.");
         if (ResetEvent(shutdown_event) == 0) {
             ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s,
@@ -914,11 +914,11 @@
         }
     }
     else if (cld == RESTART_HANDLE) {
-        /* Received a restart event. Prepare the restart_event to be reused 
-         * then signal the child process to exit. 
+        /* Received a restart event. Prepare the restart_event to be reused
+         * then signal the child process to exit.
          */
         restart_pending = 1;
-        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, 
+        ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s,
                      "Parent: Received restart signal -- Restarting the server.");
         if (ResetEvent(restart_event) == 0) {
             ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s,
@@ -926,10 +926,10 @@
         }
         if (SetEvent(child_exit_event) == 0) {
             ap_log_error(APLOG_MARK, APLOG_ERR, apr_get_os_error(), s,
-                         "Parent: SetEvent for child process %d failed.", 
+                         "Parent: SetEvent for child process %d failed.",
                          event_handles[CHILD_HANDLE]);
         }
-        /* Don't wait to verify that the child process really exits, 
+        /* Don't wait to verify that the child process really exits,
          * just move on with the restart.
          */
         CloseHandle(event_handles[CHILD_HANDLE]);
@@ -942,17 +942,17 @@
             /* HUH? We did exit, didn't we? */
             exitcode = APEXIT_CHILDFATAL;
         }
-        if (   exitcode == APEXIT_CHILDFATAL 
+        if (   exitcode == APEXIT_CHILDFATAL
             || exitcode == APEXIT_CHILDINIT
             || exitcode == APEXIT_INIT) {
-            ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf, 
+            ap_log_error(APLOG_MARK, APLOG_CRIT, 0, ap_server_conf,
                          "Parent: child process exited with status %u -- Aborting.", exitcode);
             shutdown_pending = 1;
         }
         else {
             int i;
             restart_pending = 1;
-            ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, 
+            ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                          "Parent: child process exited with status %u -- Restarting.", exitcode);
             for (i = 0; i < ap_threads_per_child; i++) {
                 ap_update_child_status_from_indexes(0, i, SERVER_DEAD, NULL);
@@ -966,12 +966,12 @@
         ap_scoreboard_image->global->running_generation = ap_my_generation;
     }
 die_now:
-    if (shutdown_pending) 
+    if (shutdown_pending)
     {
         int timeout = 30000;  /* Timeout is milliseconds */
         winnt_mpm_state = AP_MPMQ_STOPPING;
 
-        /* This shutdown is only marginally graceful. We will give the 
+        /* This shutdown is only marginally graceful. We will give the
          * child a bit of time to exit gracefully. If the time expires,
          * the child will be wacked.
          */
@@ -1005,7 +1005,7 @@
     return 1;      /* Tell the caller we want a restart */
 }
 
-/* service_nt_main_fn needs to append the StartService() args 
+/* service_nt_main_fn needs to append the StartService() args
  * outside of our call stack and thread as the service starts...
  */
 apr_array_header_t *mpm_new_argv;
@@ -1039,7 +1039,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 = 0;
             return APR_SUCCESS;
         case AP_MPMQ_MAX_SPARE_DAEMONS:
@@ -1059,7 +1059,7 @@
             return APR_SUCCESS;
     }
     return APR_ENOTIMPL;
-} 
+}
 
 #define SERVICE_UNSET (-1)
 static apr_status_t service_set = SERVICE_UNSET;
@@ -1067,8 +1067,8 @@
 static int inst_argc;
 static const char * const *inst_argv;
 static char *service_name = NULL;
-    
-void winnt_rewrite_args(process_rec *process) 
+
+void winnt_rewrite_args(process_rec *process)
 {
     /* Handle the following SCM aspects in this phase:
      *
@@ -1103,7 +1103,7 @@
 
     /* AP_PARENT_PID is only valid in the child */
     pid = getenv("AP_PARENT_PID");
-    if (pid) 
+    if (pid)
     {
         /* This is the child */
         my_pid = GetCurrentProcessId();
@@ -1122,19 +1122,19 @@
         signal_arg = "runchild";
         return;
     }
-    
+
     /* This is the parent, we have a long way to go :-) */
     parent_pid = my_pid = GetCurrentProcessId();
 
     /* This behavior is voided by setting real_exit_code to 0 */
     atexit(hold_console_open_on_error);
 
-    /* Rewrite process->argv[]; 
+    /* Rewrite process->argv[];
      *
      * strip out -k signal into signal_arg
      * strip out -n servicename and set the names
      * add default -d serverroot from the path of this executable
-     * 
+     *
      * The end result will look like:
      *
      * The invocation command (%0)
@@ -1144,7 +1144,7 @@
      */
     if ((rv = ap_os_proc_filepath(&binpath, process->pconf))
             != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK,APLOG_CRIT, rv, NULL, 
+        ap_log_error(APLOG_MARK,APLOG_CRIT, rv, NULL,
                      "Failed to get the full path of %s", process->argv[0]);
         exit(APEXIT_INIT);
     }
@@ -1158,12 +1158,12 @@
         if (!strcasecmp(def_server_root, "bin"))
             *(def_server_root - 1) = '\0';
     }
-    apr_filepath_merge(&def_server_root, NULL, binpath, 
+    apr_filepath_merge(&def_server_root, NULL, binpath,
                        APR_FILEPATH_TRUENAME, process->pool);
 
     /* 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,
@@ -1178,7 +1178,7 @@
     optbuf[2] = '\0';
     apr_getopt_init(&opt, process->pool, process->argc, (char**) process->argv);
     opt->errfn = NULL;
-    while ((rv = apr_getopt(opt, "wn:k:" AP_SERVER_BASEARGS, 
+    while ((rv = apr_getopt(opt, "wn:k:" AP_SERVER_BASEARGS,
                             optbuf + 1, &optarg)) == APR_SUCCESS) {
         switch (optbuf[1]) {
 
@@ -1191,7 +1191,7 @@
             break;
 
         case 'n':
-            service_set = mpm_service_set_name(process->pool, &service_name, 
+            service_set = mpm_service_set_name(process->pool, &service_name,
                                                optarg);
             break;
 
@@ -1212,7 +1212,7 @@
             break;
         }
     }
-    
+
     /* back up to capture the bad argument */
     if (rv == APR_BADCH || rv == APR_BADARG) {
         opt->ind--;
@@ -1233,10 +1233,10 @@
         running_as_service = 0;
     }
 
-    if (!strcasecmp(signal_arg, "runservice")) 
+    if (!strcasecmp(signal_arg, "runservice"))
     {
-        /* Start the NT Service _NOW_ because the WinNT SCM is 
-         * expecting us to rapidly assume control of our own 
+        /* Start the NT Service _NOW_ because the WinNT SCM is
+         * expecting us to rapidly assume control of our own
          * process, the SCM will tell us our service name, and
          * may have extra StartService() command arguments to
          * add for us.
@@ -1248,7 +1248,7 @@
          * (path to apache root, above /bin) for safety.
          */
         apr_filepath_set(def_server_root, process->pool);
-        
+
         /* Any other process has a console, so we don't to begin
          * a Win9x service until the configuration is parsed and
          * any command line errors are reported.
@@ -1256,7 +1256,7 @@
          * We hold the return value so that we can die in pre_config
          * after logging begins, and the failure can land in the log.
          */
-        if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) 
+        if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
         {
             if (!errout) {
                 mpm_nt_eventlog_stderr_open(service_name, process->pool);
@@ -1277,7 +1277,7 @@
 
     if (!strcasecmp(signal_arg, "install")) /* -k install */
     {
-        if (service_set == APR_SUCCESS) 
+        if (service_set == APR_SUCCESS)
         {
             ap_log_error(APLOG_MARK,APLOG_ERR, 0, NULL,
                  "%s: Service is already installed.", service_name);
@@ -1286,9 +1286,9 @@
     }
     else if (running_as_service)
     {
-        if (service_set == APR_SUCCESS) 
+        if (service_set == APR_SUCCESS)
         {
-            /* Attempt to Uninstall, or stop, before 
+            /* Attempt to Uninstall, or stop, before
              * we can read the arguments or .conf files
              */
             if (!strcasecmp(signal_arg, "uninstall")) {
@@ -1296,13 +1296,13 @@
                 exit(rv);
             }
 
-            if ((!strcasecmp(signal_arg, "stop")) || 
+            if ((!strcasecmp(signal_arg, "stop")) ||
                 (!strcasecmp(signal_arg, "shutdown"))) {
                 mpm_signal_service(process->pool, 0);
                 exit(0);
             }
 
-            rv = mpm_merge_service_args(process->pool, mpm_new_argv, 
+            rv = mpm_merge_service_args(process->pool, mpm_new_argv,
                                         fixed_args);
             if (rv == APR_SUCCESS) {
                 ap_log_error(APLOG_MARK,APLOG_INFO, 0, NULL,
@@ -1322,7 +1322,7 @@
             exit(APEXIT_INIT);
         }
     }
-    if (strcasecmp(signal_arg, "install") && service_set && service_set != SERVICE_UNSET) 
+    if (strcasecmp(signal_arg, "install") && service_set && service_set != SERVICE_UNSET)
     {
         ap_log_error(APLOG_MARK,APLOG_ERR, service_set, NULL,
              "No installed service named \"%s\".", service_name);
@@ -1362,19 +1362,19 @@
                 "service can be started.\n");
     }
 
-    process->argc = mpm_new_argv->nelts; 
+    process->argc = mpm_new_argv->nelts;
     process->argv = (const char * const *) mpm_new_argv->elts;
 }
 
 
-static int winnt_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *ptemp) 
+static int winnt_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *ptemp)
 {
     /* Handle the following SCM aspects in this phase:
      *
      *   -k runservice [WinNT errors logged from rewrite_args]
      */
 
-    /* Initialize shared static objects. 
+    /* Initialize shared static objects.
      * TODO: Put config related statics into an sconf structure.
      */
     pconf = pconf_;
@@ -1386,7 +1386,7 @@
     if (!strcasecmp(signal_arg, "runservice")
             && (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
             && (service_to_start_success != APR_SUCCESS)) {
-        ap_log_error(APLOG_MARK,APLOG_CRIT, service_to_start_success, NULL, 
+        ap_log_error(APLOG_MARK,APLOG_CRIT, service_to_start_success, NULL,
                      "%s: Unable to start the service manager.",
                      service_name);
         exit(APEXIT_INIT);
@@ -1436,7 +1436,7 @@
      */
 
     if (!strcasecmp(signal_arg, "install")) {
-        /* Service install happens in the rewrite_args hooks. If we 
+        /* Service install happens in the rewrite_args hooks. If we
          * made it this far, the server configuration is clean and the
          * service will successfully start.
          */
@@ -1445,7 +1445,7 @@
         exit(0);
     }
     if (!strcasecmp(signal_arg, "config")) {
-        /* Service reconfiguration happens in the rewrite_args hooks. If we 
+        /* Service reconfiguration happens in the rewrite_args hooks. If we
          * made it this far, the server configuration is clean and the
          * service will successfully start.
          */
@@ -1475,9 +1475,9 @@
         exit (rv);
     }
 
-    if (parent_pid == my_pid) 
+    if (parent_pid == my_pid)
     {
-        if (restart_num++ == 1) 
+        if (restart_num++ == 1)
         {
             /* This code should be run once in the parent and not run
              * across a restart
@@ -1486,8 +1486,8 @@
             setup_signal_names(apr_psprintf(pconf,"ap%d", parent_pid));
 
             ap_log_pid(pconf, ap_pid_fname);
-            
-            /* Create shutdown event, apPID_shutdown, where PID is the parent 
+
+            /* Create shutdown event, apPID_shutdown, where PID is the parent
              * Apache process ID. Shutdown is signaled by 'apache -k shutdown'.
              */
             shutdown_event = CreateEvent(sa, FALSE, FALSE, signal_shutdown_name);
@@ -1498,7 +1498,7 @@
                 return HTTP_INTERNAL_SERVER_ERROR;
             }
 
-            /* Create restart event, apPID_restart, where PID is the parent 
+            /* Create restart event, apPID_restart, where PID is the parent
              * Apache process ID. Restart is signaled by 'apache -k restart'.
              */
             restart_event = CreateEvent(sa, FALSE, FALSE, signal_restart_name);
@@ -1511,14 +1511,14 @@
             }
             CleanNullACL((void *)sa);
 
-            /* Now that we are flying at 15000 feet... 
+            /* Now that we are flying at 15000 feet...
              * wipe out the Win95 service console,
              * signal the SCM the WinNT service started, or
              * if not a service, setup console handlers instead.
              */
             if (!strcasecmp(signal_arg, "runservice"))
             {
-                if (osver.dwPlatformId != VER_PLATFORM_WIN32_NT) 
+                if (osver.dwPlatformId != VER_PLATFORM_WIN32_NT)
                 {
                     rv = mpm_service_to_start(&service_name,
                                               s->process->pool);
@@ -1536,7 +1536,7 @@
             }
 
             /* Create the start mutex, as an unnamed object for security.
-             * Ths start mutex is used during a restart to prevent more than 
+             * Ths start mutex is used during a restart to prevent more than
              * one child process from entering the accept loop at once.
              */
             rv =  apr_proc_mutex_create(&start_mutex, NULL,
@@ -1547,7 +1547,7 @@
                              "%s: Unable to create the start_mutex.",
                              service_name);
                 return HTTP_INTERNAL_SERVER_ERROR;
-            }            
+            }
         }
     }
     else /* parent_pid != my_pid */
@@ -1562,7 +1562,7 @@
  */
 static int winnt_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
 {
-    /* Initialize shared static objects. 
+    /* Initialize shared static objects.
      */
     ap_server_conf = s;
 
@@ -1572,16 +1572,16 @@
 
     /* We cannot initialize our listeners if we are restarting
      * (the parent process already has glomed on to them)
-     * nor should we do so for service reconfiguration 
+     * nor should we do so for service reconfiguration
      * (since the service may already be running.)
      */
-    if (!strcasecmp(signal_arg, "restart") 
+    if (!strcasecmp(signal_arg, "restart")
             || !strcasecmp(signal_arg, "config")) {
         return OK;
     }
 
     if (ap_setup_listeners(s) < 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;
     }
@@ -1598,7 +1598,7 @@
     /* This is a child process, not in single process mode */
     if (!one_process) {
         /* Set up events and the scoreboard */
-        get_handles_from_parent(s, &exit_event, &start_mutex, 
+        get_handles_from_parent(s, &exit_event, &start_mutex,
                                 &ap_scoreboard_shm);
 
         /* Set up the listeners */
@@ -1608,7 +1608,7 @@
     }
     else {
         /* Single process mode - this lock doesn't even need to exist */
-        rv = apr_proc_mutex_create(&start_mutex, signal_name_prefix, 
+        rv = apr_proc_mutex_create(&start_mutex, signal_name_prefix,
                                    APR_LOCK_DEFAULT, s->process->pool);
         if (rv != APR_SUCCESS) {
             ap_log_error(APLOG_MARK,APLOG_ERR, rv, ap_server_conf,
@@ -1616,7 +1616,7 @@
                          service_name, my_pid);
             exit(APEXIT_CHILDINIT);
         }
-        
+
         /* Borrow the shutdown_even as our _child_ loop exit event */
         exit_event = shutdown_event;
     }
@@ -1637,10 +1637,10 @@
                      "during restart");
         changed_limit_at_restart = 0;
     }
-    
-    /* ### If non-graceful restarts are ever introduced - we need to rerun 
-     * the pre_mpm hook on subsequent non-graceful restarts.  But Win32 
-     * has only graceful style restarts - and we need this hook to act 
+
+    /* ### If non-graceful restarts are ever introduced - we need to rerun
+     * the pre_mpm hook on subsequent non-graceful restarts.  But Win32
+     * has only graceful style restarts - and we need this hook to act
      * the same on Win32 as on Unix.
      */
     if (!restart && ((parent_pid == my_pid) || one_process)) {
@@ -1649,10 +1649,10 @@
             return 1;
         }
     }
-    
-    if ((parent_pid != my_pid) || one_process) 
+
+    if ((parent_pid != my_pid) || one_process)
     {
-        /* The child process or in one_process (debug) mode 
+        /* The child process or in one_process (debug) mode
          */
         ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                      "Child %d: Child process is running", my_pid);
@@ -1660,10 +1660,10 @@
         child_main(pconf);
 
         ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
-                     "Child %d: Child process is exiting", my_pid);        
+                     "Child %d: Child process is exiting", my_pid);
         return 1;
     }
-    else 
+    else
     {
         /* A real-honest to goodness parent */
         ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
@@ -1674,7 +1674,7 @@
 
         restart = master_main(ap_server_conf, shutdown_event, restart_event);
 
-        if (!restart) 
+        if (!restart)
         {
             /* Shutting down. Clean up... */
             const char *pidfile = ap_server_root_relative (pconf, ap_pid_fname);

Modified: httpd/httpd/trunk/server/mpm/winnt/nt_eventlog.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/winnt/nt_eventlog.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/nt_eventlog.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/nt_eventlog.c Thu Nov 10 07:11:44 2005
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define CORE_PRIVATE 
+#define CORE_PRIVATE
 
 #include "httpd.h"
 #include "http_log.h"
@@ -38,7 +38,7 @@
     ap_regkey_t *regkey;
     apr_status_t rv;
     apr_pool_t *p;
-    
+
     apr_pool_create_ex(&p, NULL, NULL, NULL);
 
     errarg[0] = "The Apache service named";
@@ -52,21 +52,21 @@
     errarg[8] = NULL;
 
     /* What are we going to do in here, bail on the user?  not. */
-    if ((rv = ap_regkey_open(&regkey, AP_REGKEY_LOCAL_MACHINE, 
+    if ((rv = ap_regkey_open(&regkey, AP_REGKEY_LOCAL_MACHINE,
                              "SYSTEM\\CurrentControlSet\\Services\\"
                              "EventLog\\Application\\Apache Service",
-                             APR_READ | APR_WRITE | APR_CREATE, p)) 
+                             APR_READ | APR_WRITE | APR_CREATE, p))
             == APR_SUCCESS)
     {
-        DWORD dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | 
-                       EVENTLOG_INFORMATION_TYPE; 
- 
+        DWORD dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |
+                       EVENTLOG_INFORMATION_TYPE;
+
         /* The stock message file */
-        ap_regkey_value_set(regkey, "EventMessageFile", 
-                            "%SystemRoot%\\System32\\netmsg.dll", 
+        ap_regkey_value_set(regkey, "EventMessageFile",
+                            "%SystemRoot%\\System32\\netmsg.dll",
                             AP_REGKEY_EXPAND, p);
-        
-        ap_regkey_value_raw_set(regkey, "TypesSupported", &dwData, 
+
+        ap_regkey_value_raw_set(regkey, "TypesSupported", &dwData,
                                 sizeof(dwData), REG_DWORD, p);
         ap_regkey_close(regkey);
     }
@@ -80,7 +80,7 @@
         if ((errmsg > errbuf) || !apr_isspace(*errmsg))
         {
             ++errmsg;
-            if ((*(errmsg - 1) == '\n') 
+            if ((*(errmsg - 1) == '\n')
                     || (errmsg >= errbuf + sizeof(errbuf) - 1))
             {
                 while ((errmsg > errbuf) && apr_isspace(*(errmsg - 1))) {
@@ -91,7 +91,7 @@
                 /* Generic message: '%1 %2 %3 %4 %5 %6 %7 %8 %9'
                  * The event code in netmsg.dll is 3299
                  */
-                ReportEvent(hEventSource, EVENTLOG_ERROR_TYPE, 0, 
+                ReportEvent(hEventSource, EVENTLOG_ERROR_TYPE, 0,
                             3299, NULL, 9, 0, errarg, NULL);
                 errmsg = errbuf;
             }
@@ -100,10 +100,10 @@
 
     if ((errres = GetLastError()) != ERROR_BROKEN_PIPE) {
         apr_snprintf(errbuf, sizeof(errbuf),
-                     "Win32 error %d reading stderr pipe stream\r\n", 
+                     "Win32 error %d reading stderr pipe stream\r\n",
                      GetLastError());
 
-        ReportEvent(hEventSource, EVENTLOG_ERROR_TYPE, 0, 
+        ReportEvent(hEventSource, EVENTLOG_ERROR_TYPE, 0,
                     3299, NULL, 9, 0, errarg, NULL);
     }
 
@@ -149,7 +149,7 @@
     sa.nLength = sizeof(sa);
     sa.lpSecurityDescriptor = NULL;
     sa.bInheritHandle = FALSE;
-    CreatePipe(&hPipeRead, &hPipeWrite, NULL, 0); 
+    CreatePipe(&hPipeRead, &hPipeWrite, NULL, 0);
     ap_assert(hPipeRead && hPipeWrite);
 
     stderr_ready = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -160,14 +160,14 @@
     WaitForSingleObject(stderr_ready, INFINITE);
 
     /* Flush stderr and unset its buffer, then commit and replace stderr.
-     * This is typically a noop for Win2K/XP since services with NULL std 
-     * handles [but valid FILE *'s, oddly enough], but is required 
+     * This is typically a noop for Win2K/XP since services with NULL std
+     * handles [but valid FILE *'s, oddly enough], but is required
      * for NT 4.0 and to use this code outside of services.
      */
     fflush(stderr);
     setvbuf(stderr, NULL, _IONBF, 0);
     _commit(2 /* stderr */);
-    fd = _open_osfhandle((long) hPipeWrite, 
+    fd = _open_osfhandle((long) hPipeWrite,
                          _O_WRONLY | _O_BINARY);
     _dup2(fd, 2);
     _close(fd);
@@ -181,7 +181,7 @@
 
     SetStdHandle(STD_ERROR_HANDLE, hPipeWrite);
 
-    /* The code above _will_ corrupt the StdHandle... 
+    /* The code above _will_ corrupt the StdHandle...
      * and we must do so anyways.  We set this up only
      * after we initialized the posix stderr API.
      */

Modified: httpd/httpd/trunk/server/mpm/winnt/service.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/winnt/service.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/service.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/service.c Thu Nov 10 07:11:44 2005
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-/* This module ALONE requires the window message API from user.h 
+/* This module ALONE requires the window message API from user.h
  * and the default APR include of windows.h will omit it, so
  * preload the API symbols now...
  */
 
-#define CORE_PRIVATE 
+#define CORE_PRIVATE
 #define _WINUSER_
 
 #include "httpd.h"
@@ -67,19 +67,19 @@
     apr_status_t rv;
     ap_regkey_t *key;
 
-    if ((rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, PRODREGKEY, 
+    if ((rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, PRODREGKEY,
                              APR_READ, p)) == APR_SUCCESS) {
         rv = ap_regkey_value_get(buf, key, "ServerRoot", p);
         ap_regkey_close(key);
-        if (rv == APR_SUCCESS) 
+        if (rv == APR_SUCCESS)
             return rv;
     }
 
-    if ((rv = ap_regkey_open(&key, AP_REGKEY_CURRENT_USER, PRODREGKEY, 
+    if ((rv = ap_regkey_open(&key, AP_REGKEY_CURRENT_USER, PRODREGKEY,
                              APR_READ, p)) == APR_SUCCESS) {
         rv = ap_regkey_value_get(buf, key, "ServerRoot", p);
         ap_regkey_close(key);
-        if (rv == APR_SUCCESS) 
+        if (rv == APR_SUCCESS)
             return rv;
     }
 
@@ -102,7 +102,7 @@
  */
 
 
-/* exit() for Win32 is macro mapped (horrible, we agree) that allows us 
+/* exit() for Win32 is macro mapped (horrible, we agree) that allows us
  * to catch the non-zero conditions and inform the console process that
  * the application died, and hang on to the console a bit longer.
  *
@@ -128,7 +128,7 @@
     CONSOLE_SCREEN_BUFFER_INFO coninfo;
     INPUT_RECORD in;
     char count[16];
-    
+
     if (!ap_real_exit_code)
         return;
     hConIn = GetStdHandle(STD_INPUT_HANDLE);
@@ -141,7 +141,7 @@
         return;
     if (!SetConsoleMode(hConIn, ENABLE_MOUSE_INPUT | 0x80))
         return;
-        
+
     start = time(NULL);
     do
     {
@@ -149,18 +149,18 @@
         {
             if (!ReadConsoleInput(hConIn, &in, 1, &result) || !result)
                 return;
-            if ((in.EventType == KEY_EVENT) && in.Event.KeyEvent.bKeyDown 
+            if ((in.EventType == KEY_EVENT) && in.Event.KeyEvent.bKeyDown
                     && (in.Event.KeyEvent.uChar.AsciiChar == 27))
                 return;
-            if (in.EventType == MOUSE_EVENT 
+            if (in.EventType == MOUSE_EVENT
                     && (in.Event.MouseEvent.dwEventFlags == DOUBLE_CLICK))
                 return;
         }
-        remains = ((start + 30) - time(NULL)); 
+        remains = ((start + 30) - time(NULL));
         sprintf (count, "%d...", remains);
         if (!SetConsoleCursorPosition(hConErr, coninfo.dwCursorPosition))
             return;
-        if (!WriteConsole(hConErr, count, (DWORD)strlen(count), &result, NULL) 
+        if (!WriteConsole(hConErr, count, (DWORD)strlen(count), &result, NULL)
                 || !result)
             return;
     }
@@ -169,7 +169,7 @@
 
 static BOOL  die_on_logoff = FALSE;
 
-static LRESULT CALLBACK monitor_service_9x_proc(HWND hWnd, UINT msg, 
+static LRESULT CALLBACK monitor_service_9x_proc(HWND hWnd, UINT msg,
                                                 WPARAM wParam, LPARAM lParam)
 {
 /* This is the WndProc procedure for our invisible window.
@@ -177,7 +177,7 @@
  * a signal WM_ENDSESSION. We clean up by signaling Apache
  * to shut down, and idle until Apache's primary thread quits.
  */
-    if ((msg == WM_ENDSESSION) 
+    if ((msg == WM_ENDSESSION)
             && (die_on_logoff || (lParam != ENDSESSION_LOGOFF)))
     {
         ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
@@ -192,7 +192,7 @@
 static DWORD WINAPI monitor_service_9x_thread(void *service_name)
 {
     /* When running as a service under Windows 9x, there is no console
-     * window present, and no ConsoleCtrlHandler to call when the system 
+     * window present, and no ConsoleCtrlHandler to call when the system
      * is shutdown.  If the WatchWindow thread is created with a NULL
      * service_name argument, then the ...SystemMonitor window class is
      * used to create the "Apache" window to watch for logoff and shutdown.
@@ -203,11 +203,11 @@
     WNDCLASS wc;
     HWND hwndMain;
     MSG msg;
-    
+
     wc.style         = CS_GLOBALCLASS;
-    wc.lpfnWndProc   = monitor_service_9x_proc; 
+    wc.lpfnWndProc   = monitor_service_9x_proc;
     wc.cbClsExtra    = 0;
-    wc.cbWndExtra    = 0; 
+    wc.cbWndExtra    = 0;
     wc.hInstance     = NULL;
     wc.hIcon         = NULL;
     wc.hCursor       = NULL;
@@ -217,27 +217,27 @@
         wc.lpszClassName = "ApacheWin95ServiceMonitor";
     else
         wc.lpszClassName = "ApacheWin95SystemMonitor";
- 
+
     die_on_logoff = service_name ? FALSE : TRUE;
 
-    if (!RegisterClass(&wc)) 
+    if (!RegisterClass(&wc))
     {
-        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), 
+        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(),
                      NULL, "Could not register window class for WatchWindow");
         globdat.service_thread_id = 0;
         return 0;
     }
-    
+
     /* Create an invisible window */
-    hwndMain = CreateWindow(wc.lpszClassName, 
+    hwndMain = CreateWindow(wc.lpszClassName,
                             service_name ? (char *) service_name : "Apache",
- 	                    WS_OVERLAPPEDWINDOW & ~WS_VISIBLE, 
-                            CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
+ 	                    WS_OVERLAPPEDWINDOW & ~WS_VISIBLE,
+                            CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                             CW_USEDEFAULT, NULL, NULL, NULL, NULL);
-                            
+
     if (!hwndMain)
     {
-        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), 
+        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(),
                      NULL, "Could not create WatchWindow");
         globdat.service_thread_id = 0;
         return 0;
@@ -250,10 +250,10 @@
     FreeConsole();
     SetEvent(globdat.service_init);
 
-    while (GetMessage(&msg, NULL, 0, 0)) 
+    while (GetMessage(&msg, NULL, 0, 0))
     {
         if (msg.message == WM_CLOSE)
-            DestroyWindow(hwndMain); 
+            DestroyWindow(hwndMain);
         else {
             TranslateMessage(&msg);
             DispatchMessage(&msg);
@@ -295,7 +295,7 @@
             Sleep(30000);
             return TRUE;
     }
- 
+
     /* We should never get here, but this is (mostly) harmless */
     return FALSE;
 }
@@ -341,7 +341,7 @@
             Sleep(30000);
             return TRUE;
     }
- 
+
     /* We should never get here, but this is (mostly) harmless */
     return FALSE;
 }
@@ -374,7 +374,7 @@
 {
     static int checkPoint = 1;
     int rv = APR_SUCCESS;
-    
+
     if (globdat.hServiceStatus)
     {
         if (currentState == SERVICE_RUNNING) {
@@ -385,7 +385,7 @@
         else if (currentState == SERVICE_STOPPED) {
             globdat.ssStatus.dwWaitHint = 0;
             globdat.ssStatus.dwCheckPoint = 0;
-            if (!exitCode && globdat.ssStatus.dwCurrentState 
+            if (!exitCode && globdat.ssStatus.dwCurrentState
                                            != SERVICE_STOP_PENDING) {
                 /* An unexpected exit?  Better to error! */
                 exitCode = 1;
@@ -403,7 +403,7 @@
         }
 
         globdat.ssStatus.dwCurrentState = currentState;
-        
+
         rv = SetServiceStatus(globdat.hServiceStatus, &globdat.ssStatus);
     }
     return(rv);
@@ -438,11 +438,11 @@
      */
     full_description = ap_get_server_version();
 
-    if ((osver.dwPlatformId == VER_PLATFORM_WIN32_NT) 
-          && (osver.dwMajorVersion > 4) 
+    if ((osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
+          && (osver.dwMajorVersion > 4)
           && (ChangeServiceConfig2)
           && (schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT)))
-    {    
+    {
         SC_HANDLE schService = OpenService(schSCManager, mpm_service_name,
                                            SERVICE_CHANGE_CONFIG);
         if (schService) {
@@ -460,15 +460,15 @@
         CloseServiceHandle(schSCManager);
     }
 
-    if (full_description) 
+    if (full_description)
     {
         char szPath[MAX_PATH];
         ap_regkey_t *svckey;
         apr_status_t rv;
 
         /* Find the Service key that Monitor Applications iterate */
-        apr_snprintf(szPath, sizeof(szPath), 
-                     "SYSTEM\\CurrentControlSet\\Services\\%s", 
+        apr_snprintf(szPath, sizeof(szPath),
+                     "SYSTEM\\CurrentControlSet\\Services\\%s",
                      mpm_service_name);
         rv = ap_regkey_open(&svckey, AP_REGKEY_LOCAL_MACHINE, szPath,
                             APR_READ | APR_WRITE, pconf);
@@ -497,8 +497,8 @@
         ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 30000);
         return;
     }
-    
-    ReportStatusToSCMgr(globdat.ssStatus.dwCurrentState, NO_ERROR, 0);            
+
+    ReportStatusToSCMgr(globdat.ssStatus.dwCurrentState, NO_ERROR, 0);
 }
 
 
@@ -524,7 +524,7 @@
     /* ###: utf-ize */
     if (!(globdat.hServiceStatus = RegisterServiceCtrlHandler(argv[0], service_nt_ctrl)))
     {
-        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), 
+        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(),
                      NULL, "Failure registering service handler");
         return;
     }
@@ -532,11 +532,11 @@
     /* Report status, no errors, and buy 3 more seconds */
     ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 30000);
 
-    /* We need to append all the command arguments passed via StartService() 
+    /* We need to append all the command arguments passed via StartService()
      * to our running service... which just got here via the SCM...
      * but we hvae no interest in argv[0] for the mpm_new_argv list.
      */
-    if (argc > 1) 
+    if (argc > 1)
     {
         char **cmb_data;
 
@@ -544,13 +544,13 @@
         cmb_data = malloc(mpm_new_argv->nalloc * sizeof(const char *));
 
         /* mpm_new_argv remains first (of lower significance) */
-        memcpy (cmb_data, mpm_new_argv->elts, 
+        memcpy (cmb_data, mpm_new_argv->elts,
                 mpm_new_argv->elt_size * mpm_new_argv->nelts);
-        
+
         /* Service args follow from StartService() invocation */
-        memcpy (cmb_data + mpm_new_argv->nelts, argv + 1, 
+        memcpy (cmb_data + mpm_new_argv->nelts, argv + 1,
                 mpm_new_argv->elt_size * (argc - 1));
-        
+
         /* The replacement arg list is complete */
         mpm_new_argv->elts = (char *)cmb_data;
         mpm_new_argv->nelts = mpm_new_argv->nalloc;
@@ -588,15 +588,15 @@
 }
 
 
-apr_status_t mpm_service_set_name(apr_pool_t *p, const char **display_name, 
+apr_status_t mpm_service_set_name(apr_pool_t *p, const char **display_name,
                                   const char *set_name)
 {
     char key_name[MAX_PATH];
     ap_regkey_t *key;
     apr_status_t rv;
 
-    /* ### Needs improvement, on Win2K the user can _easily_ 
-     * change the display name to a string that doesn't reflect 
+    /* ### Needs improvement, on Win2K the user can _easily_
+     * change the display name to a string that doesn't reflect
      * the internal service name + whitespace!
      */
     mpm_service_name = apr_palloc(p, strlen(set_name) + 1);
@@ -610,14 +610,14 @@
     if (rv != APR_SUCCESS) {
         /* Take the given literal name if there is no service entry */
         mpm_display_name = apr_pstrdup(p, set_name);
-    } 
+    }
     *display_name = mpm_display_name;
     return rv;
 }
 
 
-apr_status_t mpm_merge_service_args(apr_pool_t *p, 
-                                   apr_array_header_t *args, 
+apr_status_t mpm_merge_service_args(apr_pool_t *p,
+                                   apr_array_header_t *args,
                                    int fixed_args)
 {
     apr_array_header_t *svc_args = NULL;
@@ -636,12 +636,12 @@
         if (rv == ERROR_FILE_NOT_FOUND) {
             ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL,
                          "No ConfigArgs registered for %s, perhaps "
-                         "this service is not installed?", 
+                         "this service is not installed?",
                          mpm_service_name);
             return APR_SUCCESS;
         }
         else
-            return (rv);        
+            return (rv);
     }
 
     if (!svc_args || svc_args->nelts == 0) {
@@ -649,8 +649,8 @@
     }
 
     /* Now we have the mpm_service_name arg, and the mpm_runservice_nt()
-     * call appended the arguments passed by StartService(), so it's  
-     * time to _prepend_ the default arguments for the server from 
+     * call appended the arguments passed by StartService(), so it's
+     * time to _prepend_ the default arguments for the server from
      * the service's default arguments (all others override them)...
      */
     args->nalloc = args->nelts + svc_args->nelts;
@@ -658,16 +658,16 @@
 
     /* First three args (argv[0], -f, path) remain first */
     memcpy(cmb_data, args->elts, args->elt_size * fixed_args);
-    
+
     /* Service args follow from service registry array */
-    memcpy(cmb_data + fixed_args, svc_args->elts, 
+    memcpy(cmb_data + fixed_args, svc_args->elts,
            svc_args->elt_size * svc_args->nelts);
-    
+
     /* Remaining new args follow  */
     memcpy(cmb_data + fixed_args + svc_args->nelts,
-           (const char **)args->elts + fixed_args, 
+           (const char **)args->elts + fixed_args,
            args->elt_size * (args->nelts - fixed_args));
-    
+
     args->elts = (char *)cmb_data;
     args->nelts = args->nalloc;
 
@@ -720,7 +720,7 @@
                          0, FALSE, DUPLICATE_SAME_ACCESS)) {
         return APR_ENOTHREAD;
     }
-    
+
     if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
     {
         globdat.service_init = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -729,12 +729,12 @@
              return APR_EGENERAL;
         }
 
-        globdat.service_thread = CreateThread(NULL, 0, service_nt_dispatch_thread, 
+        globdat.service_thread = CreateThread(NULL, 0, service_nt_dispatch_thread,
                                               NULL, 0, &globdat.service_thread_id);
     }
     else /* osver.dwPlatformId != VER_PLATFORM_WIN32_NT */
     {
-        if (!RegisterServiceProcess(0, 1)) 
+        if (!RegisterServiceProcess(0, 1))
             return GetLastError();
 
         globdat.service_init = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -742,7 +742,7 @@
             return APR_EGENERAL;
         }
 
-        globdat.service_thread = CreateThread(NULL, 0, monitor_service_9x_thread, 
+        globdat.service_thread = CreateThread(NULL, 0, monitor_service_9x_thread,
                                               (LPVOID) mpm_service_name, 0,
                                               &globdat.service_thread_id);
     }
@@ -760,7 +760,7 @@
     }
 
     atexit(service_stopped);
-    *display_name = mpm_display_name; 
+    *display_name = mpm_display_name;
     return APR_SUCCESS;
 }
 
@@ -787,7 +787,7 @@
 }
 
 
-apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc, 
+apr_status_t mpm_service_install(apr_pool_t *ptemp, int argc,
                                  const char * const * argv, int reconfig)
 {
     char key_name[MAX_PATH];
@@ -795,7 +795,7 @@
     char *launch_cmd;
     ap_regkey_t *key;
     apr_status_t rv;
-    
+
     fprintf(stderr,reconfig ? "Reconfiguring the %s service\n"
                    : "Installing the %s service\n", mpm_display_name);
 
@@ -826,22 +826,22 @@
 
         if (reconfig) {
             /* ###: utf-ize */
-            schService = OpenService(schSCManager, mpm_service_name, 
+            schService = OpenService(schSCManager, mpm_service_name,
                                      SERVICE_CHANGE_CONFIG);
             if (!schService) {
-                ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_ERR, 
+                ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_ERR,
                              apr_get_os_error(), NULL,
                              "OpenService failed");
             }
             /* ###: utf-ize */
-            else if (!ChangeServiceConfig(schService, 
+            else if (!ChangeServiceConfig(schService,
                                           SERVICE_WIN32_OWN_PROCESS,
                                           SERVICE_AUTO_START,
                                           SERVICE_ERROR_NORMAL,
-                                          launch_cmd, NULL, NULL, 
+                                          launch_cmd, NULL, NULL,
                                           "Tcpip\0Afd\0", NULL, NULL,
                                           mpm_display_name)) {
-                ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_ERR, 
+                ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_ERR,
                              apr_get_os_error(), NULL,
                              "ChangeServiceConfig failed");
                 /* !schService aborts configuration below */
@@ -850,10 +850,10 @@
             }
         }
         else {
-            /* RPCSS is the Remote Procedure Call (RPC) Locator required 
-             * for DCOM communication pipes.  I am far from convinced we 
-             * should add this to the default service dependencies, but 
-             * be warned that future apache modules or ISAPI dll's may 
+            /* RPCSS is the Remote Procedure Call (RPC) Locator required
+             * for DCOM communication pipes.  I am far from convinced we
+             * should add this to the default service dependencies, but
+             * be warned that future apache modules or ISAPI dll's may
              * depend on it.
              */
             /* ###: utf-ize */
@@ -871,61 +871,61 @@
                                    NULL,                 // use SYSTEM account
                                    NULL);                // no password
 
-            if (!schService) 
+            if (!schService)
             {
                 rv = apr_get_os_error();
-                ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
+                ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
                              "Failed to create WinNT Service Profile");
                 CloseServiceHandle(schSCManager);
                 return (rv);
             }
         }
-        
+
         CloseServiceHandle(schService);
         CloseServiceHandle(schSCManager);
     }
     else /* osver.dwPlatformId != VER_PLATFORM_WIN32_NT */
     {
         /* Store the launch command in the registry */
-        launch_cmd = apr_psprintf(ptemp, "\"%s\" -n %s -k runservice", 
+        launch_cmd = apr_psprintf(ptemp, "\"%s\" -n %s -k runservice",
                                  exe_path, mpm_service_name);
-        rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, SERVICECONFIG9X, 
+        rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, SERVICECONFIG9X,
                             APR_READ | APR_WRITE | APR_CREATE, pconf);
         if (rv == APR_SUCCESS) {
-            rv = ap_regkey_value_set(key, mpm_service_name, 
+            rv = ap_regkey_value_set(key, mpm_service_name,
                                      launch_cmd, 0, pconf);
             ap_regkey_close(key);
         }
         if (rv != APR_SUCCESS) {
-            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
-                         "%s: Failed to add the RunServices registry entry.", 
+            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
+                         "%s: Failed to add the RunServices registry entry.",
                          mpm_display_name);
             return (rv);
         }
 
         apr_snprintf(key_name, sizeof(key_name), SERVICECONFIG, mpm_service_name);
-        rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, key_name, 
+        rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, key_name,
                             APR_READ | APR_WRITE | APR_CREATE, pconf);
         if (rv != APR_SUCCESS) {
-            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
-                         "%s: Failed to create the registry service key.", 
+            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
+                         "%s: Failed to create the registry service key.",
                          mpm_display_name);
             return (rv);
         }
         rv = ap_regkey_value_set(key, "ImagePath", launch_cmd, 0, pconf);
         if (rv != APR_SUCCESS) {
-            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
-                         "%s: Failed to store ImagePath in the registry.", 
+            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
+                         "%s: Failed to store ImagePath in the registry.",
                          mpm_display_name);
             ap_regkey_close(key);
             return (rv);
         }
-        rv = ap_regkey_value_set(key, "DisplayName", 
+        rv = ap_regkey_value_set(key, "DisplayName",
                                  mpm_display_name, 0, pconf);
         ap_regkey_close(key);
         if (rv != APR_SUCCESS) {
-            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
-                         "%s: Failed to store DisplayName in the registry.", 
+            ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
+                         "%s: Failed to store DisplayName in the registry.",
                          mpm_display_name);
             return (rv);
         }
@@ -936,15 +936,15 @@
     /* For both WinNT & Win9x store the service ConfigArgs in the registry...
      */
     apr_snprintf(key_name, sizeof(key_name), SERVICEPARAMS, mpm_service_name);
-    rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, key_name, 
+    rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, key_name,
                         APR_READ | APR_WRITE | APR_CREATE, pconf);
     if (rv == APR_SUCCESS) {
         rv = ap_regkey_value_array_set(key, "ConfigArgs", argc, argv, pconf);
         ap_regkey_close(key);
     }
     if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL, 
-                     "%s: Failed to store the ConfigArgs in the registry.", 
+        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, rv, NULL,
+                     "%s: Failed to store the ConfigArgs in the registry.",
                      mpm_display_name);
         return (rv);
     }
@@ -973,7 +973,7 @@
                          "Failed to open the WinNT service manager.");
             return (rv);
         }
-        
+
         /* ###: utf-ize */
         schService = OpenService(schSCManager, mpm_service_name, DELETE);
 
@@ -983,7 +983,7 @@
                         "%s: OpenService failed", mpm_display_name);
            return (rv);
         }
-        
+
         /* assure the service is stopped before continuing
          *
          * This may be out of order... we might not be able to be
@@ -1000,8 +1000,8 @@
                          "%s: Failed to delete the service.", mpm_display_name);
             return (rv);
         }
-        
-        CloseServiceHandle(schService);        
+
+        CloseServiceHandle(schService);
         CloseServiceHandle(schSCManager);
     }
     else /* osver.dwPlatformId != VER_PLATFORM_WIN32_NT */
@@ -1012,7 +1012,7 @@
 
         /* TODO: assure the service is stopped before continuing */
 
-        rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, SERVICECONFIG9X, 
+        rv = ap_regkey_open(&key, AP_REGKEY_LOCAL_MACHINE, SERVICECONFIG9X,
                             APR_READ | APR_WRITE | APR_CREATE, pconf);
         if (rv == APR_SUCCESS) {
             rv = ap_regkey_value_remove(key, mpm_service_name, pconf);
@@ -1023,7 +1023,7 @@
                          "%s: Failed to remove the RunServices registry "
                          "entry.", mpm_display_name);
         }
-        
+
         /* we blast Services/us, not just the Services/us/Parameters branch */
         apr_snprintf(key_name, sizeof(key_name), SERVICEPARAMS, mpm_service_name);
         rv2 = ap_regkey_remove(AP_REGKEY_LOCAL_MACHINE, key_name, pconf);
@@ -1046,31 +1046,31 @@
 
 /* signal_service_transition is a simple thunk to signal the service
  * and monitor its successful transition.  If the signal passed is 0,
- * then the caller is assumed to already have performed some service 
+ * then the caller is assumed to already have performed some service
  * operation to be monitored (such as StartService), and no actual
  * ControlService signal is sent.
  */
 
 static int signal_service_transition(SC_HANDLE schService, DWORD signal, DWORD pending, DWORD complete)
 {
-    if (signal && !ControlService(schService, signal, &globdat.ssStatus)) 
+    if (signal && !ControlService(schService, signal, &globdat.ssStatus))
         return FALSE;
-    
+
     do {
-        Sleep(1000);    
+        Sleep(1000);
         if (!QueryServiceStatus(schService, &globdat.ssStatus))
             return FALSE;
     } while (globdat.ssStatus.dwCurrentState == pending);
-        
+
     return (globdat.ssStatus.dwCurrentState == complete);
 }
 
 
-apr_status_t mpm_service_start(apr_pool_t *ptemp, int argc, 
+apr_status_t mpm_service_start(apr_pool_t *ptemp, int argc,
                                const char * const * argv)
 {
     apr_status_t rv;
-    
+
     fprintf(stderr,"Starting the %s service\n", mpm_display_name);
 
     if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
@@ -1089,7 +1089,7 @@
         }
 
         /* ###: utf-ize */
-        schService = OpenService(schSCManager, mpm_service_name, 
+        schService = OpenService(schSCManager, mpm_service_name,
                                  SERVICE_START | SERVICE_QUERY_STATUS);
         if (!schService) {
             rv = apr_get_os_error();
@@ -1107,7 +1107,7 @@
             CloseServiceHandle(schSCManager);
             return 0;
         }
-        
+
         start_argv = malloc((argc + 1) * sizeof(const char **));
         memcpy(start_argv, argv, argc * sizeof(const char **));
         start_argv[argc] = NULL;
@@ -1116,13 +1116,13 @@
         /* ###: utf-ize */
         if (StartService(schService, argc, start_argv)
             && signal_service_transition(schService, 0, /* test only */
-                                         SERVICE_START_PENDING, 
+                                         SERVICE_START_PENDING,
                                          SERVICE_RUNNING))
                 rv = APR_SUCCESS;
 
         if (rv != APR_SUCCESS)
             rv = apr_get_os_error();
-        
+
         CloseServiceHandle(schService);
         CloseServiceHandle(schSCManager);
     }
@@ -1150,7 +1150,7 @@
          * console window.
          * The config is pre-flighted, so there should be no danger of failure.
          */
-        
+
         if (GetModuleFileName(NULL, exe_path, sizeof(exe_path)) == 0)
         {
             apr_status_t rv = apr_get_os_error();
@@ -1158,27 +1158,27 @@
                          "GetModuleFileName failed");
             return rv;
         }
-        
-        apr_snprintf(exe_cmd, sizeof(exe_cmd), 
-                     "\"%s\" -n %s -k runservice", 
-                     exe_path, mpm_service_name);  
+
+        apr_snprintf(exe_cmd, sizeof(exe_cmd),
+                     "\"%s\" -n %s -k runservice",
+                     exe_path, mpm_service_name);
         next_arg = strchr(exe_cmd, '\0');
         for (i = 0; i < argc; ++i) {
-            apr_snprintf(next_arg, sizeof(exe_cmd) - (next_arg - exe_cmd), 
+            apr_snprintf(next_arg, sizeof(exe_cmd) - (next_arg - exe_cmd),
                          " \"%s\"", argv[i]);
             next_arg = strchr(exe_cmd, '\0');
         }
-        
+
         memset(&si, 0, sizeof(si));
         memset(&pi, 0, sizeof(pi));
         si.cb = sizeof(si);
         si.dwFlags     = STARTF_USESHOWWINDOW;
         si.wShowWindow = SW_HIDE;   /* This might be redundant */
-        
+
         rv = APR_EINIT;
-        if (CreateProcess(NULL, exe_cmd, NULL, NULL, FALSE, 
+        if (CreateProcess(NULL, exe_cmd, NULL, NULL, FALSE,
                            DETACHED_PROCESS, /* Creation flags */
-                           NULL, NULL, &si, &pi)) 
+                           NULL, NULL, &si, &pi))
         {
             DWORD code;
             while (GetExitCodeProcess(pi.hProcess, &code) == STILL_ACTIVE) {
@@ -1189,13 +1189,13 @@
                 Sleep (1000);
             }
         }
-        
+
         if (rv != APR_SUCCESS)
             rv = apr_get_os_error();
-        
+
         CloseHandle(pi.hProcess);
         CloseHandle(pi.hThread);
-    }    
+    }
 
     if (rv == APR_SUCCESS)
         fprintf(stderr,"The %s service is running.\n", mpm_display_name);
@@ -1203,7 +1203,7 @@
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
                      "%s: Failed to start the service process.",
                      mpm_display_name);
-        
+
     return rv;
 }
 
@@ -1213,15 +1213,15 @@
 void mpm_signal_service(apr_pool_t *ptemp, int signal)
 {
     int success = FALSE;
-    
-    if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) 
+
+    if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT)
     {
         SC_HANDLE   schService;
         SC_HANDLE   schSCManager;
 
         schSCManager = OpenSCManager(NULL, NULL, // default machine & database
                                      SC_MANAGER_CONNECT);
-        
+
         if (!schSCManager) {
             ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL,
                          "Failed to open the NT Service Manager");
@@ -1229,8 +1229,8 @@
         }
 
         /* ###: utf-ize */
-        schService = OpenService(schSCManager, mpm_service_name, 
-                                 SERVICE_INTERROGATE | SERVICE_QUERY_STATUS | 
+        schService = OpenService(schSCManager, mpm_service_name,
+                                 SERVICE_INTERROGATE | SERVICE_QUERY_STATUS |
                                  SERVICE_USER_DEFINED_CONTROL |
                                  SERVICE_START | SERVICE_STOP);
 
@@ -1241,7 +1241,7 @@
             CloseServiceHandle(schSCManager);
             return;
         }
-        
+
         if (!QueryServiceStatus(schService, &globdat.ssStatus)) {
             ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_STARTUP, apr_get_os_error(), NULL,
                          "Query of Service %s failed", mpm_display_name);
@@ -1256,14 +1256,14 @@
             CloseServiceHandle(schSCManager);
             return;
         }
-        
-        fprintf(stderr,"The %s service is %s.\n", mpm_display_name, 
+
+        fprintf(stderr,"The %s service is %s.\n", mpm_display_name,
                signal ? "restarting" : "stopping");
 
         if (!signal)
-            success = signal_service_transition(schService, 
-                                                SERVICE_CONTROL_STOP, 
-                                                SERVICE_STOP_PENDING, 
+            success = signal_service_transition(schService,
+                                                SERVICE_CONTROL_STOP,
+                                                SERVICE_STOP_PENDING,
                                                 SERVICE_STOPPED);
         else if (globdat.ssStatus.dwCurrentState == SERVICE_STOPPED) {
             mpm_service_start(ptemp, 0, NULL);
@@ -1272,9 +1272,9 @@
             return;
         }
         else
-            success = signal_service_transition(schService, 
-                                                SERVICE_APACHE_RESTART, 
-                                                SERVICE_START_PENDING, 
+            success = signal_service_transition(schService,
+                                                SERVICE_APACHE_RESTART,
+                                                SERVICE_START_PENDING,
                                                 SERVICE_RUNNING);
 
         CloseServiceHandle(schService);
@@ -1300,13 +1300,13 @@
             }
         }
 
-        fprintf(stderr,"The %s service is %s.\n", mpm_display_name, 
+        fprintf(stderr,"The %s service is %s.\n", mpm_display_name,
                signal ? "restarting" : "stopping");
 
         apr_snprintf(prefix, sizeof(prefix), "ap%ld", (long)service_pid);
         setup_signal_names(prefix);
 
-        if (!signal) 
+        if (!signal)
         {
             int ticks = 60;
             ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
@@ -1320,7 +1320,7 @@
             }
         }
         else /* !stop */
-        {   
+        {
             /* TODO: Aught to add a little test to the restart logic, and
              * store the restart counter in the window's user dword.
              * Then we can hang on and report a successful restart.  But
@@ -1338,9 +1338,9 @@
     }
 
     if (success)
-        fprintf(stderr,"The %s service has %s.\n", mpm_display_name, 
+        fprintf(stderr,"The %s service has %s.\n", mpm_display_name,
                signal ? "restarted" : "stopped");
     else
-        fprintf(stderr,"Failed to %s the %s service.\n", 
+        fprintf(stderr,"Failed to %s the %s service.\n",
                signal ? "restart" : "stop", mpm_display_name);
 }

Modified: httpd/httpd/trunk/server/mpm/worker/fdqueue.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/worker/fdqueue.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/fdqueue.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/fdqueue.c Thu Nov 10 07:11:44 2005
@@ -233,7 +233,7 @@
  * Callback routine that is called to destroy this
  * fd_queue_t when its pool is destroyed.
  */
-static apr_status_t ap_queue_destroy(void *data) 
+static apr_status_t ap_queue_destroy(void *data)
 {
     fd_queue_t *queue = data;
 
@@ -276,7 +276,7 @@
 }
 
 /**
- * Push a new socket onto the queue. 
+ * Push a new socket onto the queue.
  *
  * precondition: ap_queue_info_wait_for_idler has already been called
  *               to reserve an idle worker thread
@@ -340,7 +340,7 @@
                 return APR_EINTR;
             }
         }
-    } 
+    }
 
     elem = &queue->data[--queue->nelts];
     *sd = elem->sd;
@@ -357,7 +357,7 @@
 apr_status_t ap_queue_interrupt_all(fd_queue_t *queue)
 {
     apr_status_t rv;
-    
+
     if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
         return rv;
     }
@@ -373,7 +373,7 @@
         return rv;
     }
     /* we must hold one_big_mutex when setting this... otherwise,
-     * we could end up setting it and waking everybody up just after a 
+     * we could end up setting it and waking everybody up just after a
      * would-be popper checks it but right before they block
      */
     queue->terminated = 1;

Modified: httpd/httpd/trunk/server/mpm/worker/pod.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm/worker/pod.c?rev=332306&r1=332305&r2=332306&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/pod.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/pod.c Thu Nov 10 07:11:44 2005
@@ -33,7 +33,7 @@
     apr_file_pipe_timeout_set((*pod)->pod_in, 0);
 */
     (*pod)->p = p;
-    
+
     /* close these before exec. */
     apr_file_inherit_unset((*pod)->pod_in);
     apr_file_inherit_unset((*pod)->pod_out);



Mime
View raw message