scoreboard.c revision 36b0d7bc1117c55c6891ad74a2210a817eb12234
0ad489b182ebb3789322345e22cf750f88ae167and/* ====================================================================
0ad489b182ebb3789322345e22cf750f88ae167and * The Apache Software License, Version 1.1
15b0d99a66145e797cbe368bff5e44d5653be5e5nd * Copyright (c) 2000 The Apache Software Foundation. All rights
0ad489b182ebb3789322345e22cf750f88ae167and * reserved.
031b91a62d25106ae69d4693475c79618dd5e884fielding * Redistribution and use in source and binary forms, with or without
031b91a62d25106ae69d4693475c79618dd5e884fielding * modification, are permitted provided that the following conditions
031b91a62d25106ae69d4693475c79618dd5e884fielding * 1. Redistributions of source code must retain the above copyright
031b91a62d25106ae69d4693475c79618dd5e884fielding * notice, this list of conditions and the following disclaimer.
0ad489b182ebb3789322345e22cf750f88ae167and * 2. Redistributions in binary form must reproduce the above copyright
0ad489b182ebb3789322345e22cf750f88ae167and * notice, this list of conditions and the following disclaimer in
0ad489b182ebb3789322345e22cf750f88ae167and * the documentation and/or other materials provided with the
0ad489b182ebb3789322345e22cf750f88ae167and * distribution.
0ad489b182ebb3789322345e22cf750f88ae167and * 3. The end-user documentation included with the redistribution,
0ad489b182ebb3789322345e22cf750f88ae167and * if any, must include the following acknowledgment:
0ad489b182ebb3789322345e22cf750f88ae167and * "This product includes software developed by the
0ad489b182ebb3789322345e22cf750f88ae167and * Apache Software Foundation (http://www.apache.org/)."
0ad489b182ebb3789322345e22cf750f88ae167and * Alternately, this acknowledgment may appear in the software itself,
0ad489b182ebb3789322345e22cf750f88ae167and * if and wherever such third-party acknowledgments normally appear.
0ad489b182ebb3789322345e22cf750f88ae167and * 4. The names "Apache" and "Apache Software Foundation" must
0ad489b182ebb3789322345e22cf750f88ae167and * not be used to endorse or promote products derived from this
0ad489b182ebb3789322345e22cf750f88ae167and * software without prior written permission. For written
0ad489b182ebb3789322345e22cf750f88ae167and * permission, please contact apache@apache.org.
0ad489b182ebb3789322345e22cf750f88ae167and * 5. Products derived from this software may not be called "Apache",
0ad489b182ebb3789322345e22cf750f88ae167and * nor may "Apache" appear in their name, without prior written
0ad489b182ebb3789322345e22cf750f88ae167and * permission of the Apache Software Foundation.
0ad489b182ebb3789322345e22cf750f88ae167and * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
0ad489b182ebb3789322345e22cf750f88ae167and * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0ad489b182ebb3789322345e22cf750f88ae167and * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0ad489b182ebb3789322345e22cf750f88ae167and * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
0ad489b182ebb3789322345e22cf750f88ae167and * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0ad489b182ebb3789322345e22cf750f88ae167and * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0ad489b182ebb3789322345e22cf750f88ae167and * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
0ad489b182ebb3789322345e22cf750f88ae167and * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0ad489b182ebb3789322345e22cf750f88ae167and * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0ad489b182ebb3789322345e22cf750f88ae167and * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
0ad489b182ebb3789322345e22cf750f88ae167and * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0ad489b182ebb3789322345e22cf750f88ae167and * SUCH DAMAGE.
0ad489b182ebb3789322345e22cf750f88ae167and * ====================================================================
0ad489b182ebb3789322345e22cf750f88ae167and * This software consists of voluntary contributions made by many
0ad489b182ebb3789322345e22cf750f88ae167and * individuals on behalf of the Apache Software Foundation. For more
0ad489b182ebb3789322345e22cf750f88ae167and * information on the Apache Software Foundation, please see
0ad489b182ebb3789322345e22cf750f88ae167and * Portions of this software are based upon public domain software
0ad489b182ebb3789322345e22cf750f88ae167and * originally written at the National Center for Supercomputing Applications,
0ad489b182ebb3789322345e22cf750f88ae167and * University of Illinois, Urbana-Champaign.
0ad489b182ebb3789322345e22cf750f88ae167and/* ToDo: Fix this right */
0ad489b182ebb3789322345e22cf750f88ae167and * This function should be renamed to cleanup_shared
0ad489b182ebb3789322345e22cf750f88ae167and * and it should handle cleaning up a scoreboard shared
0ad489b182ebb3789322345e22cf750f88ae167and * between processes using any form of IPC (file, shared memory
0ad489b182ebb3789322345e22cf750f88ae167and * segment, etc.). Leave it as is now because it is being used
0ad489b182ebb3789322345e22cf750f88ae167and * by various MPMs.
0ad489b182ebb3789322345e22cf750f88ae167and/* ToDo: This function should be made to handle setting up
0ad489b182ebb3789322345e22cf750f88ae167and * a scoreboard shared between processes using any IPC technique,
0ad489b182ebb3789322345e22cf750f88ae167and * not just a shared memory segment
0ad489b182ebb3789322345e22cf750f88ae167and const char *fname;
0ad489b182ebb3789322345e22cf750f88ae167and rv = apr_shm_init(&scoreboard_shm, SCOREBOARD_SIZE, fname, p);
0ad489b182ebb3789322345e22cf750f88ae167and apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: %s",
0ad489b182ebb3789322345e22cf750f88ae167and ap_server_argv0, apr_strerror(rv, errmsg, sizeof errmsg));
0ad489b182ebb3789322345e22cf750f88ae167and ap_scoreboard_image = apr_shm_malloc(scoreboard_shm, SCOREBOARD_SIZE);
0ad489b182ebb3789322345e22cf750f88ae167and apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard",
0ad489b182ebb3789322345e22cf750f88ae167and/* ap_cleanup_scoreboard
0ad489b182ebb3789322345e22cf750f88ae167andstatic void ap_cleanup_scoreboard(void *d) {
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
for (i = 0; i < max_daemons_limit; ++i)
int old_status;
if (child_num < 0)
if (ap_extended_status) {
return old_status;
if (child_num < 0)