mpm_common.c revision 9b07fdbae72923016406bb66e2875e3324722a6f
3802a3d3d7af51ddff31943d5514382f01265770Lennart Poettering/* ====================================================================
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * The Apache Software License, Version 1.1
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * Copyright (c) 2000 The Apache Software Foundation. All rights
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * reserved.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * Redistribution and use in source and binary forms, with or without
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * modification, are permitted provided that the following conditions
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * are met:
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * 1. Redistributions of source code must retain the above copyright
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * notice, this list of conditions and the following disclaimer.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * 2. Redistributions in binary form must reproduce the above copyright
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * notice, this list of conditions and the following disclaimer in
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * the documentation and/or other materials provided with the
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * distribution.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * 3. The end-user documentation included with the redistribution,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * if any, must include the following acknowledgment:
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * "This product includes software developed by the
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * Apache Software Foundation (http://www.apache.org/)."
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * Alternately, this acknowledgment may appear in the software itself,
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett * if and wherever such third-party acknowledgments normally appear.
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * 4. The names "Apache" and "Apache Software Foundation" must
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * not be used to endorse or promote products derived from this
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * software without prior written permission. For written
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * permission, please contact apache@apache.org.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * 5. Products derived from this software may not be called "Apache",
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * nor may "Apache" appear in their name, without prior written
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * permission of the Apache Software Foundation.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * SUCH DAMAGE.
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett * ====================================================================
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * This software consists of voluntary contributions made by many
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * individuals on behalf of the Apache Software Foundation. For more
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * information on the Apache Software Foundation, please see
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen * <http://www.apache.org/>.
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen *
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett * Portions of this software are based upon public domain software
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen * originally written at the National Center for Supercomputing Applications,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * University of Illinois, Urbana-Champaign.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek/* The purpose of this file is to store the code that MOST mpm's will need
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * this does not mean a function only goes into this file if every MPM needs
dd2b607b7d1ce355e93f9f71cd256ec20b8ae9c4Thomas Hindoe Paaboel Andersen * it. It means that if a function is needed by more than one MPM, and
18ead1b00dff180a97507d014325cb46198e6657Chris Mayo * future maintenance would be served by making the code common, then the
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * function belongs here.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek *
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * This is going in src/main because it is not platform specific, it is
e93549ef29c4123d9ee45acb5815048390201e49Zbigniew Jędrzejewski-Szmek * specific to multi-process servers, but NOT to Unix. Which is why it
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett * does not belong in src/os/unix
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#include "apr_thread_proc.h"
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#include "httpd.h"
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#include "http_config.h"
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#include "http_log.h"
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#include "mpm.h"
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#include "mpm_common.h"
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#if HAVE_SYS_TIME_H
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#include <sys/time.h> /* for timeval definitions */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#endif
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#if defined(DEXTER) || defined(MPMT_BEOS_MPM) || defined(BEOS_MPM)
8d0e0ddda6501479eb69164687c83c1a7667b33aJan Engelhardt#define CHILD_TABLE 1
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#define CHILD_INFO_TABLE ap_child_table
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#elif defined(MPMT_PTHREAD) || defined (NO_THREADS) || defined(PREFORK_MPM)
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#define SCOREBOARD 1
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#define CHILD_INFO_TABLE ap_scoreboard_image->parent
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#endif
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#ifdef CHILD_INFO_TABLE
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmekvoid ap_reclaim_child_processes(int terminate)
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek{
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek int i;
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek long int waittime = 1024 * 16; /* in usecs */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek ap_status_t waitret;
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek int tries;
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek int not_dead_yet;
8c9571d0ae50656f730a5e37378d5c3dcf3b9789Lennart Poettering int max_daemons = ap_get_max_daemons();
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
442f7f155358a7396a350d3c47ea42e86bee4024Chris Atkinson#ifdef SCOREBOARD
a8eaaee72a2f06e0fb64fb71de3b71ecba31dafbJan Engelhardt ap_sync_scoreboard_image();
8c9571d0ae50656f730a5e37378d5c3dcf3b9789Lennart Poettering#endif
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek for (tries = terminate ? 4 : 1; tries <= 9; ++tries) {
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek /* don't want to hold up progress any more than
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * necessary, but we need to allow children a few moments to exit.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek * Set delay with an exponential backoff.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek waittime = waittime * 4;
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek ap_sleep(waittime);
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek /* now see who is done */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek not_dead_yet = 0;
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek for (i = 0; i < max_daemons; ++i) {
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek pid_t pid = CHILD_INFO_TABLE[i].pid;
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek ap_proc_t proc;
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#ifdef CHILD_TABLE
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek if (ap_child_table[i].status == SERVER_DEAD)
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek#elif defined(SCOREBOARD)
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek if (pid == ap_my_pid || pid == 0)
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering#endif
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering continue;
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering proc.pid = pid;
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering waitret = ap_wait_proc(&proc, APR_NOWAIT);
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering if (waitret != APR_CHILD_NOTDONE) {
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering#ifdef CHILD_TABLE
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering ap_child_table[i].status = SERVER_DEAD;
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering#elif defined(SCOREBOARD)
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering ap_scoreboard_image->parent[i].pid = 0;
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering#endif
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering continue;
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering }
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering ++not_dead_yet;
cbfaff65cb086e3eb3709cf86dcf63b46622389bKarel Zak switch (tries) {
5470c03b37d8421a903564c2c8028c8b8d67d403Lennart Poettering case 1: /* 16ms */
b938cb902c3b5bca807a94b277672c64d6767886Jan Engelhardt case 2: /* 82ms */
5470c03b37d8421a903564c2c8028c8b8d67d403Lennart Poettering break;
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering case 3: /* 344ms */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek case 4: /* 16ms */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek case 5: /* 82ms */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek case 6: /* 344ms */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek case 7: /* 1.4sec */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek /* ok, now it's being annoying */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek 0, ap_server_conf,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek "child process %ld still did not exit, sending a SIGTERM",
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering (long)pid);
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering kill(pid, SIGTERM);
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek break;
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek case 8: /* 6 sec */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek /* die child scum */
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR,
0, ap_server_conf,
"child process %ld still did not exit, sending a SIGKILL",
(long)pid);
#ifndef BEOS
kill(pid, SIGKILL);
#else
/* sending a SIGKILL kills the entire team on BeOS, and as
* httpd thread is part of that team it removes any chance
* of ever doing a restart. To counter this I'm changing to
* use a kinder, gentler way of killing a specific thread
* that is just as effective.
*/
kill_thread(pid);
#endif
break;
case 9: /* 14 sec */
/* gave it our best shot, but alas... If this really
* is a child we are trying to kill and it really hasn't
* exited, we will likely fail to bind to the port
* after the restart.
*/
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR,
0, ap_server_conf,
"could not make child process %ld exit, "
"attempting to continue anyway", (long)pid);
break;
}
}
ap_check_other_child();
if (!not_dead_yet) {
/* nothing left to wait for */
break;
}
}
}
#endif
/* number of calls to wait_or_timeout between writable probes */
#ifndef INTERVAL_OF_WRITABLE_PROBES
#define INTERVAL_OF_WRITABLE_PROBES 10
#endif
static int wait_or_timeout_counter;
void ap_wait_or_timeout(ap_wait_t *status, ap_proc_t *ret, ap_pool_t *p)
{
ap_status_t rv;
++wait_or_timeout_counter;
if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
wait_or_timeout_counter = 0;
#ifdef APR_HAS_OTHER_CHILD
ap_probe_writable_fds();
#endif
}
rv = ap_wait_all_procs(ret, status, APR_NOWAIT, p);
if (ap_canonical_error(rv) == APR_EINTR) {
ret->pid = -1;
return;
}
if (rv == APR_CHILD_DONE) {
return;
}
#ifdef NEED_WAITPID
if ((ret = reap_children(status)) > 0) {
return;
}
#endif
ap_sleep(SCOREBOARD_MAINTENANCE_INTERVAL);
ret->pid = -1;
return;
}
void ap_process_child_status(ap_proc_t *pid, ap_wait_t status)
{
/* Child died... if it died due to a fatal error,
* we should simply bail out.
*/
if ((WIFEXITED(status)) &&
WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf,
"Child %ld returned a Fatal error... \n"
"Apache is exiting!",
(long)pid->pid);
exit(APEXIT_CHILDFATAL);
}
if (WIFSIGNALED(status)) {
switch (WTERMSIG(status)) {
case SIGTERM:
case SIGHUP:
case SIGUSR1:
case SIGKILL:
break;
default:
#ifdef SYS_SIGLIST
#ifdef WCOREDUMP
if (WCOREDUMP(status)) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
0, ap_server_conf,
"child pid %ld exit signal %s (%d), "
"possible coredump in %s",
(long)pid->pid, (WTERMSIG(status) >= NumSIG) ? "" :
SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status),
ap_coredump_dir);
}
else {
#endif
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
0, ap_server_conf,
"child pid %ld exit signal %s (%d)",
(long)pid->pid,
SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
#ifdef WCOREDUMP
}
#endif
#else
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
0, ap_server_conf,
"child pid %ld exit signal %d",
(long)pid->pid, WTERMSIG(status));
#endif
}
}
}