summaryrefslogtreecommitdiff
path: root/www/apache22
diff options
context:
space:
mode:
authorClement Laforet <clement@FreeBSD.org>2007-09-10 19:15:48 +0000
committerClement Laforet <clement@FreeBSD.org>2007-09-10 19:15:48 +0000
commit002890da3339ea1dc4d0e78bed5542d912234b5c (patch)
tree0df908805b7a6b46f6f34d15341410e38c9a4958 /www/apache22
parent- Fix build with gcc42 (diff)
\
- Cleanup MPM selection - Update mpm itk to 20070425-00
Notes
Notes: svn path=/head/; revision=199300
Diffstat (limited to 'www/apache22')
-rw-r--r--www/apache22/Makefile2
-rw-r--r--www/apache22/Makefile.modules12
-rw-r--r--www/apache22/files/patch-mpm-itk-20070425-00 (renamed from www/apache22/files/patch-mpm-itk-20061030-01)253
-rw-r--r--www/apache22/pkg-plist1
4 files changed, 149 insertions, 119 deletions
diff --git a/www/apache22/Makefile b/www/apache22/Makefile
index a6472bba2c72..e065a53979f5 100644
--- a/www/apache22/Makefile
+++ b/www/apache22/Makefile
@@ -74,7 +74,7 @@ PREFIX_RELDEST= ${PREFIX:S,^${DESTDIR},,}
MAKE_ENV+= EXPR_COMPAT=yes
-WITH_MPM?= prefork # or worker, perchild, event, itk
+WITH_MPM?= prefork # or worker, event, itk
WITH_HTTP_PORT?= 80
diff --git a/www/apache22/Makefile.modules b/www/apache22/Makefile.modules
index fb8f1965ed89..8258b5ec3436 100644
--- a/www/apache22/Makefile.modules
+++ b/www/apache22/Makefile.modules
@@ -26,15 +26,11 @@ WITH_THREADS_MODULES= yes
WITHOUT_MODULES+= cgi
. endif
. if ${WITH_MPM:L} == "worker"
-PLIST_SUB+= PREFORK="@comment " WORKER="" THREADPOOL="@comment " EVENT="@comment "
-. elif ${WITH_MPM:L} == "perchild"
-PLIST_SUB+= PREFORK="@comment " WORKER="@comment " THREADPOOL="@comment " EVENT="@comment "
-. elif ${WITH_MPM:L} == "threadpool"
-PLIST_SUB+= PREFORK="@comment " WORKER="@comment " THREADPOOL="" EVENT="@comment "
+PLIST_SUB+= PREFORK="@comment " WORKER="" EVENT="@comment "
. elif ${WITH_MPM:L} == "event"
-PLIST_SUB+= PREFORK="@comment " WORKER="@comment " THREADPOOL="@comment " EVENT=""
+PLIST_SUB+= PREFORK="@comment " WORKER="@comment " EVENT=""
. elif ${WITH_MPM:L} == "itk"
-PLIST_SUB+= PREFORK="@comment " WORKER="@comment " THREADPOOL="@comment " EVENT="@comment "
+PLIST_SUB+= PREFORK="@comment " WORKER="@comment " EVENT="@comment "
. else
IGNORE= "Unknown MPM: ${WITH_MPM}"
. endif
@@ -42,7 +38,7 @@ IGNORE= "Unknown MPM: ${WITH_MPM}"
PLIST_SUB+= PREFORK="@comment " WORKER="@comment " THREADPOOL="@comment " EVENT="@comment "
. endif
.else
-PLIST_SUB+= PREFORK="@comment " WORKER="@comment " THREADPOOL="@comment " EVENT="@comment "
+PLIST_SUB+= PREFORK="@comment " WORKER="@comment " EVENT="@comment "
.endif
# xDBM section
diff --git a/www/apache22/files/patch-mpm-itk-20061030-01 b/www/apache22/files/patch-mpm-itk-20070425-00
index 07a02869e3e1..669a5c99ee1f 100644
--- a/www/apache22/files/patch-mpm-itk-20061030-01
+++ b/www/apache22/files/patch-mpm-itk-20070425-00
@@ -1,6 +1,6 @@
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 2006-10-30 12:32:44.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,
@@ -19,35 +19,29 @@ diff -Nur server/mpm/config.m4 server/mpm/config.m4
return 0
else
return 1
-@@ -63,6 +63,8 @@
- if ap_mpm_is_experimental; then
- AC_MSG_WARN(You have selected an EXPERIMENTAL MPM. Be warned!)
- MPM_SUBDIR_NAME=experimental/$MPM_NAME
-+
-+ AC_CHECK_LIB(cap, cap_init)
+@@ -66,6 +66,11 @@
else
MPM_SUBDIR_NAME=$MPM_NAME
fi
-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 2006-10-30 12:32:44.000000000 +0100
-@@ -0,0 +1,5 @@
+
-+LTLIBRARY_NAME = libitk.la
-+LTLIBRARY_SOURCES = itk.c
++if "$apache_cv_mpm" = "itk" ; then
++ AC_CHECK_LIB(cap, cap_init)
++fi
+
-+include $(top_srcdir)/build/ltlib.mk
+ 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 2006-10-30 12:32:44.000000000 +0100
++++ server/mpm/experimental/itk/config.m4 2007-04-25 14:23:35.000000000 +0200
@@ -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 2006-10-30 12:48:20.000000000 +0100
-@@ -0,0 +1,1650 @@
++++ server/mpm/experimental/itk/itk.c 2007-04-25 14:23:35.000000000 +0200
+@@ -0,0 +1,1682 @@
+/* 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.
@@ -62,8 +56,8 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ * 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-2006 Steinar H. Gunderson <sgunderson@bigfoot.com>.
++ *
++ * Portions copyright 2005-2007 Steinar H. Gunderson <sgunderson@bigfoot.com>.
+ * Licensed under the same terms as the rest of Apache.
+ */
+
@@ -209,6 +203,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ gid_t gid;
+ char *username;
+ int max_clients_vhost;
++ int nice_value;
+} itk_server_conf;
+
+module AP_MODULE_DECLARE_DATA mpm_itk_module;
@@ -546,16 +541,17 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ apr_pollset_t *pollset;
+ ap_sb_handle_t *sbh;
+ apr_bucket_alloc_t *bucket_alloc;
++ int last_poll_idx = 0;
++
+#if HAVE_LIBCAP
+ cap_t caps;
+ cap_value_t suidcaps[] = {
+ CAP_SETUID,
-+ CAP_SETGID
++ CAP_SETGID,
++ CAP_SYS_NICE
+ };
+#endif
+
-+ int last_poll_idx = 0;
-+
+ mpm_state = AP_MPMQ_STARTING; /* for benefit of any hooks that run as this
+ * child initializes
+ */
@@ -735,7 +731,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);
@@ -1445,6 +1441,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ uid_t wanted_uid;
+ gid_t wanted_gid;
+ const char *wanted_username;
++ int err = 0;
+
+ itk_server_conf *sconf =
+ (itk_server_conf *) ap_get_module_config(r->server->module_config, &mpm_itk_module);
@@ -1468,6 +1465,11 @@ 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;
++ }
+
+ wanted_uid = sconf->uid;
+ wanted_gid = sconf->gid;
@@ -1479,8 +1481,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ wanted_username = unixd_config.user_name;
+ }
+
-+ if (wanted_uid != -1 && wanted_gid != -1 && (getuid() != wanted_uid || getgid() != wanted_gid)) {
-+ int err = 0;
++ if (!err && wanted_uid != -1 && wanted_gid != -1 && (getuid() != wanted_uid || getgid() != wanted_gid)) {
+ if (setgid(wanted_gid)) {
+ _DBG("setgid(): %s", strerror(errno));
+ err = 1;
@@ -1491,18 +1492,18 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ _DBG("setuid(): %s", strerror(errno));
+ err = 1;
+ }
++ }
+
-+ /*
-+ * Most likely a case of switching uid/gid within a persistent
-+ * connection; the RFCs allow us to just close the connection
-+ * at anytime, so we excercise our right. :-)
-+ */
-+ if (err) {
-+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, \
-+ "Couldn't set uid/gid, closing connection.");
-+ ap_lingering_close(r->connection);
-+ exit(0);
-+ }
++ /*
++ * Most likely a case of switching uid/gid within a persistent
++ * connection; the RFCs allow us to just close the connection
++ * at anytime, so we excercise our right. :-)
++ */
++ if (err) {
++ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, \
++ "Couldn't set uid/gid/priority, closing connection.");
++ ap_lingering_close(r->connection);
++ exit(0);
+ }
+ return OK;
+}
@@ -1657,6 +1658,28 @@ 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)
++{
++ itk_server_conf *sconf =
++ (itk_server_conf *) ap_get_module_config(cmd->server->module_config, &mpm_itk_module);
++ int nice_value = atoi(arg);
++
++ if (nice_value < -20) {
++ ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
++ "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.",
++ nice_value);
++ nice_value = 19;
++ }
++ sconf->nice_value = nice_value;
++ return NULL;
++}
++
+static const command_rec itk_cmds[] = {
+UNIX_DAEMON_COMMANDS,
+LISTEN_COMMANDS,
@@ -1674,6 +1697,8 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ "Tie a virtual host to a specific child process."),
+AP_INIT_TAKE1("MaxClientsVHost", set_max_clients_vhost, NULL, RSRC_CONF,
+ "Maximum number of children alive at the same time for this virtual host."),
++AP_INIT_TAKE1("NiceValue", set_nice_value, NULL, RSRC_CONF,
++ "Set nice value for the given vhost, from -20 (highest priority) to 19 (lowest priority)."),
+AP_GRACEFUL_SHUTDOWN_TIMEOUT_COMMAND,
+{ NULL }
+};
@@ -1685,6 +1710,7 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ apr_pcalloc(p, sizeof(itk_server_conf));
+ c->uid = c->gid = -1;
+ c->max_clients_vhost = -1;
++ c->nice_value = 0;
+ return c;
+}
+
@@ -1695,81 +1721,21 @@ diff -Nur server/mpm/experimental/itk/itk.c server/mpm/experimental/itk/itk.c
+ NULL, /* merge per-directory config structures */
+ itk_create_config, /* create per-server config structure */
+ NULL, /* merge per-server config structures */
-+ itk_cmds, /* command apr_table_t */
-+ itk_hooks, /* register hooks */
++ itk_cmds, /* command apr_table_t */
++ itk_hooks, /* register hooks */
+};
-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 2006-10-30 12:32:44.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-2006 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
+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 @@
+
-+#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
++LTLIBRARY_NAME = libitk.la
++LTLIBRARY_SOURCES = itk.c
+
-+extern int ap_threads_per_child;
-+extern int ap_max_daemons_limit;
-+extern server_rec *ap_server_conf;
-+#endif /* APACHE_MPM_ITK_H */
-+/** @} */
++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 2006-10-30 12:32:44.000000000 +0100
++++ server/mpm/experimental/itk/mpm_default.h 2007-04-25 14:23:35.000000000 +0200
@@ -0,0 +1,77 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
@@ -1785,14 +1751,14 @@ diff -Nur server/mpm/experimental/itk/mpm_default.h server/mpm/experimental/itk/
+ * 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-2006 Steinar H. Gunderson <sgunderson@bigfoot.com>.
++ *
++ * Portions copyright 2005-2007 Steinar H. Gunderson <sgunderson@bigfoot.com>.
+ * Licensed under the same terms as the rest of Apache.
+ */
+
+/**
+ * @file itk/mpm_default.h
-+ * @brief Prefork MPM defaults
++ * @brief ITK MPM defaults
+ *
+ * @addtogroup APACHE_MPM_ITK
+ * @{
@@ -1848,3 +1814,72 @@ 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
++
++#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 */
++/** @} */
diff --git a/www/apache22/pkg-plist b/www/apache22/pkg-plist
index cce925cee69b..1361d528ea74 100644
--- a/www/apache22/pkg-plist
+++ b/www/apache22/pkg-plist
@@ -123,7 +123,6 @@ include/apache22/ap_release.h
%%EVENT%%include/apache22/pod.h
%%EVENT%%include/apache22/fdqueue.h
%%WORKER%%include/apache22/fdqueue.h
-%%THREADPOOL%%include/apache22/pod.h
include/apache22/http_config.h
include/apache22/http_connection.h
include/apache22/http_core.h