scoreboard.c revision da885f8529a499c96c4489ae7d03762b97da5394
6ae232055d4d8a97267517c5e50074c2c819941and/* ====================================================================
6ae232055d4d8a97267517c5e50074c2c819941and * The Apache Software License, Version 1.1
6ae232055d4d8a97267517c5e50074c2c819941and * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
6ae232055d4d8a97267517c5e50074c2c819941and * reserved.
6ae232055d4d8a97267517c5e50074c2c819941and * Redistribution and use in source and binary forms, with or without
6ae232055d4d8a97267517c5e50074c2c819941and * modification, are permitted provided that the following conditions
6ae232055d4d8a97267517c5e50074c2c819941and * are met:
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * 1. Redistributions of source code must retain the above copyright
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * notice, this list of conditions and the following disclaimer.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * 2. Redistributions in binary form must reproduce the above copyright
6ae232055d4d8a97267517c5e50074c2c819941and * notice, this list of conditions and the following disclaimer in
6ae232055d4d8a97267517c5e50074c2c819941and * the documentation and/or other materials provided with the
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen * distribution.
6ae232055d4d8a97267517c5e50074c2c819941and * 3. The end-user documentation included with the redistribution,
6ae232055d4d8a97267517c5e50074c2c819941and * if any, must include the following acknowledgment:
6ae232055d4d8a97267517c5e50074c2c819941and * "This product includes software developed by the
b43f840409794ed298e8634f6284741f193b6c4ftakashi * Apache Software Foundation (http://www.apache.org/)."
6ae232055d4d8a97267517c5e50074c2c819941and * Alternately, this acknowledgment may appear in the software itself,
b43f840409794ed298e8634f6284741f193b6c4ftakashi * if and wherever such third-party acknowledgments normally appear.
6ae232055d4d8a97267517c5e50074c2c819941and * 4. The names "Apache" and "Apache Software Foundation" must
4b3a8afbfcea8b265d179a122bf40dfedd1ce280takashi * not be used to endorse or promote products derived from this
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung * software without prior written permission. For written
6ae232055d4d8a97267517c5e50074c2c819941and * permission, please contact apache@apache.org.
b43f840409794ed298e8634f6284741f193b6c4ftakashi * 5. Products derived from this software may not be called "Apache",
b43f840409794ed298e8634f6284741f193b6c4ftakashi * nor may "Apache" appear in their name, without prior written
b43f840409794ed298e8634f6284741f193b6c4ftakashi * permission of the Apache Software Foundation.
6ae232055d4d8a97267517c5e50074c2c819941and * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
6ae232055d4d8a97267517c5e50074c2c819941and * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
6ae232055d4d8a97267517c5e50074c2c819941and * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
6ae232055d4d8a97267517c5e50074c2c819941and * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
6ae232055d4d8a97267517c5e50074c2c819941and * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
6ae232055d4d8a97267517c5e50074c2c819941and * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
6ae232055d4d8a97267517c5e50074c2c819941and * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
6ae232055d4d8a97267517c5e50074c2c819941and * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
6ae232055d4d8a97267517c5e50074c2c819941and * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
6ae232055d4d8a97267517c5e50074c2c819941and * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
6ae232055d4d8a97267517c5e50074c2c819941and * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
6ae232055d4d8a97267517c5e50074c2c819941and * SUCH DAMAGE.
6ae232055d4d8a97267517c5e50074c2c819941and * ====================================================================
6ae232055d4d8a97267517c5e50074c2c819941and * This software consists of voluntary contributions made by many
6ae232055d4d8a97267517c5e50074c2c819941and * individuals on behalf of the Apache Software Foundation. For more
6ae232055d4d8a97267517c5e50074c2c819941and * information on the Apache Software Foundation, please see
6ae232055d4d8a97267517c5e50074c2c819941and * Portions of this software are based upon public domain software
6ae232055d4d8a97267517c5e50074c2c819941and * originally written at the National Center for Supercomputing Applications,
6ae232055d4d8a97267517c5e50074c2c819941and * University of Illinois, Urbana-Champaign.
6ae232055d4d8a97267517c5e50074c2c819941andtypedef struct sb_handle {
6ae232055d4d8a97267517c5e50074c2c819941and * This function should be renamed to cleanup_shared
6ae232055d4d8a97267517c5e50074c2c819941and * and it should handle cleaning up a scoreboard shared
6ae232055d4d8a97267517c5e50074c2c819941and * between processes using any form of IPC (file, shared memory
6ae232055d4d8a97267517c5e50074c2c819941and * segment, etc.). Leave it as is now because it is being used
6ae232055d4d8a97267517c5e50074c2c819941and * by various MPMs.
b43f840409794ed298e8634f6284741f193b6c4ftakashistatic void calc_scoreboard_size(void)
4b3a8afbfcea8b265d179a122bf40dfedd1ce280takashi ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit);
727872d18412fc021f03969b8641810d8896820bhumbedooh scoreboard_size += sizeof(process_score) * server_limit;
0d0ba3a410038e179b695446bb149cce6264e0abnd scoreboard_size += sizeof(worker_score * ) * server_limit;
727872d18412fc021f03969b8641810d8896820bhumbedooh scoreboard_size += sizeof(worker_score) * server_limit * thread_limit;
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohstatic void init_scoreboard(void)
0d0ba3a410038e179b695446bb149cce6264e0abnd ap_scoreboard_image->parent = (process_score *)more_storage;
727872d18412fc021f03969b8641810d8896820bhumbedooh ap_scoreboard_image->servers = (worker_score **)more_storage;
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh for (i = 0; i < server_limit; i++) {
b43f840409794ed298e8634f6284741f193b6c4ftakashi ap_scoreboard_image->servers[i] = (worker_score *)more_storage;
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd ap_assert(more_storage == (char *)ap_scoreboard_image + scoreboard_size);
6ae232055d4d8a97267517c5e50074c2c819941and/* ToDo: This function should be made to handle setting up
const char *fname;
return APR_SUCCESS;
return APR_SUCCESS;
int running_gen = 0;
if (ap_scoreboard_image)
setup_shared(p);
void ap_sync_scoreboard_image(void)
#ifdef SCOREBOARD_FILE
void update_scoreboard_global(void)
#ifdef SCOREBOARD_FILE
#ifdef HAVE_TIMES
int max_daemons_limit;
for (i = 0; i < max_daemons_limit; ++i)
int old_status, i;
if (child_num < 0)
for (i = 0; i < thread_limit; i++) {
if (ap_extended_status) {
return old_status;
status, r);
if (child_num < 0)
if (((x < 0) || (server_limit < x)) ||
((y < 0) || (thread_limit < y))) {
if ((x < 0) || (server_limit < x)) {