From: Jeff Trawick Date: Sun, 29 Feb 2004 14:53:01 +0000 (+0000) Subject: merge WinNT MPM support for mpm state query from 2.1-dev X-Git-Tag: 2.0.49~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d4ebc6c211f46683ee4d1a39f9243c6e39718a3;p=thirdparty%2Fapache%2Fhttpd.git merge WinNT MPM support for mpm state query from 2.1-dev Submitted by: trawick, stoddard Reviewed by: trawick, stoddard, ake git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@102825 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index adf65d45182..3345660c936 100644 --- a/CHANGES +++ b/CHANGES @@ -132,8 +132,8 @@ Changes with Apache 2.0.49 [Tomasz Kepczynski ] *) Add AP_MPMQ_MPM_STATE function code for ap_mpm_query. (Not yet - supported for BeOS, OS/2, or Win32 MPMs.) [Jeff Trawick, - Brad Nicholes] + supported for BeOS or OS/2 MPMs.) [Jeff Trawick, Brad Nicholes, + Bill Stoddard] *) Add mod_status hook to allow modules to add to the mod_status report. [Joe Orton] diff --git a/STATUS b/STATUS index f88128ea7af..b92dbc179f0 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2004/02/29 14:13:16 $] +Last modified at [$Date: 2004/02/29 14:53:00 $] Release: @@ -184,15 +184,6 @@ PATCHES TO BACKPORT FROM 2.1 shows breakage on Solaris which can't -lcrypto -lssl without the extra pkgconfig/openssl.pc Libs: * foo } - * PREREQ for another fix (stranded piped logger processes) - - ap_mpm_query(AP_MPMQ_MPM_STATE) - No updates are available at present for the BeOS or OS/2 MPMs, - but that is not a showstopper for the other changes. - server/mpm/winnt/mpm_winnt.c r1.303, r1.306 - server/mpm/winnt/mpm_winnt.h r1.44 - server/mpm/winnt/child.c r1.21 - +1: trawick, stoddard, ake - * piped log programs respawning after Apache is stopped. PR 24805 bogus "piped log program '(null)' failed" messages during restart. PR 21648. Two people have tested a similar log.c patch diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index 47c9703df73..1859156e7f6 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -49,7 +49,6 @@ HANDLE exit_event; /* child_main() should never need to modify is_graceful!?! */ extern int volatile is_graceful; - /* Queue for managing the passing of COMP_CONTEXTs between * the accept and worker threads. */ @@ -866,6 +865,7 @@ void child_main(apr_pool_t *pconf) if (!listener_started && threads_created) { create_listener_thread(); listener_started = 1; + winnt_mpm_state = AP_MPMQ_RUNNING; } if (threads_created == ap_threads_per_child) { break; @@ -944,6 +944,8 @@ void child_main(apr_pool_t *pconf) */ shutdown: + + winnt_mpm_state = AP_MPMQ_STOPPING; /* Setting is_graceful will cause threads handling keep-alive connections * to close the connection after handling the current request. */ diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 8d5ce7b9cc2..2cfde3fe53b 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -64,6 +64,7 @@ int use_acceptex = 1; static int thread_limit = DEFAULT_THREAD_LIMIT; static int first_thread_limit = 0; static int changed_limit_at_restart; +int winnt_mpm_state = AP_MPMQ_STARTING; /* ap_my_generation are used by the scoreboard code */ ap_generation_t volatile ap_my_generation=0; @@ -885,6 +886,7 @@ static int master_main(server_rec *s, HANDLE shutdown_event, HANDLE restart_even ap_scoreboard_image->parent[0].pid = child_pid; /* Wait for shutdown or restart events or for child death */ + winnt_mpm_state = AP_MPMQ_RUNNING; rv = WaitForMultipleObjects(NUM_WAIT_HANDLES, (HANDLE *) event_handles, FALSE, INFINITE); cld = rv - WAIT_OBJECT_0; if (rv == WAIT_FAILED) { @@ -964,6 +966,7 @@ die_now: 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 * child a bit of time to exit gracefully. If the time expires, @@ -995,7 +998,7 @@ die_now: } return 0; /* Tell the caller we do not want to restart */ } - + winnt_mpm_state = AP_MPMQ_STARTING; return 1; /* Tell the caller we want a restart */ } @@ -1048,6 +1051,9 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result) case AP_MPMQ_MAX_DAEMONS: *result = 0; return APR_SUCCESS; + case AP_MPMQ_MPM_STATE: + *result = winnt_mpm_state; + return APR_SUCCESS; } return APR_ENOTIMPL; } diff --git a/server/mpm/winnt/mpm_winnt.h b/server/mpm/winnt/mpm_winnt.h index 3b7eddde5df..66d56d5e380 100644 --- a/server/mpm/winnt/mpm_winnt.h +++ b/server/mpm/winnt/mpm_winnt.h @@ -58,6 +58,7 @@ void mpm_nt_eventlog_stderr_flush(void); /* From winnt.c: */ extern int use_acceptex; +extern int winnt_mpm_state; extern OSVERSIONINFO osver; extern void clean_child_exit(int);