motorz.h revision e727b3cfc15b8a21efaafccb7ca41795f2a060d5
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering/* Licensed to the Apache Software Foundation (ASF) under one or more
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * contributor license agreements. See the NOTICE file distributed with
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen * this work for additional information regarding copyright ownership.
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * The ASF licenses this file to You under the Apache License, Version 2.0
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * (the "License"); you may not use this file except in compliance with
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * the License. You may obtain a copy of the License at
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * http://www.apache.org/licenses/LICENSE-2.0
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * Unless required by applicable law or agreed to in writing, software
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * distributed under the License is distributed on an "AS IS" BASIS,
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * See the License for the specific language governing permissions and
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering * limitations under the License.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek#include "http_core.h" /* for get_remote_host */
9393a8774c1acd60deea40007061b9ffc783bf7eLennart Poettering#include <sys/processor.h> /* for bindprocessor() */
14f01575e8efba8709f456e234514ec980516381Felipe Sateler/* Limit on the total --- clients will be locked out if more servers than
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * this are needed. It is intended solely to keep the server from crashing
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * when things get out of hand.
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * We keep a hard maximum number of servers, for two reasons --- first off,
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * in case something goes seriously wrong, we want to stop the fork bomb
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * short of actually crashing the machine we're running on by filling some
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * kernel table. Secondly, it keeps the size of the scoreboard file small
3ba3a79df4ae094d1008c04a9af8d1ff970124c4Zbigniew Jędrzejewski-Szmek * enough that we can read the whole thing without worrying too much about
14f01575e8efba8709f456e234514ec980516381Felipe Sateler/* Admin can't tune ServerLimit beyond MAX_SERVER_LIMIT. We want
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * some sort of compile-time limit to help catch typos.
14f01575e8efba8709f456e234514ec980516381Felipe Sateler/* Limit on the threads per process. Clients will be locked out if more than
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * this are needed.
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * We keep this for one reason it keeps the size of the scoreboard file small
14f01575e8efba8709f456e234514ec980516381Felipe Sateler * enough that we can read the whole thing without worrying too much about
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek/* Admin can't tune ThreadLimit beyond MAX_THREAD_LIMIT. We want
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * some sort of compile-time limit to help catch typos.
struct motorz_core_t {
int first_server_limit;
int module_loads;
int maxclients_reported;
int max_daemons_limit;
struct motorz_child_bucket {
struct motorz_sb_t
void *baton;
struct motorz_timer_t
void *baton;
struct motorz_conn_t
conn_rec *c;
static int threads_per_child = 0;
static int ap_num_kids=0;
static int ap_daemons_min_free=0;
static int ap_daemons_max_free=0;
static int server_limit = 0;
static int one_process = 0;
static int my_child_num;