This patch keeps apache from forking into the background. This is essential th have it play nice with Dan Bernsteins daemontools. --drt@un.bewaff.net - http://c0re.jp diff -r -u apache_1.3.20-orig/configure apache_1.3.20/configure --- apache_1.3.20-orig/configure Wed Feb 7 14:07:24 2001 +++ apache_1.3.20/configure Sat Sep 29 00:05:07 2001 @@ -67,6 +67,9 @@ DIFS=' ' +# 000404 drt@ailis.de DAEMONTOOLS Support +CFLAGS="$CFLAGS -DDAEMONTOOLS" + ## ## avoid brain dead shells on Ultrix and friends ## diff -r -u apache_1.3.20-orig/src/Configuration apache_1.3.20/src/Configuration --- apache_1.3.20-orig/src/Configuration Tue May 15 18:38:59 2001 +++ apache_1.3.20/src/Configuration Sat Sep 29 00:05:07 2001 @@ -51,7 +51,7 @@ # files (for instance third-party libraries) for the httpd target. The effect # is that httpd is relinked when those files are changed. # -EXTRA_CFLAGS= +EXTRA_CFLAGS=-DDAEMONTOOLS EXTRA_LDFLAGS= EXTRA_LIBS= EXTRA_INCLUDES= Only in apache_1.3.20/src/include: httpd.h~ diff -r -u apache_1.3.20-orig/src/main/http_log.c apache_1.3.20/src/main/http_log.c --- apache_1.3.20-orig/src/main/http_log.c Mon Jan 15 18:04:59 2001 +++ apache_1.3.20/src/main/http_log.c Sat Sep 29 00:05:07 2001 @@ -197,7 +197,7 @@ static void open_error_log(server_rec *s, pool *p) { char *fname; - +#if !defined(DAEMONTOOLS) if (*s->error_fname == '|') { FILE *dummy; #ifdef TPF @@ -249,6 +249,9 @@ exit(1); } } +#else + s->error_log = stderr; +#endif } void ap_open_logs(server_rec *s_main, pool *p) @@ -264,6 +267,7 @@ setenv("_EDC_ADD_ERRNO2", "1", 1); #endif +#if !defined(DAEMONTOOLS) open_error_log(s_main, p); replace_stderr = 1; @@ -285,6 +289,7 @@ ap_log_error(APLOG_MARK, APLOG_CRIT, s_main, "unable to replace stderr with /dev/null"); } +#endif for (virt = s_main->next; virt; virt = virt->next) { if (virt->error_fname) @@ -361,11 +366,15 @@ logf = NULL; } +#if !defined(DAEMONTOOLS) if (logf) { len = ap_snprintf(errstr, sizeof(errstr), "[%s] ", ap_get_time()); } else { len = 0; } +#else + len = 0; +#endif len += ap_snprintf(errstr + len, sizeof(errstr) - len, "[%s] ", priorities[level & APLOG_LEVELMASK].t_name); Only in apache_1.3.20/src/main: http_log.c~ diff -r -u apache_1.3.20-orig/src/main/http_main.c apache_1.3.20/src/main/http_main.c --- apache_1.3.20-orig/src/main/http_main.c Thu Apr 12 19:49:26 2001 +++ apache_1.3.20/src/main/http_main.c Sat Sep 29 00:24:04 2001 @@ -124,6 +124,10 @@ #include /* for IRIX, FD_SET calls bzero() */ #endif +#ifdef DAEMONTOOLS +#define NO_SETSID +#endif + #ifdef MULTITHREAD /* special debug stuff -- PCS */ @@ -375,7 +379,7 @@ static int version_locked = 0; /* Global, alas, so http_core can talk to us */ -enum server_token_type ap_server_tokens = SrvTk_FULL; +enum server_token_type ap_server_tokens = SrvTk_MIN; /* * This routine is called when the pconf pool is vacuumed. It resets the @@ -385,7 +389,7 @@ static void reset_version(void *dummy) { version_locked = 0; - ap_server_tokens = SrvTk_FULL; + ap_server_tokens = SrvTk_MIN; server_version = NULL; } @@ -3044,7 +3048,7 @@ int x; chdir("/"); -#if !defined(MPE) && !defined(OS2) && !defined(TPF) +#if !defined(MPE) && !defined(OS2) && !defined(TPF) && !defined(DAEMONTOOLS) /* Don't detach for MPE because child processes can't survive the death of the parent. */ if ((x = fork()) > 0) @@ -3074,6 +3078,12 @@ #elif defined(MPE) /* MPE uses negative pid for process group */ pgrp = -getpid(); +#elif defined(LINUX) && defined(DAEMONTOOLS) + if ((pgrp = setpgid(getpid(), 0)) == -1) { + perror("setpgrp"); + fprintf(stderr, "%s: setpgrp failed\n", ap_server_argv0); + exit(1); + } #else if ((pgrp = setpgrp(getpid(), 0)) == -1) { perror("setpgrp"); @@ -3081,7 +3091,7 @@ exit(1); } #endif - +#if !defined(DAEMONTOOLS) /* close out the standard file descriptors */ if (freopen("/dev/null", "r", stdin) == NULL) { fprintf(stderr, "%s: unable to replace stdin with /dev/null: %s\n", @@ -3100,6 +3110,7 @@ * but we haven't opened that yet. So leave it alone for now and it'll * be reopened moments later. */ +#endif #endif /* ndef WIN32 */ } @@ -3643,11 +3654,18 @@ static void show_compile_settings(void) { +#ifdef DAEMONTOOLS + printf("Server version: %s + daemontools patches - http://c0re.jp/\n", ap_get_server_version()); +#else printf("Server version: %s\n", ap_get_server_version()); +#endif printf("Server built: %s\n", ap_get_server_built()); printf("Server's Module Magic Number: %u:%u\n", MODULE_MAGIC_NUMBER_MAJOR, MODULE_MAGIC_NUMBER_MINOR); printf("Server compiled with....\n"); +#ifdef DAEMONTOOLS + printf(" -D DAEMONTOOLS\n"); +#endif #ifdef BIG_SECURITY_HOLE printf(" -D BIG_SECURITY_HOLE\n"); #endif @@ -4928,7 +4946,11 @@ break; case 'v': ap_set_version(); - printf("Server version: %s\n", ap_get_server_version()); +#ifdef DAEMONTOOLS + printf("Server version: %s + daemontools patches - http://c0re.jp/\n", ap_get_server_version()); +#else + printf("Server version: %s\n", ap_get_server_version()); +#endif printf("Server built: %s\n", ap_get_server_built()); exit(0); case 'V': @@ -6871,7 +6893,11 @@ break; case 'v': ap_set_version(); - printf("Server version: %s\n", ap_get_server_version()); +#ifdef DAEMONTOOLS + printf("Server version: %s + daemontools patches - http://c0re.jp/\n", ap_get_server_version()); +#else + printf("Server version: %s\n", ap_get_server_version()); +#endif printf("Server built: %s\n", ap_get_server_built()); #ifdef WIN32 clean_parent_exit(1); Only in apache_1.3.20/src/main: http_main.c~