diff options
author | Clement Laforet <clement@FreeBSD.org> | 2008-09-02 12:26:37 +0000 |
---|---|---|
committer | Clement Laforet <clement@FreeBSD.org> | 2008-09-02 12:26:37 +0000 |
commit | 9ec0a777374b41804514a663b89f3dc32f56afb2 (patch) | |
tree | 32c32d1b974c5df6d34a18589b398d1f01648023 /www/apache22 | |
parent | 00c35ec8abe4dac47b45cdba53cd875e7413b39d (diff) | |
download | ports-9ec0a777374b41804514a663b89f3dc32f56afb2.tar.gz ports-9ec0a777374b41804514a663b89f3dc32f56afb2.zip |
Notes
Diffstat (limited to 'www/apache22')
-rw-r--r-- | www/apache22/Makefile | 2 | ||||
-rw-r--r-- | www/apache22/Makefile.modules | 3 | ||||
-rw-r--r-- | www/apache22/files/mpm-itk-20080727-00 (renamed from www/apache22/files/patch-mpm-itk-20070425-00) | 290 |
3 files changed, 160 insertions, 135 deletions
diff --git a/www/apache22/Makefile b/www/apache22/Makefile index e3d1025083cb..b4ed076b415a 100644 --- a/www/apache22/Makefile +++ b/www/apache22/Makefile @@ -45,6 +45,8 @@ USE_RC_SUBR= apache22.sh htcacheclean.sh SUB_LIST+= RC_SUBR_SUFFIX=${RC_SUBR_SUFFIX} LIBTOOLFILES= configure +MPM_ITK_VERSION?= 20080727-00 + # for slave ports .if !defined(MASTERDIR) APACHEDIR= ${.CURDIR} diff --git a/www/apache22/Makefile.modules b/www/apache22/Makefile.modules index 6e120e11944e..d205db60b966 100644 --- a/www/apache22/Makefile.modules +++ b/www/apache22/Makefile.modules @@ -48,7 +48,7 @@ ALL_MODULES_CATEGORIES= AUTH AUTHN AUTHZ CACHE DAV EXPERIMENTAL LDAP \ # MPM section: # << TO BE WRITTEN >> .if defined (SLAVE_PORT_MPM) -PLIST_SUB+= PREFORK="@comment " WORKER="@comment " +PLIST_SUB+= PREFORK="@comment " WORKER="@comment " EVENT="@comment " PKGNAMESUFFIX= -${SLAVE_PORT_MPM} .else . if ${WITH_MPM} != "prefork" @@ -64,6 +64,7 @@ PLIST_SUB+= PREFORK="@comment " WORKER="" EVENT="@comment " PLIST_SUB+= PREFORK="@comment " WORKER="@comment " EVENT="" . elif ${WITH_MPM:L} == "itk" PLIST_SUB+= PREFORK="@comment " WORKER="@comment " EVENT="@comment " +EXTRA_PATCHES+= ${PATCHDIR}/mpm-itk-${MPM_ITK_VERSION} . else IGNORE= "Unknown MPM: ${WITH_MPM}" . endif diff --git a/www/apache22/files/patch-mpm-itk-20070425-00 b/www/apache22/files/mpm-itk-20080727-00 index 669a5c99ee1f..a0288a159de3 100644 --- a/www/apache22/files/patch-mpm-itk-20070425-00 +++ b/www/apache22/files/mpm-itk-20080727-00 @@ -1,47 +1,23 @@ -diff -Nur server/mpm/config.m4 server/mpm/config.m4 ---- server/mpm/config.m4 2005-10-30 18:05:26.000000000 +0100 -+++ server/mpm/config.m4 2007-04-25 14:23:35.000000000 +0200 -@@ -1,7 +1,7 @@ - AC_MSG_CHECKING(which MPM to use) - AC_ARG_WITH(mpm, - APACHE_HELP_STRING(--with-mpm=MPM,Choose the process model for Apache to use. -- MPM={beos|event|worker|prefork|mpmt_os2}),[ -+ MPM={beos|event|worker|prefork|mpmt_os2|itk}),[ - APACHE_MPM=$withval - ],[ - if test "x$APACHE_MPM" = "x"; then -@@ -23,7 +23,7 @@ - - ap_mpm_is_experimental () - { -- if test "$apache_cv_mpm" = "event" ; then -+ if test "$apache_cv_mpm" = "event" -o "$apache_cv_mpm" = "itk" ; then - return 0 - else - return 1 -@@ -66,6 +66,11 @@ - else - MPM_SUBDIR_NAME=$MPM_NAME - fi +unchanged: +--- server/mpm/experimental/itk/Makefile.in ++++ server/mpm/experimental/itk/Makefile.in +@@ -0,0 +1,5 @@ + -+if "$apache_cv_mpm" = "itk" ; then -+ AC_CHECK_LIB(cap, cap_init) -+fi ++LTLIBRARY_NAME = libitk.la ++LTLIBRARY_SOURCES = itk.c + - MPM_DIR=server/mpm/$MPM_SUBDIR_NAME - MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la - -diff -Nur server/mpm/experimental/itk/config.m4 server/mpm/experimental/itk/config.m4 ---- server/mpm/experimental/itk/config.m4 1970-01-01 01:00:00.000000000 +0100 -+++ server/mpm/experimental/itk/config.m4 2007-04-25 14:23:35.000000000 +0200 ++include $(top_srcdir)/build/ltlib.mk +unchanged: +--- server/mpm/experimental/itk/config.m4 ++++ server/mpm/experimental/itk/config.m4 2007-01-29 21:03:57.000000000 +0100 @@ -0,0 +1,3 @@ +if test "$MPM_NAME" = "itk" ; then + APACHE_FAST_OUTPUT(server/mpm/$MPM_SUBDIR_NAME/Makefile) +fi -diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c ---- server/mpm/experimental/itk/itk.c 1970-01-01 01:00:00.000000000 +0100 -+++ server/mpm/experimental/itk/itk.c 2007-04-25 14:23:35.000000000 +0200 -@@ -0,0 +1,1682 @@ +diff -u server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c +--- server/mpm/experimental/itk/itk.c ++++ server/mpm/experimental/itk/itk.c +@@ -0,0 +1,1704 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. @@ -196,6 +172,8 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c +#endif /* TPF */ + +static volatile int die_now = 0; ++static volatile int listeners_closed = 0; ++static int active_connection = 0; + +typedef struct +{ @@ -398,7 +376,10 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + +static void stop_listening(int sig) +{ -+ ap_close_listeners(); ++ if (active_connection) { ++ ap_close_listeners(); ++ listeners_closed = 1; ++ } + + /* For a graceful stop, we want the child to exit when done */ + die_now = 1; @@ -659,6 +640,11 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + apr_int32_t numdesc; + const apr_pollfd_t *pdesc; + ++ if (die_now) { ++ status = !APR_SUCCESS; ++ goto unlock; ++ } ++ + /* timeout == -1 == wait forever */ + status = apr_pollset_poll(pollset, -1, &numdesc, &pdesc); + if (status != APR_SUCCESS) { @@ -707,8 +693,14 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + /* if we accept() something we don't want to die, so we have to + * defer the exit + */ -+ status = lr->accept_func(&csd, lr, ptrans); ++ if (!die_now) { ++ status = lr->accept_func(&csd, lr, ptrans); ++ } ++ else { ++ status = !APR_SUCCESS; ++ } + ++ unlock: + SAFE_ACCEPT(accept_mutex_off()); /* unlock after "accept" */ + + if (status == APR_EGENERAL) { @@ -723,6 +715,13 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + * We now have a connection, so set it up with the appropriate + * socket options, file descriptors, and read/write buffers. + */ ++ ++ active_connection = 1; ++ if (die_now && !listeners_closed) { ++ ap_close_listeners(); ++ listeners_closed = 1; ++ } ++ + { + pid_t pid = fork(); + int status; @@ -731,7 +730,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + ap_log_error(APLOG_MARK, APLOG_ERR, errno, NULL, "fork: Unable to fork new process"); + break; + case 0: /* child */ -+ apr_proc_mutex_child_init(&accept_mutex, ap_lock_fname, pchild); ++ apr_proc_mutex_child_init(&accept_mutex, ap_lock_fname, pchild); + current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd, my_child_num, sbh, bucket_alloc); + if (current_conn) { + ap_process_connection(current_conn, csd); @@ -752,6 +751,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + break; + } + } ++ active_connection = 0; + + /* Check the pod and the generation number after processing a + * connection so that we'll go away if a graceful restart occurred @@ -1100,7 +1100,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + + ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, + "%s configured -- resuming normal operations", -+ ap_get_server_version()); ++ ap_get_server_description()); + ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf, + "Server built: %s", ap_get_server_built()); +#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH @@ -1243,7 +1243,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + for (index = 0; index < ap_daemons_limit; ++index) { + if (ap_scoreboard_image->servers[index][0].status != SERVER_DEAD) { + /* Ask each child to close its listeners. */ -+ kill(MPM_CHILD_PID(index), AP_SIG_GRACEFUL); ++ ap_mpm_safe_kill(MPM_CHILD_PID(index), AP_SIG_GRACEFUL); + active_children++; + } + } @@ -1281,12 +1281,10 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + + active_children = 0; + for (index = 0; index < ap_daemons_limit; ++index) { -+ if (MPM_CHILD_PID(index) != 0) { -+ if (kill(MPM_CHILD_PID(index), 0) == 0) { -+ active_children = 1; -+ /* Having just one child is enough to stay around */ -+ break; -+ } ++ if (ap_mpm_safe_kill(MPM_CHILD_PID(index), 0) == APR_SUCCESS) { ++ active_children = 1; ++ /* Having just one child is enough to stay around */ ++ break; + } + } + } while (!shutdown_pending && active_children && @@ -1338,7 +1336,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + * piped loggers, etc. They almost certainly won't handle + * it gracefully. + */ -+ kill(ap_scoreboard_image->parent[index].pid, AP_SIG_GRACEFUL); ++ ap_mpm_safe_kill(ap_scoreboard_image->parent[index].pid, AP_SIG_GRACEFUL); + } + } + } @@ -1465,7 +1463,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + + strncpy(ap_scoreboard_image->servers[my_child_num][0].vhost, r->server->server_hostname, 31); + ap_scoreboard_image->servers[my_child_num][0].vhost[31] = 0; -+ ++ + if (setpriority(PRIO_PROCESS, 0, sconf->nice_value)) { + _DBG("setpriority(): %s", strerror(errno)); + err = 1; @@ -1480,7 +1478,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + wanted_gid = unixd_config.group_id; + wanted_username = unixd_config.user_name; + } -+ ++ + if (!err && wanted_uid != -1 && wanted_gid != -1 && (getuid() != wanted_uid || getgid() != wanted_gid)) { + if (setgid(wanted_gid)) { + _DBG("setgid(): %s", strerror(errno)); @@ -1640,7 +1638,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + return NULL; +} + -+static const char *assign_user_id (cmd_parms *cmd, void *dummy, const char *user_name, const char *group_name) ++static const char *assign_user_id (cmd_parms *cmd, void *dummy, const char *user_name, const char *group_name) +{ + itk_server_conf *sconf = + (itk_server_conf *) ap_get_module_config(cmd->server->module_config, &mpm_itk_module); @@ -1648,7 +1646,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + sconf->uid = ap_uname2id(user_name); + sconf->gid = ap_gname2id(group_name); + return NULL; -+} ++} + +static const char *set_max_clients_vhost (cmd_parms *cmd, void *dummy, const char *arg) +{ @@ -1658,7 +1656,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + return NULL; +} + -+static const char *set_nice_value (cmd_parms *cmd, void *dummy, const char *arg) ++static const char *set_nice_value (cmd_parms *cmd, void *dummy, const char *arg) +{ + itk_server_conf *sconf = + (itk_server_conf *) ap_get_module_config(cmd->server->module_config, &mpm_itk_module); @@ -1669,7 +1667,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + "WARNING: NiceValue of %d is below -20, increasing NiceValue to -20.", + nice_value); + nice_value = -20; -+ } ++ } + else if (nice_value > 19) { + ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, + "WARNING: NiceValue of %d is above 19, lowering NiceValue to 19.", @@ -1678,7 +1676,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + } + sconf->nice_value = nice_value; + return NULL; -+} ++} + +static const command_rec itk_cmds[] = { +UNIX_DAEMON_COMMANDS, @@ -1724,18 +1722,78 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c + itk_cmds, /* command apr_table_t */ + itk_hooks, /* register hooks */ +}; -diff -Nur server/mpm/experimental/itk/Makefile.in server/mpm/experimental/itk/Makefile.in ---- server/mpm/experimental/itk/Makefile.in 1970-01-01 01:00:00.000000000 +0100 -+++ server/mpm/experimental/itk/Makefile.in 2007-04-25 14:23:35.000000000 +0200 -@@ -0,0 +1,5 @@ +unchanged: +--- server/mpm/experimental/itk/mpm.h ++++ server/mpm/experimental/itk/mpm.h 2007-01-29 21:22:33.000000000 +0100 +@@ -0,0 +1,65 @@ ++/* Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ * ++ * Portions copyright 2005-2007 Steinar H. Gunderson <sgunderson@bigfoot.com>. ++ * Licensed under the same terms as the rest of Apache. ++ */ + -+LTLIBRARY_NAME = libitk.la -+LTLIBRARY_SOURCES = itk.c ++/** ++ * @file itk/mpm.h ++ * @brief ITK MPM (setuid per-vhost, no threads) ++ * ++ * @defgroup APACHE_MPM_ITK Apache ITK ++ * @ingroup APACHE_MPM APACHE_OS_UNIX ++ * @{ ++ */ + -+include $(top_srcdir)/build/ltlib.mk -diff -Nur server/mpm/experimental/itk/mpm_default.h server/mpm/experimental/itk/mpm_default.h ---- server/mpm/experimental/itk/mpm_default.h 1970-01-01 01:00:00.000000000 +0100 -+++ server/mpm/experimental/itk/mpm_default.h 2007-04-25 14:23:35.000000000 +0200 ++#include "httpd.h" ++#include "mpm_default.h" ++#include "scoreboard.h" ++#include "unixd.h" ++ ++#ifndef APACHE_MPM_ITK_H ++#define APACHE_MPM_ITK_H ++ ++#define ITK_MPM ++ ++#define MPM_NAME "ITK" ++ ++#define AP_MPM_WANT_RECLAIM_CHILD_PROCESSES ++#define AP_MPM_WANT_WAIT_OR_TIMEOUT ++#define AP_MPM_WANT_PROCESS_CHILD_STATUS ++#define AP_MPM_WANT_SET_PIDFILE ++#define AP_MPM_WANT_SET_SCOREBOARD ++#define AP_MPM_WANT_SET_LOCKFILE ++#define AP_MPM_WANT_SET_MAX_REQUESTS ++#define AP_MPM_WANT_SET_COREDUMPDIR ++#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH ++#define AP_MPM_WANT_SIGNAL_SERVER ++#define AP_MPM_WANT_SET_MAX_MEM_FREE ++#define AP_MPM_WANT_FATAL_SIGNAL_HANDLER ++#define AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN ++#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK ++ ++#define AP_MPM_USES_POD 1 ++#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) ++#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) ++#define MPM_ACCEPT_FUNC unixd_accept ++ ++extern int ap_threads_per_child; ++extern int ap_max_daemons_limit; ++extern server_rec *ap_server_conf; ++#endif /* APACHE_MPM_ITK_H */ ++/** @} */ +unchanged: +--- server/mpm/experimental/itk/mpm_default.h ++++ server/mpm/experimental/itk/mpm_default.h 2007-01-29 21:22:09.000000000 +0100 @@ -0,0 +1,77 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with @@ -1814,72 +1872,36 @@ diff -Nur server/mpm/experimental/itk/mpm_default.h server/mpm/experimental/itk/ + +#endif /* AP_MPM_DEFAULT_H */ +/** @} */ -diff -Nur server/mpm/experimental/itk/mpm.h server/mpm/experimental/itk/mpm.h ---- server/mpm/experimental/itk/mpm.h 1970-01-01 01:00:00.000000000 +0100 -+++ server/mpm/experimental/itk/mpm.h 2007-04-25 14:23:35.000000000 +0200 -@@ -0,0 +1,65 @@ -+/* Licensed to the Apache Software Foundation (ASF) under one or more -+ * contributor license agreements. See the NOTICE file distributed with -+ * this work for additional information regarding copyright ownership. -+ * The ASF licenses this file to You under the Apache License, Version 2.0 -+ * (the "License"); you may not use this file except in compliance with -+ * the License. You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ * -+ * Portions copyright 2005-2007 Steinar H. Gunderson <sgunderson@bigfoot.com>. -+ * Licensed under the same terms as the rest of Apache. -+ */ -+ -+/** -+ * @file itk/mpm.h -+ * @brief ITK MPM (setuid per-vhost, no threads) -+ * -+ * @defgroup APACHE_MPM_ITK Apache ITK -+ * @ingroup APACHE_MPM APACHE_OS_UNIX -+ * @{ -+ */ -+ -+#include "httpd.h" -+#include "mpm_default.h" -+#include "scoreboard.h" -+#include "unixd.h" -+ -+#ifndef APACHE_MPM_ITK_H -+#define APACHE_MPM_ITK_H -+ -+#define ITK_MPM -+ -+#define MPM_NAME "ITK" -+ -+#define AP_MPM_WANT_RECLAIM_CHILD_PROCESSES -+#define AP_MPM_WANT_WAIT_OR_TIMEOUT -+#define AP_MPM_WANT_PROCESS_CHILD_STATUS -+#define AP_MPM_WANT_SET_PIDFILE -+#define AP_MPM_WANT_SET_SCOREBOARD -+#define AP_MPM_WANT_SET_LOCKFILE -+#define AP_MPM_WANT_SET_MAX_REQUESTS -+#define AP_MPM_WANT_SET_COREDUMPDIR -+#define AP_MPM_WANT_SET_ACCEPT_LOCK_MECH -+#define AP_MPM_WANT_SIGNAL_SERVER -+#define AP_MPM_WANT_SET_MAX_MEM_FREE -+#define AP_MPM_WANT_FATAL_SIGNAL_HANDLER -+#define AP_MPM_WANT_SET_GRACEFUL_SHUTDOWN -+#define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK +unchanged: +--- server/mpm/config.m4 2007-01-29 21:30:35.000000000 +0100 ++++ server/mpm/config.m4 +@@ -1,7 +1,7 @@ + AC_MSG_CHECKING(which MPM to use) + AC_ARG_WITH(mpm, + APACHE_HELP_STRING(--with-mpm=MPM,Choose the process model for Apache to use. +- MPM={beos|event|worker|prefork|mpmt_os2}),[ ++ MPM={beos|event|worker|prefork|mpmt_os2|itk}),[ + APACHE_MPM=$withval + ],[ + if test "x$APACHE_MPM" = "x"; then +@@ -23,7 +23,7 @@ + + ap_mpm_is_experimental () + { +- if test "$apache_cv_mpm" = "event" ; then ++ if test "$apache_cv_mpm" = "event" -o "$apache_cv_mpm" = "itk" ; then + return 0 + else + return 1 +@@ -66,6 +66,11 @@ + else + MPM_SUBDIR_NAME=$MPM_NAME + fi + -+#define AP_MPM_USES_POD 1 -+#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) -+#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) -+#define MPM_ACCEPT_FUNC unixd_accept ++if test "$apache_cv_mpm" = "itk" ; then ++ AC_CHECK_LIB(cap, cap_init) ++fi + -+extern int ap_threads_per_child; -+extern int ap_max_daemons_limit; -+extern server_rec *ap_server_conf; -+#endif /* APACHE_MPM_ITK_H */ -+/** @} */ + MPM_DIR=server/mpm/$MPM_SUBDIR_NAME + MPM_LIB=$MPM_DIR/lib${MPM_NAME}.la + |