packages: apache/apache.spec, apache/apache-mpm-itk.patch (NEW) - added ITK...
baggins
baggins at pld-linux.org
Thu Mar 10 11:41:08 CET 2011
Author: baggins Date: Thu Mar 10 10:41:08 2011 GMT
Module: packages Tag: HEAD
---- Log message:
- added ITK MPM
---- Files affected:
packages/apache:
apache.spec (1.615 -> 1.616) , apache-mpm-itk.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/apache/apache.spec
diff -u packages/apache/apache.spec:1.615 packages/apache/apache.spec:1.616
--- packages/apache/apache.spec:1.615 Sun Feb 13 19:53:04 2011
+++ packages/apache/apache.spec Thu Mar 10 11:41:03 2011
@@ -20,6 +20,7 @@
%bcond_without ldap # build without LDAP support
%bcond_without peruser # peruser MPM
%bcond_without event # event MPM
+%bcond_without itk # ITK MPM
%bcond_with distcache # distcache support
%bcond_with bucketeer # debug one
@@ -42,7 +43,7 @@
Summary(tr.UTF-8): Lider WWW tarayıcı
Name: apache
Version: 2.2.17
-Release: 8
+Release: 8.1
License: Apache v2.0
Group: Networking/Daemons/HTTP
Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.gz
@@ -99,6 +100,8 @@
Patch25: httpd-2.2.x-mod_ssl-sessioncaching.patch
Patch26: apache-mod_vhost_alias_docroot.patch
Patch27: apache-bug-41743.patch
+# http://mpm-itk.sesse.net/
+Patch28: apache-mpm-itk.patch
URL: http://httpd.apache.org/
BuildRequires: apr-devel >= 1:1.2
BuildRequires: apr-util-devel >= 1:1.3
@@ -1789,6 +1792,7 @@
%patch25 -p1
%patch26 -p1
%patch27 -p0
+%patch28 -p1
# using system apr, apr-util and pcre
rm -rf srclib/{apr,apr-util,pcre}
@@ -1822,12 +1826,12 @@
cd ../..
CPPFLAGS="-DMAX_SERVER_LIMIT=200000 -DBIG_SECURITY_HOLE=1"
-for mpm in prefork worker %{?with_event:event}; do
+for mpm in prefork worker %{?with_event:event} %{with_itk:itk}; do
install -d "buildmpm-${mpm}"; cd "buildmpm-${mpm}"
../%configure \
--enable-layout=PLD \
--disable-v4-mapped \
- $( [ "${mpm}" = "prefork" -o "${mpm}" = "worker" -o "${mpm}" = "event" ] && echo "--enable-exception-hook" ) \
+ $( [ "${mpm}" = "prefork" -o "${mpm}" = "worker" -o "${mpm}" = "event" -o "${mpm}" = "itk" ] && echo "--enable-exception-hook" ) \
--enable-modules=all \
--enable-mods-shared=all \
--enable-auth-anon \
@@ -2778,6 +2782,9 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.616 2011/03/10 10:41:03 baggins
+- added ITK MPM
+
Revision 1.615 2011/02/13 18:53:04 arekm
- rel 8; fix graceful restart for keepalive connections
================================================================
Index: packages/apache/apache-mpm-itk.patch
diff -u /dev/null packages/apache/apache-mpm-itk.patch:1.1
--- /dev/null Thu Mar 10 11:41:08 2011
+++ packages/apache/apache-mpm-itk.patch Thu Mar 10 11:41:03 2011
@@ -0,0 +1,2041 @@
+http://mpm-itk.sesse.net/apache2.2-mpm-itk-20090414-00.patch
+
+unchanged:
+--- httpd-2.2.11/server/mpm/experimental/itk/Makefile.in 2009-03-17 21:38:54.000000000 +0100
++++ httpd-2.2.11/server/mpm/experimental/itk/Makefile.in 2009-03-17 21:39:03.000000000 +0100
+@@ -0,0 +1,5 @@
++
++LTLIBRARY_NAME = libitk.la
++LTLIBRARY_SOURCES = itk.c
++
++include $(top_srcdir)/build/ltlib.mk
+unchanged:
+--- httpd-2.2.11/server/mpm/experimental/itk/config.m4 2009-03-17 21:38:53.000000000 +0100
++++ httpd-2.2.11/server/mpm/experimental/itk/config.m4 2009-03-17 21:39:03.000000000 +0100
+@@ -0,0 +1,3 @@
++if test "$MPM_NAME" = "itk" ; then
++ APACHE_FAST_OUTPUT(server/mpm/$MPM_NAME/Makefile)
++fi
+diff -u httpd-2.2.11/server/mpm/experimental/itk/itk.c httpd-2.2.11/server/mpm/experimental/itk/itk.c
+--- httpd-2.2.11/server/mpm/experimental/itk/itk.c 2009-04-14 23:29:16.000000000 +0200
++++ httpd-2.2.11/server/mpm/experimental/itk/itk.c 2009-04-14 23:31:05.000000000 +0200
+@@ -0,0 +1,1740 @@
++/* 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-2009 Steinar H. Gunderson <sgunderson at bigfoot.com>.
++ * Licensed under the same terms as the rest of Apache.
++ *
++ * Portions copyright 2008 Knut Auvor Grythe <knut at auvor.no>.
++ * Licensed under the same terms as the rest of Apache.
++ */
++
++#include "apr.h"
++#include "apr_portable.h"
++#include "apr_strings.h"
++#include "apr_thread_proc.h"
++#include "apr_signal.h"
++
++# define _DBG(text,par...) \
++ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, \
++ "(itkmpm: pid=%d uid=%d, gid=%d) %s(): " text, \
++ getpid(), getuid(), getgid(), __FUNCTION__, par)
++
++#define APR_WANT_STDIO
++#define APR_WANT_STRFUNC
++#include "apr_want.h"
++
++#if APR_HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if APR_HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#define CORE_PRIVATE
++
++#include "ap_config.h"
++#include "httpd.h"
++#include "mpm_default.h"
++#include "http_main.h"
++#include "http_log.h"
++#include "http_config.h"
++#include "http_core.h" /* for get_remote_host */
++#include "http_connection.h"
++#include "http_request.h" /* for ap_hook_post_perdir_config */
++#include "scoreboard.h"
++#include "ap_mpm.h"
++#include "unixd.h"
++#include "mpm_common.h"
++#include "ap_listen.h"
++#include "ap_mmn.h"
++#include "apr_poll.h"
++
++#ifdef HAVE_BSTRING_H
++#include <bstring.h> /* for IRIX, FD_SET calls bzero() */
++#endif
++#ifdef HAVE_TIME_H
++#include <time.h>
++#endif
++#ifdef HAVE_SYS_PROCESSOR_H
++#include <sys/processor.h> /* for bindprocessor() */
++#endif
++
++#if HAVE_LIBCAP
++#include <sys/capability.h>
++#endif
++
++#include <signal.h>
++#include <sys/times.h>
++
++/* Limit on the total --- clients will be locked out if more servers than
++ * this are needed. It is intended solely to keep the server from crashing
++ * when things get out of hand.
++ *
++ * We keep a hard maximum number of servers, for two reasons --- first off,
++ * in case something goes seriously wrong, we want to stop the fork bomb
++ * short of actually crashing the machine we're running on by filling some
++ * kernel table. Secondly, it keeps the size of the scoreboard file small
++ * enough that we can read the whole thing without worrying too much about
++ * the overhead.
++ */
++#ifndef DEFAULT_SERVER_LIMIT
++#define DEFAULT_SERVER_LIMIT 256
++#endif
++
++/* Admin can't tune ServerLimit beyond MAX_SERVER_LIMIT. We want
++ * some sort of compile-time limit to help catch typos.
++ */
++#ifndef MAX_SERVER_LIMIT
++#define MAX_SERVER_LIMIT 200000
++#endif
++
++#ifndef HARD_THREAD_LIMIT
++#define HARD_THREAD_LIMIT 1
++#endif
++
++/* config globals */
++
++int ap_threads_per_child=0; /* Worker threads per child */
++static apr_proc_mutex_t *accept_mutex;
++static int ap_daemons_to_start=0;
++static int ap_daemons_min_free=0;
++static int ap_daemons_max_free=0;
++static int ap_daemons_limit=0; /* MaxClients */
++static int server_limit = DEFAULT_SERVER_LIMIT;
++static int first_server_limit = 0;
++static int changed_limit_at_restart;
++static int mpm_state = AP_MPMQ_STARTING;
++static ap_pod_t *pod;
++
++/*
++ * The max child slot ever assigned, preserved across restarts. Necessary
++ * to deal with MaxClients changes across AP_SIG_GRACEFUL restarts. We
++ * use this value to optimize routines that have to scan the entire scoreboard.
++ */
++int ap_max_daemons_limit = -1;
++server_rec *ap_server_conf;
++
++/* one_process --- debugging mode variable; can be set from the command line
++ * with the -X flag. If set, this gets you the child_main loop running
++ * in the process which originally started up (no detach, no make_child),
++ * which is a pretty nice debugging environment. (You'll get a SIGHUP
++ * early in standalone_main; just continue through. This is the server
++ * trying to kill off any child processes which it might have lying
++ * around --- Apache doesn't keep track of their pids, it just sends
++ * SIGHUP to the process group, ignoring it in the root process.
++ * Continue through and you'll be fine.).
++ */
++
++static int one_process = 0;
++
++static apr_pool_t *pconf; /* Pool for config stuff */
++static apr_pool_t *pchild; /* Pool for httpd child stuff */
++
++static pid_t ap_my_pid; /* it seems silly to call getpid all the time */
++static pid_t parent_pid;
++#ifndef MULTITHREAD
++static int my_child_num;
++#endif
++ap_generation_t volatile ap_my_generation=0;
++
++#ifdef TPF
++int tpf_child = 0;
++char tpf_server_name[INETD_SERVNAME_LENGTH+1];
++#endif /* TPF */
++
++static volatile int die_now = 0;
++
++#define UNSET_NICE_VALUE 100
++
++typedef struct
++{
++ uid_t uid;
++ gid_t gid;
++ char *username;
++ int nice_value;
++} itk_per_dir_conf;
++
++typedef struct
++{
++ int max_clients_vhost;
++} itk_server_conf;
++
++module AP_MODULE_DECLARE_DATA mpm_itk_module;
++
++#ifdef GPROF
++/*
++ * change directory for gprof to plop the gmon.out file
++ * configure in httpd.conf:
++ * GprofDir $RuntimeDir/ -> $ServerRoot/$RuntimeDir/gmon.out
++ * GprofDir $RuntimeDir/% -> $ServerRoot/$RuntimeDir/gprof.$pid/gmon.out
++ */
++static void chdir_for_gprof(void)
++{
++ core_server_config *sconf =
++ ap_get_module_config(ap_server_conf->module_config, &core_module);
++ char *dir = sconf->gprof_dir;
++ const char *use_dir;
++
++ if(dir) {
++ apr_status_t res;
++ char *buf = NULL ;
++ int len = strlen(sconf->gprof_dir) - 1;
++ if(*(dir + len) == '%') {
++ dir[len] = '\0';
++ buf = ap_append_pid(pconf, dir, "gprof.");
++ }
++ use_dir = ap_server_root_relative(pconf, buf ? buf : dir);
++ res = apr_dir_make(use_dir,
++ APR_UREAD | APR_UWRITE | APR_UEXECUTE |
++ APR_GREAD | APR_GEXECUTE |
++ APR_WREAD | APR_WEXECUTE, pconf);
++ if(res != APR_SUCCESS && !APR_STATUS_IS_EEXIST(res)) {
++ ap_log_error(APLOG_MARK, APLOG_ERR, res, ap_server_conf,
++ "gprof: error creating directory %s", dir);
++ }
++ }
++ else {
++ use_dir = ap_server_root_relative(pconf, DEFAULT_REL_RUNTIMEDIR);
++ }
++
++ chdir(use_dir);
++}
++#else
++#define chdir_for_gprof()
++#endif
++
++/* XXX - I don't know if TPF will ever use this module or not, so leave
++ * the ap_check_signals calls in but disable them - manoj */
++#define ap_check_signals()
++
++/* a clean exit from a child with proper cleanup */
++static void clean_child_exit(int code) __attribute__ ((noreturn));
++static void clean_child_exit(int code)
++{
++ mpm_state = AP_MPMQ_STOPPING;
++
++ if (pchild) {
++ apr_pool_destroy(pchild);
++ }
++ ap_mpm_pod_close(pod);
++ chdir_for_gprof();
++ exit(code);
++}
++
++static void accept_mutex_on(void)
++{
++ apr_status_t rv = apr_proc_mutex_lock(accept_mutex);
++ if (rv != APR_SUCCESS) {
++ const char *msg = "couldn't grab the accept mutex";
++
++ if (ap_my_generation !=
++ ap_scoreboard_image->global->running_generation) {
++ ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg);
++ clean_child_exit(0);
++ }
++ else {
++ ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "%s", msg);
++ exit(APEXIT_CHILDFATAL);
++ }
++ }
++}
++
++static void accept_mutex_off(void)
++{
++ apr_status_t rv = apr_proc_mutex_unlock(accept_mutex);
++ if (rv != APR_SUCCESS) {
++ const char *msg = "couldn't release the accept mutex";
++
++ if (ap_my_generation !=
++ ap_scoreboard_image->global->running_generation) {
++ ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg);
++ /* don't exit here... we have a connection to
++ * process, after which point we'll see that the
++ * generation changed and we'll exit cleanly
++ */
++ }
++ else {
++ ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "%s", msg);
++ exit(APEXIT_CHILDFATAL);
++ }
++ }
++}
++
++/* On some architectures it's safe to do unserialized accept()s in the single
++ * Listen case. But it's never safe to do it in the case where there's
++ * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
++ * when it's safe in the single Listen case.
++ */
++#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
++#define SAFE_ACCEPT(stmt) do {if (ap_listeners->next) {stmt;}} while(0)
++#else
++#define SAFE_ACCEPT(stmt) do {stmt;} while(0)
++#endif
++
++AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
++{
++ switch(query_code){
++ case AP_MPMQ_MAX_DAEMON_USED:
++ *result = ap_daemons_limit;
++ return APR_SUCCESS;
++ case AP_MPMQ_IS_THREADED:
++ *result = AP_MPMQ_NOT_SUPPORTED;
++ return APR_SUCCESS;
++ case AP_MPMQ_IS_FORKED:
++ *result = AP_MPMQ_DYNAMIC;
++ return APR_SUCCESS;
++ case AP_MPMQ_HARD_LIMIT_DAEMONS:
++ *result = server_limit;
++ return APR_SUCCESS;
++ case AP_MPMQ_HARD_LIMIT_THREADS:
++ *result = HARD_THREAD_LIMIT;
++ return APR_SUCCESS;
++ case AP_MPMQ_MAX_THREADS:
++ *result = 0;
++ return APR_SUCCESS;
++ case AP_MPMQ_MIN_SPARE_DAEMONS:
++ *result = ap_daemons_min_free;
++ return APR_SUCCESS;
++ case AP_MPMQ_MIN_SPARE_THREADS:
++ *result = 0;
++ return APR_SUCCESS;
++ case AP_MPMQ_MAX_SPARE_DAEMONS:
++ *result = ap_daemons_max_free;
++ return APR_SUCCESS;
++ case AP_MPMQ_MAX_SPARE_THREADS:
++ *result = 0;
++ return APR_SUCCESS;
++ case AP_MPMQ_MAX_REQUESTS_DAEMON:
++ *result = ap_max_requests_per_child;
++ return APR_SUCCESS;
++ case AP_MPMQ_MAX_DAEMONS:
++ *result = server_limit;
++ return APR_SUCCESS;
++ case AP_MPMQ_MPM_STATE:
++ *result = mpm_state;
++ return APR_SUCCESS;
++ }
++ return APR_ENOTIMPL;
++}
++
++#if defined(NEED_WAITPID)
++/*
++ Systems without a real waitpid sometimes lose a child's exit while waiting
++ for another. Search through the scoreboard for missing children.
++ */
++int reap_children(int *exitcode, apr_exit_why_e *status)
++{
++ int n, pid;
++
++ for (n = 0; n < ap_max_daemons_limit; ++n) {
++ if (ap_scoreboard_image->servers[n][0].status != SERVER_DEAD &&
++ kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) {
++ ap_update_child_status_from_indexes(n, 0, SERVER_DEAD, NULL);
++ /* just mark it as having a successful exit status */
++ *status = APR_PROC_EXIT;
++ *exitcode = 0;
++ return(pid);
++ }
++ }
++ return 0;
++}
++#endif
++
++/*****************************************************************
++ * Connection structures and accounting...
++ */
++
++static void just_die(int sig)
++{
++ clean_child_exit(0);
++}
++
++static void stop_listening(int sig)
++{
++ ap_close_listeners();
++
++ /* For a graceful stop, we want the child to exit when done */
++ die_now = 1;
++}
++
++/* volatile just in case */
++static int volatile shutdown_pending;
++static int volatile restart_pending;
++static int volatile is_graceful;
++
++static void sig_term(int sig)
++{
++ if (shutdown_pending == 1) {
++ /* Um, is this _probably_ not an error, if the user has
++ * tried to do a shutdown twice quickly, so we won't
++ * worry about reporting it.
++ */
++ return;
++ }
++ shutdown_pending = 1;
++ is_graceful = (sig == AP_SIG_GRACEFUL_STOP);
++}
++
++/* restart() is the signal handler for SIGHUP and AP_SIG_GRACEFUL
++ * in the parent process, unless running in ONE_PROCESS mode
++ */
++static void restart(int sig)
++{
++ if (restart_pending == 1) {
++ /* Probably not an error - don't bother reporting it */
++ return;
++ }
++ restart_pending = 1;
++ is_graceful = (sig == AP_SIG_GRACEFUL);
++}
++
++static void set_signals(void)
++{
++#ifndef NO_USE_SIGACTION
++ struct sigaction sa;
++#endif
++
++ if (!one_process) {
++ ap_fatal_signal_setup(ap_server_conf, pconf);
++ }
++
++#ifndef NO_USE_SIGACTION
++ sigemptyset(&sa.sa_mask);
++ sa.sa_flags = 0;
++
++ sa.sa_handler = sig_term;
++ if (sigaction(SIGTERM, &sa, NULL) < 0)
++ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGTERM)");
++#ifdef AP_SIG_GRACEFUL_STOP
++ if (sigaction(AP_SIG_GRACEFUL_STOP, &sa, NULL) < 0)
++ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
++ "sigaction(" AP_SIG_GRACEFUL_STOP_STRING ")");
++#endif
++#ifdef SIGINT
++ if (sigaction(SIGINT, &sa, NULL) < 0)
++ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
++#endif
++#ifdef SIGXCPU
++ sa.sa_handler = SIG_DFL;
++ if (sigaction(SIGXCPU, &sa, NULL) < 0)
++ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXCPU)");
++#endif
++#ifdef SIGXFSZ
++ sa.sa_handler = SIG_DFL;
++ if (sigaction(SIGXFSZ, &sa, NULL) < 0)
++ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXFSZ)");
++#endif
++#ifdef SIGPIPE
++ sa.sa_handler = SIG_IGN;
++ if (sigaction(SIGPIPE, &sa, NULL) < 0)
++ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGPIPE)");
++#endif
++
++ /* we want to ignore HUPs and AP_SIG_GRACEFUL while we're busy
++ * processing one
++ */
++ sigaddset(&sa.sa_mask, SIGHUP);
++ sigaddset(&sa.sa_mask, AP_SIG_GRACEFUL);
++ sa.sa_handler = restart;
++ if (sigaction(SIGHUP, &sa, NULL) < 0)
++ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGHUP)");
++ if (sigaction(AP_SIG_GRACEFUL, &sa, NULL) < 0)
++ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(" AP_SIG_GRACEFUL_STRING ")");
++#else
++ if (!one_process) {
++#ifdef SIGXCPU
++ apr_signal(SIGXCPU, SIG_DFL);
++#endif /* SIGXCPU */
++#ifdef SIGXFSZ
++ apr_signal(SIGXFSZ, SIG_DFL);
++#endif /* SIGXFSZ */
++ }
++
++ apr_signal(SIGTERM, sig_term);
++#ifdef SIGHUP
++ apr_signal(SIGHUP, restart);
++#endif /* SIGHUP */
++#ifdef AP_SIG_GRACEFUL
++ apr_signal(AP_SIG_GRACEFUL, restart);
++#endif /* AP_SIG_GRACEFUL */
++#ifdef AP_SIG_GRACEFUL_STOP
++ apr_signal(AP_SIG_GRACEFUL_STOP, sig_term);
++#endif /* AP_SIG_GRACEFUL */
++#ifdef SIGPIPE
++ apr_signal(SIGPIPE, SIG_IGN);
++#endif /* SIGPIPE */
++
++#endif
++}
++
++/*****************************************************************
++ * Child process main loop.
++ * The following vars are static to avoid getting clobbered by longjmp();
++ * they are really private to child_main.
++ */
++
++static int requests_this_child;
++static int num_listensocks = 0;
++
++
++int ap_graceful_stop_signalled(void)
++{
++ /* not ever called anymore... */
++ return 0;
++}
++
++
++static void child_main(int child_num_arg)
++{
++ apr_pool_t *ptrans;
++ apr_allocator_t *allocator;
++ apr_status_t status;
++ int i;
++ ap_listen_rec *lr;
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/apache/apache.spec?r1=1.615&r2=1.616&f=u
More information about the pld-cvs-commit
mailing list