This attempts to add the -X functionality back into Apache 2.0.
I chose the simplest way of implementing this - have -X define a config
symbol called DEBUG (and you could use -DDEBUG as well). If the MPMs
detect this symbol, it should do whatever is necessary for DEBUG mode
(which isn't necessarily ONE_PROCESS). ONE_PROCESS and NO_DETACH are
still available.
This patch also removes the !! in the ap_exists_config_define calls
as I can't fathom what that is good for.
Comments and suggestions welcomed. -- justin
Index: include/http_main.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/include/http_main.h,v
retrieving revision 1.19
diff -u -r1.19 http_main.h
--- include/http_main.h 2001/02/16 04:26:31 1.19
+++ include/http_main.h 2001/06/20 16:28:03
@@ -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" {
Index: server/main.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/main.c,v
retrieving revision 1.99
diff -u -r1.99 main.c
--- server/main.c 2001/05/22 01:31:11 1.99
+++ server/main.c 2001/06/20 16:28:05
@@ -344,6 +344,10 @@
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;
Index: server/mpm/beos/beos.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/beos/beos.c,v
retrieving revision 1.52
diff -u -r1.52 beos.c
--- server/mpm/beos/beos.c 2001/05/07 18:41:36 1.52
+++ server/mpm/beos/beos.c 2001/06/20 16:28:09
@@ -896,10 +896,17 @@
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 = 0, 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) {
Index: server/mpm/perchild/perchild.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/perchild/perchild.c,v
retrieving revision 1.67
diff -u -r1.67 perchild.c
--- server/mpm/perchild/perchild.c 2001/06/12 14:04:12 1.67
+++ server/mpm/perchild/perchild.c 2001/06/20 16:28:11
@@ -1309,11 +1309,18 @@
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 = 0, 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) {
Index: server/mpm/prefork/prefork.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/prefork/prefork.c,v
retrieving revision 1.185
diff -u -r1.185 prefork.c
--- server/mpm/prefork/prefork.c 2001/06/14 15:46:44 1.185
+++ server/mpm/prefork/prefork.c 2001/06/20 16:28:13
@@ -1291,10 +1291,17 @@
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 = 0, 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) {
Index: server/mpm/spmt_os2/spmt_os2.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/spmt_os2/spmt_os2.c,v
retrieving revision 1.95
diff -u -r1.95 spmt_os2.c
--- server/mpm/spmt_os2/spmt_os2.c 2001/05/20 07:28:59 1.95
+++ server/mpm/spmt_os2/spmt_os2.c 2001/06/20 16:28:15
@@ -1136,7 +1136,8 @@
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();
Index: server/mpm/threaded/threaded.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/threaded/threaded.c,v
retrieving revision 1.35
diff -u -r1.35 threaded.c
--- server/mpm/threaded/threaded.c 2001/06/15 18:33:09 1.35
+++ server/mpm/threaded/threaded.c 2001/06/20 16:28:16
@@ -1226,10 +1226,17 @@
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 = 0, 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
+ {
+ 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) {
Index: server/mpm/winnt/mpm_winnt.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
retrieving revision 1.159
diff -u -r1.159 mpm_winnt.c
--- server/mpm/winnt/mpm_winnt.c 2001/06/18 19:09:55 1.159
+++ server/mpm/winnt/mpm_winnt.c 2001/06/20 16:28:18
@@ -1778,7 +1778,8 @@
*/
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")