mpm_unix.c revision 982c7823d8ad8c593209d2d91cba5b38615f36a5
2d0611ffc9f91c5fc2ddccb93f9a3d17791ae650takashi/* Licensed to the Apache Software Foundation (ASF) under one or more
2d0611ffc9f91c5fc2ddccb93f9a3d17791ae650takashi * contributor license agreements. See the NOTICE file distributed with
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd * this work for additional information regarding copyright ownership.
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd * The ASF licenses this file to You under the Apache License, Version 2.0
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd * (the "License"); you may not use this file except in compliance with
#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_core.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:
pid);
case SEND_SIGKILL:
pid);
case GIVEUP:
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, 0, 0);
++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, 0, 0);
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;
int status)
const char *sigdesc;
return status;
return APEXIT_CHILDFATAL;
switch (signum) {
case SIGTERM:
case SIGHUP:
case AP_SIG_GRACEFUL:
case SIGKILL:
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;
return rv;
(*pod)->p = p;
return APR_SUCCESS;
int rc;
case AP_MPM_PODX_RESTART_CHAR:
return AP_MPM_PODX_RESTART;
return AP_MPM_PODX_GRACEFUL;
return AP_MPM_PODX_NORESTART;
return rv;
return rv;
return rv;
switch (graceful) {
case AP_MPM_PODX_RESTART:
case AP_MPM_PODX_GRACEFUL:
case AP_MPM_PODX_NORESTART:
return rv;
const char *data;
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;
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 &&
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;