diff -ur apache_1.3.12/configure apache_1.3.12-drt/configure --- apache_1.3.12/configure Sat Feb 5 15:28:59 2000 +++ apache_1.3.12-drt/configure Tue Apr 4 16:44:25 2000 @@ -65,6 +65,9 @@ DIFS=' ' +# 000404 drt@ailis.de DAEMONTOOLS Support +CFLAGS="$CFLAGS -DDAEMONTOOLS" + ## ## avoid brain dead shells on Ultrix and friends ## diff -ur apache_1.3.12/src/Configuration apache_1.3.12-drt/src/Configuration --- apache_1.3.12/src/Configuration Thu Feb 24 00:09:35 2000 +++ apache_1.3.12-drt/src/Configuration Tue Apr 4 16:37:23 2000 @@ -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= diff -ur apache_1.3.12/src/include/httpd.h apache_1.3.12-drt/src/include/httpd.h --- apache_1.3.12/src/include/httpd.h Thu Feb 24 00:01:33 2000 +++ apache_1.3.12-drt/src/include/httpd.h Tue Apr 4 17:32:35 2000 @@ -427,7 +427,7 @@ * Example: "Apache/1.1.0 MrWidget/0.1-alpha" */ -#define SERVER_BASEVERSION "Apache/1.3.12" /* SEE COMMENTS ABOVE */ +#define SERVER_BASEVERSION "Apache" /* SEE COMMENTS ABOVE */ #define SERVER_VERSION SERVER_BASEVERSION enum server_token_type { SrvTk_MIN, /* eg: Apache/1.3.0 */ diff -ur apache_1.3.12/src/main/http_log.c apache_1.3.12-drt/src/main/http_log.c --- apache_1.3.12/src/main/http_log.c Wed Feb 2 21:43:49 2000 +++ apache_1.3.12-drt/src/main/http_log.c Tue Apr 4 17:25:08 2000 @@ -190,7 +190,7 @@ static void open_error_log(server_rec *s, pool *p) { char *fname; - +#if !defined(DAEMONTOOLS) if (*s->error_fname == '|') { FILE *dummy; #ifdef TPF @@ -242,6 +242,9 @@ exit(1); } } +#else + s->error_log = stderr; +#endif } void ap_open_logs(server_rec *s_main, pool *p) @@ -249,6 +252,7 @@ server_rec *virt, *q; int replace_stderr; +#if !defined(DAEMONTOOLS) open_error_log(s_main, p); replace_stderr = 1; @@ -270,6 +274,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) @@ -346,11 +351,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); diff -ur apache_1.3.12/src/main/http_main.c apache_1.3.12-drt/src/main/http_main.c --- apache_1.3.12/src/main/http_main.c Sat Feb 5 13:01:52 2000 +++ apache_1.3.12-drt/src/main/http_main.c Tue Apr 4 17:34:06 2000 @@ -123,6 +123,10 @@ #include /* for IRIX, FD_SET calls bzero() */ #endif +#ifdef DAEMONTOOLS +#define NO_SETSID +#endif + #ifdef MULTITHREAD /* special debug stuff -- PCS */ @@ -374,7 +378,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 @@ -384,7 +388,7 @@ static void reset_version(void *dummy) { version_locked = 0; - ap_server_tokens = SrvTk_FULL; + ap_server_tokens = SrvTk_MIN; server_version = NULL; } @@ -3035,7 +3039,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) @@ -3065,6 +3069,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"); @@ -3072,7 +3082,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", @@ -3091,6 +3101,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 */ } @@ -3609,11 +3620,18 @@ static void show_compile_settings(void) { +#ifdef DAEMONTOOLS + printf("Server version: %s + daemontools patches - drt@ailis.de\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