Do not commit this patch as is. I am about to go offline for the rest of the day. I'll
look at it more tonight or tomorrow...

Bill

Index: mpm_winnt.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
retrieving revision 1.229
diff -u -r1.229 mpm_winnt.c
--- mpm_winnt.c 8 Feb 2002 19:37:02 -0000 1.229
+++ mpm_winnt.c 9 Feb 2002 15:37:18 -0000
@@ -553,6 +553,7 @@
     apr_status_t rv;

     pipe = GetStdHandle(STD_INPUT_HANDLE);
+#if 0
     if (!ReadFile(pipe, &exit_event, sizeof(HANDLE),
                   &BytesRead, (LPOVERLAPPED) NULL)
         || (BytesRead != sizeof(HANDLE))) {
@@ -560,7 +561,11 @@
                      "Child %d: Unable to retrieve the exit event from the parent",
my_pid);
         exit(APEXIT_CHILDINIT);
     }
-
+#else
+//    exit_event_name = apr_psprintf(pconf, "apC%d", my_pid);
+    exit_event = OpenEvent(EVENT_ALL_ACCESS, FALSE, apr_psprintf(pconf, "apC%d",
my_pid));
+#endif
+
     if (!ReadFile(pipe, &hScore, sizeof(hScore),
                   &BytesRead, (LPOVERLAPPED) NULL)
         || (BytesRead != sizeof(hScore))) {
@@ -1339,7 +1344,7 @@
     HANDLE hDup;
     HANDLE hCurrentProcess = GetCurrentProcess();
     DWORD BytesWritten;
-
+#if 0
     if (!DuplicateHandle(hCurrentProcess, child_exit_event, hProcess, &hDup,
                          EVENT_MODIFY_STATE | SYNCHRONIZE, FALSE, 0)) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,
@@ -1353,7 +1358,7 @@
                      "Parent: Unable to send the exit event handle to the child");
         return -1;
     }
-
+#endif
     if ((rv = apr_os_shm_get(&hScore, ap_scoreboard_shm)) != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
                      "Parent: Unable to retrieve the scoreboard handle for the 
child");
@@ -1580,7 +1585,7 @@

     rv = CreateProcess(NULL, pCommand, NULL, NULL,
                        TRUE,               /* Inherit handles */
-                       0,                  /* Creation flags */
+                       CREATE_SUSPENDED,                  /* Creation flags */
                        pEnvBlock,          /* Environment block */
                        NULL,
                        &si, &pi);
@@ -1597,10 +1602,12 @@

     /* Undo everything we created for the child only
      */
+#if 0
     CloseHandle(pi.hThread);
     CloseHandle(hPipeRead);
     CloseHandle(hNullOutput);
     CloseHandle(hShareError);
+#endif
     _putenv("AP_PARENT_PID=");
     _putenv("AP_MY_GENERATION=");

@@ -1612,6 +1619,24 @@
         CloseHandle(pi.hThread);
         return -1;
     }
+    {
+        SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
+        /* Create the child_exit_event, apCchild_pid. */
+        sa.nLength = sizeof(sa);
+        sa.bInheritHandle = TRUE;
+        sa.lpSecurityDescriptor = NULL;
+        *child_exit_event = CreateEvent(&sa, TRUE, FALSE, apr_psprintf(pconf,"apC%d",
pi.dwProcessId));
+        if (!(*child_exit_event)) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,
+                         "Parent: Could not create exit event for child process");
+            CloseHandle(hPipeWrite);
+            CloseHandle(pi.hProcess);
+            CloseHandle(pi.hThread);
+            return -1;
+        }
+    }
+    ResumeThread(pi.hThread);
+    CloseHandle(pi.hThread);

     ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS, ap_server_conf,
                  "Parent: Created child process %d", pi.dwProcessId);
@@ -1620,6 +1645,7 @@
         CloseHandle(hPipeWrite);
         return -1;
     }
+

     if (send_listeners_to_child(p, pi.dwProcessId, hPipeWrite)) {
         CloseHandle(hPipeWrite);
@@ -2114,7 +2140,14 @@
      * in these cases we -don't- care if httpd.conf has config errors!
      */
     apr_status_t rv;
+#if 0
+    static once = 1;

+    if (once) {
+        Sleep(15000);
+        once = 0;
+    }
+#endif
     if (ap_exists_config_define("ONE_PROCESS") ||
         ap_exists_config_define("DEBUG"))
         one_process = -1;


Reply via email to