Return-Path: Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 76981 invoked by uid 500); 23 Mar 2002 08:37:38 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 76837 invoked from network); 23 Mar 2002 08:37:37 -0000 Date: Sat, 23 Mar 2002 00:37:48 -0801 From: Jos Backus To: dev@httpd.apache.org Cc: Michael Handler Subject: Re: daemontools/foreground support in 1.3.* Message-ID: <20020323083810.GA93862@lizzy.bugworks.com> Reply-To: Jos Backus Mail-Followup-To: dev@httpd.apache.org, Michael Handler References: <20020225172644.P14643@monster.grendel.net> <20020225224112.GV5786@ebuilt.com> <20020228040034.R14643@monster.grendel.net> <20020228092935.GC15423@ebuilt.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="dDRMvlgZJXvWKvBx" Content-Disposition: inline In-Reply-To: <20020228092935.GC15423@ebuilt.com> User-Agent: Mutt/1.3.28i X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Feb 28, 2002 at 01:29:35AM -0800, Justin Erenkrantz wrote: > http://www.apache.org/dist/httpd/contrib/patches/1.3/daemontools.patch > > This should give you an "official" place to download it. I > have also added a note in 1.3's STATUS. Btw, the above patch no longer applies cleanly to 1.3.24. Can you please update the patch with the one attached to this message? Thanks! -- Jos Backus _/ _/_/_/ Santa Clara, CA _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ josb@cncdsl.com _/_/ _/_/_/ use Std::Disclaimer; --dDRMvlgZJXvWKvBx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="apache-1.3-daemontools.patch" --- src/main/http_main.c Sat Mar 23 00:26:38 2002 +++ src/main/http_main.c Sat Mar 23 00:30:17 2002 @@ -341,6 +341,8 @@ static int one_process = 0; +static int do_detach = 1; + /* set if timeouts are to be handled by the children and not by the parent. * i.e. child_timeouts = !standalone || one_process. */ @@ -1349,7 +1351,7 @@ #ifdef WIN32 fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file] [-n service]\n", bin); fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"] [-k signal]\n", pad); - fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); + fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T] [-F]\n", pad); #else /* !WIN32 */ #ifdef SHARED_CORE fprintf(stderr, "Usage: %s [-R directory] [-D name] [-d directory] [-f file]\n", bin); @@ -1357,7 +1359,7 @@ fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin); #endif fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad); - fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); + fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T] [-F]\n", pad); fprintf(stderr, "Options:\n"); #ifdef SHARED_CORE fprintf(stderr, " -R directory : specify an alternate location for shared object files\n"); @@ -1380,6 +1382,7 @@ #endif fprintf(stderr, " -t : run syntax check for config files (with docroot check)\n"); fprintf(stderr, " -T : run syntax check for config files (without docroot check)\n"); + fprintf(stderr, " -F : run main process in foreground, for process supervisors\n"); #ifdef WIN32 fprintf(stderr, " -n name : name the Apache service for -k options below;\n"); fprintf(stderr, " -k stop|shutdown : tell running Apache to shutdown\n"); @@ -3370,14 +3373,16 @@ !defined(BONE) /* Don't detach for MPE because child processes can't survive the death of the parent. */ - if ((x = fork()) > 0) - exit(0); - else if (x == -1) { - perror("fork"); - fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); - exit(1); + if (do_detach) { + if ((x = fork()) > 0) + exit(0); + else if (x == -1) { + perror("fork"); + fprintf(stderr, "%s: unable to fork new process\n", ap_server_argv0); + exit(1); + } + RAISE_SIGSTOP(DETACH); } - RAISE_SIGSTOP(DETACH); #endif #ifndef NO_SETSID if ((pgrp = setsid()) == -1) { @@ -5308,7 +5313,7 @@ ap_setup_prelinked_modules(); while ((c = getopt(argc, argv, - "D:C:c:xXd:f:vVlLR:StTh" + "D:C:c:xXd:Ff:vVlLR:StTh" #ifdef DEBUG_SIGSTOP "Z:" #endif @@ -5330,6 +5335,9 @@ case 'd': ap_cpystrn(ap_server_root, optarg, sizeof(ap_server_root)); break; + case 'F': + do_detach = 0; + break; case 'f': ap_cpystrn(ap_server_confname, optarg, sizeof(ap_server_confname)); break; @@ -7211,9 +7219,9 @@ reparsed = 1; } - while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLz:Z:wiuStThk:n:W:")) != -1) { + while ((c = getopt(argc, argv, "D:C:c:Xd:fF:vVlLz:Z:wiuStThk:n:W:")) != -1) { #else /* !WIN32 */ - while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLesStTh")) != -1) { + while ((c = getopt(argc, argv, "D:C:c:Xd:fF:vVlLesStTh")) != -1) { #endif char **new; switch (c) { @@ -7335,6 +7343,9 @@ && ap_server_root[strlen(ap_server_root) - 1] == '/') ap_server_root[strlen(ap_server_root) - 1] = '\0'; break; + case 'F': + do_detach = 0; + break; case 'f': ap_cpystrn(ap_server_confname, ap_os_canonical_filename(pcommands, optarg), @@ -7729,13 +7740,14 @@ * but only handle the -L option */ llp_dir = SHARED_CORE_DIR; - while ((c = getopt(argc, argv, "D:C:c:Xd:f:vVlLR:SZ:tTh")) != -1) { + while ((c = getopt(argc, argv, "D:C:c:Xd:Ff:vVlLR:SZ:tTh")) != -1) { switch (c) { case 'D': case 'C': case 'c': case 'X': case 'd': + case 'F': case 'f': case 'v': case 'V': --dDRMvlgZJXvWKvBx--