mpm_unix.c revision 31eeb74b832eea054c7a42081c1afdeccd987e5e
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder/* Licensed to the Apache Software Foundation (ASF) under one or more
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * contributor license agreements. See the NOTICE file distributed with
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * this work for additional information regarding copyright ownership.
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * The ASF licenses this file to You under the Apache License, Version 2.0
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * (the "License"); you may not use this file except in compliance with
e973af819c2fb17f426944c8c4cfa00de5cd81a1Christian Maeder * the License. You may obtain a copy of the License at
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * http://www.apache.org/licenses/LICENSE-2.0
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * Unless required by applicable law or agreed to in writing, software
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * distributed under the License is distributed on an "AS IS" BASIS,
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4654dbb45f8a4aea7aa5fed6be22c9efff19bfcaChristian Maeder * See the License for the specific language governing permissions and
#ifndef WIN32
#include "apr.h"
#include "apr_thread_proc.h"
#include "apr_signal.h"
#include "apr_strings.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "apr_getopt.h"
#include "apr_optional.h"
#include "apr_allocator.h"
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "http_main.h"
#include "mpm_common.h"
#include "ap_mpm.h"
#include "ap_listen.h"
#include "scoreboard.h"
#include "util_mutex.h"
#ifdef HAVE_PWD_H
#include <pwd.h>
#ifdef HAVE_GRP_H
#include <grp.h>
#include <unistd.h>
typedef struct extra_process_t {
extras = p;
if (cur) {
if (prev) {
int status;
switch(action) {
case DO_NOTHING:
case SEND_SIGTERM:
0, ap_server_conf,
pid);
case SEND_SIGKILL:
0, ap_server_conf,
pid);
case GIVEUP:
0, ap_server_conf,
pid);
int not_dead_yet;
int max_daemons;
} action_table[] = {
++next_action;
not_dead_yet = 0;
for (i = 0; i < max_daemons; ++i) {
if (pid == 0) {
mpm_callback(i);
++not_dead_yet;
while (cur_extra) {
++not_dead_yet;
} while (not_dead_yet > 0 &&
int max_daemons;
for (i = 0; i < max_daemons; ++i) {
if (pid == 0) {
mpm_callback(i);
while (cur_extra) {
#ifndef HAVE_GETPGID
int status;
return APR_EINVAL;
return APR_EINVAL;
return APR_EINVAL;
return APR_EINVAL;
return errno;
return APR_EINVAL;
const char *sigdesc;
return status;
0, ap_server_conf,
return APEXIT_CHILDFATAL;
switch (signum) {
case SIGTERM:
case SIGHUP:
case AP_SIG_GRACEFUL:
case SIGKILL:
0, ap_server_conf,
0, ap_server_conf,
APR_WRITE_BLOCK, p);
return rv;
(*pod)->p = p;
return APR_SUCCESS;
return APR_SUCCESS;
return rv;
return AP_NORESTART;
return rv;
return rv;
return APR_SUCCESS;
return rv;
char *srequest;
apr_pool_t *p;
return rv;
if (!lp) {
apr_pool_destroy(p);
return rv;
apr_pool_destroy(p);
return rv;
apr_pool_destroy(p);
return rv;
return rv;
int running = 0;
const char *status;
*exit_status = 0;
otherpid);
if (running) {
if (!running) {
if (!running) {
if (!running) {
if (!running) {
const char *optarg;
if (!dash_k_arg) {
if (optarg) {
static int exception_hook_enabled;
const char *arg)
return err;
return NULL;
if (exception_hook_enabled &&
geteuid() != 0 &&
0, ap_server_conf,
return APR_SUCCESS;
#ifndef NO_USE_SIGACTION
#if defined(SA_ONESHOT)
#ifdef SIGBUS
#ifdef SIGABORT
#ifdef SIGABRT
#ifdef SIGILL
#ifdef SIGFPE
#ifdef SIGBUS
#ifdef SIGABORT
#ifdef SIGABRT
#ifdef SIGILL
#ifdef SIGFPE
return APR_SUCCESS;