From: Ryan Bloom Date: Tue, 1 Aug 2000 17:36:13 +0000 (+0000) Subject: Add a NO_DETACH environment variable to all MPMs that understand X-Git-Tag: APACHE_2_0_ALPHA_5~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69714973ef34245a4f79ed1ad19be3f548106929;p=apache Add a NO_DETACH environment variable to all MPMs that understand ONE_PROCESS. This allows Apache to start up without detaching from the controlling terminal, but also not going into single process mode. The main purpose of this patch is to make it very easy to debug the child process startup code. PR: 2144 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85970 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index af388617cf..25f1413a65 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ Apache 2.0 STATUS: -Last modified at [$Date: 2000/08/01 17:06:20 $] +Last modified at [$Date: 2000/08/01 17:36:02 $] Release: @@ -424,10 +424,6 @@ put them into 'the next release': mod_status always displays 256 possible connection slots Status: - * PR#2144: general - apache always detaches for normal operation - Status: - * PR#2221: documentation Make online documentation search link back to my installation Status: diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index d65a42a869..1e8fb63dd0 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -851,13 +851,15 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) static void beos_pre_config(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp) { static int restart_num = 0; + int no_detach = 0; one_process = !!getenv("ONE_PROCESS"); + no_detach = !!getenv("NO_DETACH"); /* sigh, want this only the second time around */ if (restart_num++ == 1) { is_graceful = 0; - if (!one_process) + if (!one_process && !no_detach) ap_detach(); server_pid = getpid(); } diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index e0b8df672f..6e4e36875c 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -1140,14 +1140,16 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) static void dexter_pre_config(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp) { static int restart_num = 0; + int no_detach = 0; one_process = !!getenv("ONE_PROCESS"); + no_detach = !!getenv("NO_DETACH"); /* sigh, want this only the second time around */ if (restart_num++ == 1) { is_graceful = 0; - if (!one_process) { + if (!one_process && !no_detach) { ap_detach(); } diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index e7aad6d224..ba5514f209 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -841,14 +841,16 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) static void mpmt_beos_pre_config(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp) { static int restart_num = 0; + int no_detach = 0; one_process = !!getenv("ONE_PROCESS"); + no_detach = !!getenv("NO_DETACH"); /* sigh, want this only the second time around */ if (restart_num++ == 1) { is_graceful = 0; - if (!one_process) { + if (!one_process && !no_detach) { beosd_detach(); } diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 3aec08e7c6..c9e7dc3deb 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1176,14 +1176,16 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) static void mpmt_pthread_pre_config(ap_pool_t *pconf, ap_pool_t *plog, ap_pool_t *ptemp) { static int restart_num = 0; + int no_detach = 0; one_process = !!getenv("ONE_PROCESS"); + no_detach = !!getenv("NO_DETACH"); /* sigh, want this only the second time around */ if (restart_num++ == 1) { is_graceful = 0; - if (!one_process) { + if (!one_process && !no_detach) { ap_detach(); } ap_my_pid = getpid(); diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index e22cf248a7..16a7425ea0 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -1529,14 +1529,16 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) static void prefork_pre_config(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp) { static int restart_num = 0; + int no_detach = 0; one_process = !!getenv("ONE_PROCESS"); + no_detach = !!getenv("NO_DETACH"); /* sigh, want this only the second time around */ if (restart_num++ == 1) { is_graceful = 0; - if (!one_process) { + if (!one_process && !no_detach) { ap_detach(); }