From 1e1df07282d1c7a98c7ffae7e7e6c6d2a9c7af27 Mon Sep 17 00:00:00 2001 From: Hye-Shik Chang Date: Sun, 21 Jul 2002 02:23:33 +0000 Subject: - Add a small hack for worker MPM [1] (worker MPM with this hack seems to work without visible problems. and still requires -DFORCE_THREADING_MPM to build for worker MPM.) - Fix plist for worker MPM - Comment out fancy modules from default httpd.conf Tested on: ref5.freebsd.org, several 4-stable machines [1] --- www/apache21/Makefile | 13 ++++++-- www/apache21/files/patch-Makefile.in | 16 ++++++++-- www/apache21/files/patch-server:main.c | 36 ++++++++++++++++++++++ .../patch-srclib:apr:threadproc:unix:procsup.c | 18 +++++++++++ www/apache21/pkg-plist | 4 ++- 5 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 www/apache21/files/patch-server:main.c create mode 100644 www/apache21/files/patch-srclib:apr:threadproc:unix:procsup.c (limited to 'www/apache21') diff --git a/www/apache21/Makefile b/www/apache21/Makefile index ce5b5b6ffd6a..873d8affbb1d 100644 --- a/www/apache21/Makefile +++ b/www/apache21/Makefile @@ -73,13 +73,22 @@ PLIST_SUB+= SUEXEC="@comment " PKGNAMESUFFIX= -${WITH_MPM} WITH_THREADS= yes .if !defined(FORCE_THREADING_MPM) -FORBIDDEN= "doesn't work with threading MPMs on FreeBSD. If you are\ - brave enough, make again with FORCE_THREADING_MPM=yes" +FORBIDDEN= "doesn't support threads on FreeBSD, officially. If you are\ + prepared to risk unintended problems, make again with\ + -DFORCE_THREADING_MPM" .endif +.if ${WITH_MPM} == "worker" +PLIST_SUB+= PREFORK="@comment " WORKER="" +.else +PLIST_SUB+= PREFORK="@comment " WORKER="@comment " +.endif +.else +PLIST_SUB+= PREFORK="" WORKER="@comment " .endif .if defined(WITH_THREADS) CONFIGURE_ARGS+= --enable-threads +CFLAGS+= -DFREEBSD_THREAD_HACK .endif .if !defined(WITHOUT_SSL) && exists(/usr/lib/libcrypto.so) diff --git a/www/apache21/files/patch-Makefile.in b/www/apache21/files/patch-Makefile.in index 78a67b909c46..398b43f9a899 100644 --- a/www/apache21/files/patch-Makefile.in +++ b/www/apache21/files/patch-Makefile.in @@ -1,5 +1,5 @@ --- Makefile.in.orig Sat Jun 15 18:41:03 2002 -+++ Makefile.in Tue Jun 18 22:37:19 2002 ++++ Makefile.in Sun Jul 21 03:15:18 2002 @@ -31,12 +31,14 @@ @test -d $(DESTDIR)$(sysconfdir) || $(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir) @cd $(top_srcdir)/docs/conf; \ @@ -17,7 +17,17 @@ ( \ n_lm=`awk 'BEGIN {n=0} /@@LoadModule@@/ {n+=1} END {print n}' < $$i`; \ if test $$n_lm -eq 0 -o "x$(DSO_MODULES)" = "x"; then \ -@@ -104,11 +106,14 @@ +@@ -54,6 +56,9 @@ + if test "x$$j" = "xssl"; then \ + echo ""; \ + fi; \ ++ if [ `echo "$$j" | egrep 'cgid|cache|dav|digest|proxy'` ]; then \ ++ echo -n "#"; \ ++ fi; \ + if test $$j != "^EOL^"; then \ + echo "LoadModule $${j}_module $(rel_libexecdir)/mod_$${j}.so"; \ + fi; \ +@@ -104,11 +109,14 @@ install-htdocs: @echo Installing HTML documents @@ -35,7 +45,7 @@ install-error: @echo Installing error documents -@@ -124,9 +129,10 @@ +@@ -124,9 +132,10 @@ install-cgi: @echo Installing CGIs diff --git a/www/apache21/files/patch-server:main.c b/www/apache21/files/patch-server:main.c new file mode 100644 index 000000000000..d297d4425fdb --- /dev/null +++ b/www/apache21/files/patch-server:main.c @@ -0,0 +1,36 @@ +--- server/main.c.orig Thu Jun 13 04:34:56 2002 ++++ server/main.c Sun Jul 21 08:54:09 2002 +@@ -78,6 +78,11 @@ + #include "ap_mpm.h" + #include "mpm_common.h" + ++#ifdef FREEBSD_THREAD_HACK ++#include ++AP_DECLARE(int) ap_exists_config_define(const char *name); ++#endif ++ + /* WARNING: Win32 binds http_main.c dynamically to the server. Please place + * extern functions and global data in another appropriate module. + * +@@ -558,6 +563,21 @@ + destroy_and_exit_process(process, 1); + } + ++#ifdef FREEBSD_THREAD_HACK ++ { ++ int r; ++ ++ if (! ap_exists_config_define("NO_DETACH")) { ++ if ((r = fork()) > 0) ++ return 0; ++ if (r == -1) { ++ perror("fork"); ++ return 0; ++ } ++ setsid(); ++ } ++ } ++#endif + ap_process_config_tree(server_conf, ap_conftree, process->pconf, ptemp); + ap_fixup_virtual_hosts(pconf, server_conf); + ap_fini_vhost_config(pconf, server_conf); diff --git a/www/apache21/files/patch-srclib:apr:threadproc:unix:procsup.c b/www/apache21/files/patch-srclib:apr:threadproc:unix:procsup.c new file mode 100644 index 000000000000..13c663af7bd4 --- /dev/null +++ b/www/apache21/files/patch-srclib:apr:threadproc:unix:procsup.c @@ -0,0 +1,18 @@ +--- srclib/apr/threadproc/unix/procsup.c.orig Mon Apr 8 22:08:18 2002 ++++ srclib/apr/threadproc/unix/procsup.c Sun Jul 21 08:45:44 2002 +@@ -59,6 +59,7 @@ + int x; + + chdir("/"); ++#ifndef FREEBSD_THREAD_HACK + #if !defined(MPE) && !defined(OS2) && !defined(TPF) && !defined(BEOS) + /* Don't detach for MPE because child processes can't survive the death of + * the parent. */ +@@ -89,6 +90,7 @@ + if (setpgid(0, 0) == -1) { + return errno; + } ++#endif + #endif + + /* close out the standard file descriptors */ diff --git a/www/apache21/pkg-plist b/www/apache21/pkg-plist index d9b0fba27484..8371eabc37f2 100644 --- a/www/apache21/pkg-plist +++ b/www/apache21/pkg-plist @@ -78,6 +78,7 @@ include/apache2/apr_xlate.h include/apache2/apr_xml.h include/apache2/apu.h include/apache2/apu_compat.h +%%WORKER%%include/apache2/fdqueue.h include/apache2/http_config.h include/apache2/http_connection.h include/apache2/http_core.h @@ -100,6 +101,7 @@ include/apache2/mpm_default.h include/apache2/os.h include/apache2/pcre.h include/apache2/pcreposix.h +%%WORKER%%include/apache2/pod.h include/apache2/rfc1413.h include/apache2/scoreboard.h include/apache2/ssl_expr.h @@ -145,7 +147,7 @@ libexec/apache2/mod_autoindex.so %%EXPERIMENTAL%%libexec/apache2/mod_case_filter.so %%EXPERIMENTAL%%libexec/apache2/mod_case_filter_in.so libexec/apache2/mod_cern_meta.so -libexec/apache2/mod_cgi.so +%%PREFORK%%libexec/apache2/mod_cgi.so libexec/apache2/mod_cgid.so %%EXPERIMENTAL%%libexec/apache2/mod_charset_lite.so libexec/apache2/mod_dav.so -- cgit v1.2.3