The following reply was made to PR general/2144; it has been noted by GNATS.
From: Janos Farkas [EMAIL PROTECTED]
To: Dean Gaudet [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: general/2144: apache always detaches for normal operation
Date: Mon, 31 Aug 1998 17:13:32 +0200
On 1998-04-27 at 20:09:17, Dean Gaudet wrote:
1.3 is in feature freeze... but if you want to work this out that's cool.
Ok, I guess I am few months too late, but I just got around to the
apache updating game now... I think I managed to do it as cleanly as
possible; without of course affecting users who don't know about it.
So here's it, the essence of the change is very-very small; just making
http_main.c detach() not if !one_process, but if !no_detach, and
creating a new '-n' option to do just that, and for a bit more
streamlining, making '-X' set one_process AND this new no_detach
variable. And of course updating all the getopt calls in there, and
updating both the manual page, and the html docs to describe briefly
what '-n' does.
[Just an aside, most programs which can do a no-detach start, usually do
that on '-f', but it's not available. A few more programs use -n (the
Linux klogd/syslogd, and amd IIRC), so I settled for that.]
Janos
Index: htdocs/manual/invoking.html
===
RCS file: /cvs/apache-1.3/htdocs/manual/invoking.html,v
retrieving revision 1.20
diff -u -u -r1.20 invoking.html
--- invoking.html 1998/07/19 21:34:58 1.20
+++ invoking.html 1998/08/31 14:54:10
@@ -59,6 +59,10 @@
daemon does not detach from the terminal or fork any children. Do EMNOT/EM
use this mode to provide ordinary web service.
+DTCODE-n/CODE
+DDRun the daemon without detaching from the terminal, but don't stop
+it from creating child processes.
+
DTCODE-v/CODE
DDPrint the version of httpd and its build date, and then exit.
Index: src/main/http_main.c
===
RCS file: /cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.387
diff -u -u -r1.387 http_main.c
--- http_main.c1998/08/13 01:55:06 1.387
+++ http_main.c1998/08/31 14:54:26
@@ -306,6 +306,12 @@
static int one_process = 0;
+/* nodetach -- don't detach on startup; has no effect on the further work of
+ * the server.
+ */
+
+static int no_detach = 0;
+
/* set if timeouts are to be handled by the children and not by the parent.
* i.e. child_timeouts = !standalone || one_process.
*/
@@ -954,6 +960,7 @@
fprintf(stderr, -f file : specify an alternate
ServerConfigFile\n);
fprintf(stderr, -C \directive\ : process directive before reading
config files\n);
fprintf(stderr, -c \directive\ : process directive after reading
config files\n);
+fprintf(stderr, -n : don't detach from the terminal\n);
fprintf(stderr, -v : show version number\n);
fprintf(stderr, -V : show compile settings\n);
fprintf(stderr, -h : list available configuration
directives\n);
@@ -4100,7 +4107,7 @@
is_graceful = 0;
++generation;
-if (!one_process) {
+if (!no_detach) {
detach();
}
else {
@@ -4349,7 +4356,7 @@
ap_setup_prelinked_modules();
while ((c = getopt(argc, argv,
- D:C:c:Xd:f:vVhlL:St
+ D:C:c:Xnd:f:vVhlL:St
#ifdef DEBUG_SIGSTOP
Z:
#endif
@@ -4391,6 +4398,9 @@
exit(0);
case 'X':
++one_process; /* Weird debugging mode. */
+ /* flow through to no detach */
+ case 'n':
+ ++no_detach;
break;
#ifdef DEBUG_SIGSTOP
case 'Z':
@@ -5516,7 +5526,7 @@
ap_setup_prelinked_modules();
-while ((c = getopt(argc, argv, D:C:c:Xd:f:vVhlZ:iusSt)) != -1) {
+while ((c = getopt(argc, argv, D:C:c:Xnd:f:vVhlZ:iusSt)) != -1) {
char **new;
switch (c) {
case 'c':
@@ -5577,6 +5587,9 @@
exit(0);
case 'X':
++one_process; /* Weird debugging mode. */
+ /* flow through to no detach */
+ case 'n':
+ ++no_detach;
break;
case 't':
configtestonly = 1;
@@ -5707,12 +5720,13 @@
* but only handle the -L option
*/
llp_dir = SHARED_CORE_DIR;
-while ((c = getopt(argc, argv, D:C:c:Xd:f:vVhlL:SZ:t)) != -1) {
+while ((c = getopt(argc, argv, D:C:c:Xnd:f:vVhlL:SZ:t)) != -1) {
switch (c) {
case 'D':
case 'C':
case 'c':
case 'X':
+ case 'n':
case 'd':
case 'f':
case 'v':
Index: src/support/httpd.8
===
RCS file