httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1703157 - /httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c
Date Tue, 15 Sep 2015 11:40:53 GMT
Author: ylavic
Date: Tue Sep 15 11:40:53 2015
New Revision: 1703157

URL: http://svn.apache.org/r1703157
Log:
mpm_winnt: make AP_MPMQ_GENERATION available in the child process as soon
as possible, so that hooks/modules can query it at config stage.
This is (e.g.) needed by r1702501 for PR 58024.

Modified:
    httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c

Modified: httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c?rev=1703157&r1=1703156&r2=1703157&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c Tue Sep 15 11:40:53 2015
@@ -359,6 +359,13 @@ static int send_handles_to_child(apr_poo
     HANDLE os_start;
     HANDLE hScore;
 
+    if ((rv = apr_file_write_full(child_in, &my_generation,
+                                  sizeof(my_generation), NULL))
+            != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, APLOGNO(02964)
+                     "Parent: Unable to send its generation to the child");
+        return -1;
+    }
     if (!DuplicateHandle(hCurrentProcess, child_ready_event, hProcess, &hDup,
         EVENT_MODIFY_STATE | SYNCHRONIZE, FALSE, 0)) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf, APLOGNO(00392)
@@ -1036,6 +1043,7 @@ static void winnt_rewrite_args(process_r
     {
         HANDLE filehand;
         HANDLE hproc = GetCurrentProcess();
+        DWORD BytesRead;
 
         /* This is the child */
         my_pid = GetCurrentProcessId();
@@ -1073,6 +1081,16 @@ static void winnt_rewrite_args(process_r
          * already
          */
 
+        /* Read this child's generation number as soon as now,
+         * so that further hooks can query it.
+         */
+        if (!ReadFile(pipe, &my_generation, sizeof(my_generation),
+                      &BytesRead, (LPOVERLAPPED) NULL)
+                || (BytesRead != sizeof(my_generation))) {
+            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), NULL, APLOGNO(02965)
+                         "Child: Unable to retrieve my generation from the parent");
+            exit(APEXIT_CHILDINIT);
+        }
 
         /* The parent is responsible for providing the
          * COMPLETE ARGUMENTS REQUIRED to the child.
@@ -1664,8 +1682,6 @@ static void winnt_child_init(apr_pool_t
 
         /* Done reading from the parent, close that channel */
         CloseHandle(pipe);
-
-        my_generation = ap_scoreboard_image->global->running_generation;
     }
     else {
         /* Single process mode - this lock doesn't even need to exist */



Mime
View raw message