From 3c90c3f5f4c2540211146c0b6256f29ed824961c Mon Sep 17 00:00:00 2001 From: Justin Erenkrantz Date: Thu, 30 Aug 2001 20:50:06 +0000 Subject: [PATCH] Add -X functionality back to httpd. - Updates upgrading.html - Reverts Aaron's earlier docco patch (sorry...) - Adds -X to all mpms in the tree git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90824 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ docs/manual/upgrading.html.en | 6 ------ docs/manual/upgrading.html.fr | 5 ----- include/http_main.h | 2 +- server/main.c | 4 ++++ server/mpm/beos/beos.c | 13 ++++++++--- server/mpm/experimental/perchild/perchild.c | 23 ++++++++++++-------- server/mpm/mpmt_os2/mpmt_os2.c | 3 ++- server/mpm/perchild/perchild.c | 23 ++++++++++++-------- server/mpm/prefork/prefork.c | 23 ++++++++++++-------- server/mpm/spmt_os2/spmt_os2.c | 11 +++++----- server/mpm/threaded/threaded.c | 24 ++++++++++++--------- server/mpm/winnt/mpm_winnt.c | 3 ++- server/mpm/worker/worker.c | 13 ++++++++--- 14 files changed, 94 insertions(+), 62 deletions(-) diff --git a/CHANGES b/CHANGES index 2a1022c2b9..94e1567039 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.26-dev + *) Add -X functionality back. This indicates to all MPMs and any other + part of Apache that it should run in "debug" mode. [Justin Erenkrantz] + *) Some initial support for the cygwin platform [prefork only]. This is not to be confused with support for the WinNT/Win32 platform, which is the recommended configuration for native diff --git a/docs/manual/upgrading.html.en b/docs/manual/upgrading.html.en index 3a8c47c248..d06bea5c5b 100644 --- a/docs/manual/upgrading.html.en +++ b/docs/manual/upgrading.html.en @@ -108,12 +108,6 @@ parent process with WINCH rather than which was used for printing the virtual host configuration has been replaced by -t -D DUMP_VHOSTS. -
  • The httpd command line option -X has -been removed. Most MPMs allow the same functionality to be requested -by using the -D ONE_PROCESS command line -option. In addition, a -D NO_DETACH command line -option is available.
  • -
  • The module mod_auth_digest, which was experimental in Apache 1.3 is now a standard module.
  • diff --git a/docs/manual/upgrading.html.fr b/docs/manual/upgrading.html.fr index aaf2b5baee..b95661ba85 100644 --- a/docs/manual/upgrading.html.fr +++ b/docs/manual/upgrading.html.fr @@ -105,11 +105,6 @@ signal USR1. qui servait à afficher la configuration des hôtes virtuels est remplacé par -t -D DUMP_VHOSTS. -
  • L'option -X du programme httpd -est supprime. La majorité des MPM permettent la même fonctionnalité -en définissant les variables d'environnement ONE_PROCESS et -NO_DETACH avant de lancer httpd.
  • -
  • Le module mod_auth_digest, qui était expérimental dans la version 1.3, est maintenant un module standard.
  • diff --git a/include/http_main.h b/include/http_main.h index cd81404fda..102265c9d2 100644 --- a/include/http_main.h +++ b/include/http_main.h @@ -63,7 +63,7 @@ * in apr_getopt() format. Use this for default'ing args that the MPM * can safely ignore and pass on from its rewrite_args() handler. */ -#define AP_SERVER_BASEARGS "C:c:D:d:f:vVlLth?" +#define AP_SERVER_BASEARGS "C:c:D:d:f:vVlLth?X" #ifdef __cplusplus extern "C" { diff --git a/server/main.c b/server/main.c index cfee4a987d..4b18845e14 100644 --- a/server/main.c +++ b/server/main.c @@ -344,6 +344,10 @@ int main(int argc, const char * const argv[]) new = (char **)apr_array_push(ap_server_config_defines); *new = apr_pstrdup(pcommands, optarg); break; + case 'X': + new = (char **)apr_array_push(ap_server_config_defines); + *new = "DEBUG"; + break; case 'f': confname = optarg; break; diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index 036604ed6b..e539c490e1 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -944,10 +944,17 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) static void beos_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { static int restart_num = 0; - int no_detach = 0; + int no_detach, debug; - one_process = !!ap_exists_config_define("ONE_PROCESS"); - no_detach = !!ap_exists_config_define("NO_DETACH"); + debug = ap_exists_config_define("DEBUG"); + + if (debug) + no_detach = one_process = 1; + else + { + one_process = ap_exists_config_define("ONE_PROCESS"); + no_detach = ap_exists_config_define("NO_DETACH"); + } /* sigh, want this only the second time around */ if (restart_num++ == 1) { diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index e5d43aeed6..2f781aed91 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -170,12 +170,10 @@ static apr_lock_t *pipe_of_death_mutex; server_rec *ap_server_conf; -/* The perchild MPM respects a couple of runtime flags that can aid - * in debugging. Setting the -DNO_DETACH flag will prevent the root process - * from detaching from its controlling terminal. Additionally, setting - * the -DONE_PROCESS flag (which implies -DNO_DETACH) will get you the - * child_main loop running in the process which originally started up. - * This gives you a pretty nice debugging environment. (You'll get a SIGHUP +/* one_process --- debugging mode variable; can be set from the command line + * with the -X flag. If set, this gets you the child_main loop running + * in the process which originally started up (no detach, no make_child), + * which is a pretty nice debugging environment. (You'll get a SIGHUP * early in standalone_main; just continue through. This is the server * trying to kill off any child processes which it might have lying * around --- Apache doesn't keep track of their pids, it just sends @@ -1326,11 +1324,18 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) static void perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) { static int restart_num = 0; - int no_detach = 0; + int no_detach, debug; int i; - one_process = !!ap_exists_config_define("ONE_PROCESS"); - no_detach = !!ap_exists_config_define("NO_DETACH"); + debug = ap_exists_config_define("DEBUG"); + + if (debug) + no_detach = one_process = 1; + else + { + one_process = ap_exists_config_define("ONE_PROCESS"); + no_detach = ap_exists_config_define("NO_DETACH"); + } /* sigh, want this only the second time around */ if (restart_num++ == 1) { diff --git a/server/mpm/mpmt_os2/mpmt_os2.c b/server/mpm/mpmt_os2/mpmt_os2.c index edfce5c6a6..405147629b 100644 --- a/server/mpm/mpmt_os2/mpmt_os2.c +++ b/server/mpm/mpmt_os2/mpmt_os2.c @@ -483,7 +483,8 @@ int ap_graceful_stop_signalled(void) static void mpmt_os2_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { - one_process = !!ap_exists_config_define("ONE_PROCESS"); + one_process = ap_exists_config_define("ONE_PROCESS") || + ap_exists_config_define("DEBUG"); is_graceful = 0; ap_listen_pre_config(); ap_daemons_to_start = DEFAULT_START_DAEMON; diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index e5d43aeed6..2f781aed91 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -170,12 +170,10 @@ static apr_lock_t *pipe_of_death_mutex; server_rec *ap_server_conf; -/* The perchild MPM respects a couple of runtime flags that can aid - * in debugging. Setting the -DNO_DETACH flag will prevent the root process - * from detaching from its controlling terminal. Additionally, setting - * the -DONE_PROCESS flag (which implies -DNO_DETACH) will get you the - * child_main loop running in the process which originally started up. - * This gives you a pretty nice debugging environment. (You'll get a SIGHUP +/* one_process --- debugging mode variable; can be set from the command line + * with the -X flag. If set, this gets you the child_main loop running + * in the process which originally started up (no detach, no make_child), + * which is a pretty nice debugging environment. (You'll get a SIGHUP * early in standalone_main; just continue through. This is the server * trying to kill off any child processes which it might have lying * around --- Apache doesn't keep track of their pids, it just sends @@ -1326,11 +1324,18 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) static void perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) { static int restart_num = 0; - int no_detach = 0; + int no_detach, debug; int i; - one_process = !!ap_exists_config_define("ONE_PROCESS"); - no_detach = !!ap_exists_config_define("NO_DETACH"); + debug = ap_exists_config_define("DEBUG"); + + if (debug) + no_detach = one_process = 1; + else + { + one_process = ap_exists_config_define("ONE_PROCESS"); + no_detach = ap_exists_config_define("NO_DETACH"); + } /* sigh, want this only the second time around */ if (restart_num++ == 1) { diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 320c8b9757..c10c51a1fc 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -156,12 +156,10 @@ static apr_socket_t *sd; static fd_set listenfds; static int listenmaxfd; -/* The prefork MPM respects a couple of runtime flags that can aid - * in debugging. Setting the -DNO_DETACH flag will prevent the root process - * from detaching from its controlling terminal. Additionally, setting - * the -DONE_PROCESS flag (which implies -DNO_DETACH) will get you the - * child_main loop running in the process which originally started up. - * This gives you a pretty nice debugging environment. (You'll get a SIGHUP +/* one_process --- debugging mode variable; can be set from the command line + * with the -X flag. If set, this gets you the child_main loop running + * in the process which originally started up (no detach, no make_child), + * which is a pretty nice debugging environment. (You'll get a SIGHUP * early in standalone_main; just continue through. This is the server * trying to kill off any child processes which it might have lying * around --- Apache doesn't keep track of their pids, it just sends @@ -1319,10 +1317,17 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) static void prefork_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp) { static int restart_num = 0; - int no_detach = 0; + int no_detach, debug; - no_detach = !!ap_exists_config_define("NO_DETACH"); - one_process = !!ap_exists_config_define("ONE_PROCESS"); + debug = ap_exists_config_define("DEBUG"); + + if (debug) + no_detach = one_process = 1; + else + { + no_detach = ap_exists_config_define("NO_DETACH"); + one_process = ap_exists_config_define("ONE_PROCESS"); + } /* sigh, want this only the second time around */ if (restart_num++ == 1) { diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index 2d3e7107ff..9f87729a17 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -104,10 +104,10 @@ char ap_coredump_dir[MAX_STRING_LEN]; server_rec *ap_server_conf; -/* The spmt_os2 MPM respects a runtime flag that can aid - * in debugging. Setting the -DONE_PROCESS flag will get you the - * child_main loop running in the process which originally started up. - * This gives you a pretty nice debugging environment. (You'll get a SIGHUP +/* one_process --- debugging mode variable; can be set from the command line + * with the -X flag. If set, this gets you the child_main loop running + * in the process which originally started up (no detach, no make_child), + * which is a pretty nice debugging environment. (You'll get a SIGHUP * early in standalone_main; just continue through. This is the server * trying to kill off any child processes which it might have lying * around --- Apache doesn't keep track of their pids, it just sends @@ -1151,7 +1151,8 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) static void spmt_os2_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { - one_process = !!ap_exists_config_define("ONE_PROCESS"); + one_process = ap_exists_config_define("ONE_PROCESS") || + ap_exists_config_define("DEBUG"); is_graceful = 0; ap_listen_pre_config(); diff --git a/server/mpm/threaded/threaded.c b/server/mpm/threaded/threaded.c index 2040af7a42..b55923f111 100644 --- a/server/mpm/threaded/threaded.c +++ b/server/mpm/threaded/threaded.c @@ -148,13 +148,10 @@ static apr_lock_t *pipe_of_death_mutex; /* insures that a child process only server_rec *ap_server_conf; - -/* The threaded MPM respects a couple of runtime flags that can aid - * in debugging. Setting the -DNO_DETACH flag will prevent the root process - * from detaching from its controlling terminal. Additionally, setting - * the -DONE_PROCESS flag (which implies -DNO_DETACH) will get you the - * child_main loop running in the process which originally started up. - * This gives you a pretty nice debugging environment. (You'll get a SIGHUP +/* one_process --- debugging mode variable; can be set from the command line + * with the -X flag. If set, this gets you the child_main loop running + * in the process which originally started up (no detach, no make_child), + * which is a pretty nice debugging environment. (You'll get a SIGHUP * early in standalone_main; just continue through. This is the server * trying to kill off any child processes which it might have lying * around --- Apache doesn't keep track of their pids, it just sends @@ -1360,10 +1357,17 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) static void threaded_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { static int restart_num = 0; - int no_detach = 0; + int no_detach, debug; + + debug = ap_exists_config_define("DEBUG"); - one_process = !!ap_exists_config_define("ONE_PROCESS"); - no_detach = !!ap_exists_config_define("NO_DETACH"); + if (debug) + no_detach = one_process = 1; + else + { + no_detach = ap_exists_config_define("NO_DETACH"); + one_process = ap_exists_config_define("ONE_PROCESS"); + } /* sigh, want this only the second time around */ if (restart_num++ == 1) { diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 45712d51ae..c8a4c97c19 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -1835,7 +1835,8 @@ static void winnt_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *pt */ apr_status_t rv; - if (ap_exists_config_define("ONE_PROCESS")) + if (ap_exists_config_define("ONE_PROCESS") || + ap_exists_config_define("DEBUG")) one_process = -1; if (!strcasecmp(signal_arg, "runservice") diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 3634b16259..2fab078e34 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -1438,10 +1438,17 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) static void worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { static int restart_num = 0; - int no_detach = 0; + int no_detach, debug; - one_process = !!ap_exists_config_define("ONE_PROCESS"); - no_detach = !!ap_exists_config_define("NO_DETACH"); + debug = ap_exists_config_define("DEBUG"); + + if (debug) + no_detach = one_process = 1; + else + { + one_process = ap_exists_config_define("ONE_PROCESS"); + no_detach = ap_exists_config_define("NO_DETACH"); + } /* sigh, want this only the second time around */ if (restart_num++ == 1) { -- 2.40.0