beos.c revision 9aa4b0b53f1b26086d04c51d77e742b698cfa653
06ba4a61654b3763ad65f52283832ebf058fdf1csliveap_/* ====================================================================
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * The Apache Software License, Version 1.1
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * Copyright (c) 2000 The Apache Software Foundation. All rights
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * reserved.
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * Redistribution and use in source and binary forms, with or without
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * modification, are permitted provided that the following conditions
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * 1. Redistributions of source code must retain the above copyright
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * notice, this list of conditions and the following disclaimer.
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * 2. Redistributions in binary form must reproduce the above copyright
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * notice, this list of conditions and the following disclaimer in
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * the documentation and/or other materials provided with the
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * distribution.
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * 3. The end-user documentation included with the redistribution,
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * if any, must include the following acknowledgment:
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * "This product includes software developed by the
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * Apache Software Foundation (http://www.apache.org/)."
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * Alternately, this acknowledgment may appear in the software itself,
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * if and wherever such third-party acknowledgments normally appear.
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * 4. The names "Apache" and "Apache Software Foundation" must
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * not be used to endorse or promote products derived from this
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * software without prior written permission. For written
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * permission, please contact apache@apache.org.
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * 5. Products derived from this software may not be called "Apache",
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * nor may "Apache" appear in their name, without prior written
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * permission of the Apache Software Foundation.
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * SUCH DAMAGE.
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * ====================================================================
06ba4a61654b3763ad65f52283832ebf058fdf1cslive * This software consists of voluntary contributions made by many
#define CORE_PRIVATE
#include "apr_portable.h"
#include "httpd.h"
#include "http_main.h"
#include "http_log.h"
#include "http_connection.h"
#include "ap_mpm.h"
#include "beosd.h"
#include "iol_socket.h"
#include "ap_listen.h"
#include "scoreboard.h"
#include "mpm_common.h"
#include "mpm.h"
#include <unistd.h>
int ap_max_requests_per_child=0;
static int ap_threads_to_start=0;
static int min_spare_threads=0;
static int max_spare_threads=0;
static int ap_thread_limit=0;
static int server_pid;
static int worker_thread_count;
int slot;
} proc_info;
static int one_process = 0;
#ifdef DEBUG_SIGSTOP
int raise_sigstop_flags;
return ap_max_child_assigned;
if (pchild)
static int volatile shutdown_pending;
static int volatile restart_pending;
static int volatile is_graceful;
void ap_start_shutdown(void)
static void tell_workers_to_exit(void)
for (i=0;i<ap_max_child_assigned;i++) {
for (i=0;i<ap_max_child_assigned;i++)
static void set_signals(void)
if (!one_process) {
int ap_graceful_stop_signalled(void)
return is_graceful;
int csd;
conn_id);
int srv , n;
int this_worker_should_exit = 0;
/* now setup our own pollset...this will use APR woohoo! */
for(n=0 ; n < num_listening_sockets ; ++n)
while (!this_worker_should_exit) {
if (this_worker_should_exit) break;
while (!this_worker_should_exit) {
if (this_worker_should_exit) break;
goto got_fd;
curr_pollfd++;
goto got_fd;
if (!this_worker_should_exit) {
if (worker_thread_count == 0) {
if (one_process) {
set_signals();
my_info);
#ifndef MAX_SPAWN_RATE
static int hold_off_on_exponential_spawning;
static void perform_idle_server_maintenance(void)
int free_length;
int last_non_dead;
free_length = 0;
for (i = 0; i < ap_thread_limit; ++i) {
++free_length;
last_non_dead = i;
if (free_length > 0) {
for (i = 0; i < free_length; ++i) {
int child_slot;
for (i = 0; i < ap_max_child_assigned; ++i) {
child_slot = i;
for (j = 0; j < HARD_THREAD_LIMIT; j++) {
if (child_slot >= 0) {
#ifdef APR_HAS_OTHER_CHILD
else if (is_graceful) {
else if (remaining_threads_to_start) {
int remaining_threads_to_start, i;
ap_server_conf = s;
if (!is_graceful)
set_signals();
/* we assume all goes OK...hmm might want to check that! */
if (!is_graceful) {
if (shutdown_pending) {
0, ap_server_conf,
if (one_process) {
if (is_graceful) {
if (!is_graceful) {
static int restart_num = 0;
is_graceful = 0;
if (!one_process)
ap_detach();
static void beos_hooks(void)
one_process = 0;
return err;
return NULL;
return err;
return NULL;
return err;
return NULL;
return err;
if (min_spare_threads <= 0) {
return NULL;
return err;
return NULL;
return err;
return NULL;
return err;
return NULL;
return err;
return NULL;
return err;
return NULL;
const char *fname;
return err;
return NULL;
{ NULL }