httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r663704 - /httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c
Date Thu, 05 Jun 2008 19:11:28 GMT
Author: wrowe
Date: Thu Jun  5 12:11:27 2008
New Revision: 663704

URL: http://svn.apache.org/viewvc?rev=663704&view=rev
Log:
httpd-2.2 and -2.0 specific patch to revert to 2.0.55/2.2.0 handling of the
stdout channel; do not close stdout in the parent process or reassign it to
\\Device\Null, but keep it open so that the console signal handler continues
to interact with the running "daemonized" httpd process.

Not committed to httpd-2.x; there is disagreement as to whether this is good
behavior for a daemon, and the proper 2.4(3.0) behavior on Win32 may be to
daemonize but properly handle -k stop by the PID file contents.  Many have
asked for this feature who run a minimal httpd.exe, especially from some
removeable media such as CD, and wish to be able to halt it as a console. 

PR: 44800 (part 3/3)
Submitted by: tdonovan

Modified:
    httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c

Modified: httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c?rev=663704&r1=663703&r2=663704&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c (original)
+++ httpd/httpd/branches/2.2.x/server/mpm/winnt/mpm_winnt.c Thu Jun  5 12:11:27 2008
@@ -681,7 +681,8 @@
     }
 
     /* httpd-2.0/2.2 specific to work around apr_proc_create bugs */
-    if (((rv = apr_file_open_stdout(&child_out, p))
+    /* set "NUL" as sysout for the child */
+    if (((rv = apr_file_open(&child_out, "NUL", APR_WRITE | APR_READ, APR_OS_DEFAULT,p))

             != APR_SUCCESS) ||
         ((rv = apr_procattr_child_out_set(attr, child_out, NULL))
             != APR_SUCCESS)) {
@@ -735,7 +736,7 @@
         CloseHandle(new_child.hproc);
         return -1;
     }
-
+    apr_file_close(child_out);
     ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                  "Parent: Created child process %d", new_child.pid);
 
@@ -1430,26 +1431,6 @@
                      service_name);
         exit(APEXIT_INIT);
     }
-    else if (!one_process && !ap_my_generation) {
-        /* Open a null handle to soak stdout in this process.
-         * We need to emulate apr_proc_detach, unix performs this
-         * same check in the pre_config hook (although it is
-         * arguably premature).  Services already fixed this.
-         */
-        apr_file_t *nullfile;
-        apr_status_t rv;
-        apr_pool_t *pproc = apr_pool_parent_get(pconf);
-
-        if ((rv = apr_file_open(&nullfile, "NUL",
-                                APR_READ | APR_WRITE, APR_OS_DEFAULT,
-                                pproc)) == APR_SUCCESS) {
-            apr_file_t *nullstdout;
-            if (apr_file_open_stdout(&nullstdout, pproc)
-                    == APR_SUCCESS)
-                apr_file_dup2(nullstdout, nullfile, pproc);
-            apr_file_close(nullfile);
-        }
-    }
 
     /* Win9x: disable AcceptEx */
     if (osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {



Mime
View raw message