scoreboard.c revision ab5dc1422ca0de9fdbfe827a0610b43512f47327
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
*
* Portions of this software are based upon public domain software
* originally written at the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
*/
#include "apr.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include "apr_lib.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#endif
#include "ap_config.h"
#include "httpd.h"
#include "http_log.h"
#include "http_main.h"
#include "http_core.h"
#include "http_config.h"
#include "ap_mpm.h"
#include "mpm.h"
#include "scoreboard.h"
AP_DECLARE_DATA int ap_extended_status = 0;
#include "apr_shmem.h"
#endif
)
(p, sb_type))
/*
* ToDo:
* This function should be renamed to cleanup_shared
* and it should handle cleaning up a scoreboard shared
* between processes using any form of IPC (file, shared memory
* segment, etc.). Leave it as is now because it is being used
* by various MPMs.
*/
static apr_status_t ap_cleanup_shared_mem(void *d)
{
#endif
return APR_SUCCESS;
}
/* ToDo: This function should be made to handle setting up
* a scoreboard shared between processes using any IPC technique,
* not just a shared memory segment
*/
static void setup_shared(apr_pool_t *p)
{
char buf[512];
char errmsg[120];
const char *fname;
if (rv != APR_SUCCESS) {
}
if (ap_scoreboard_image == NULL) {
}
#endif
}
{
}
/* ap_cleanup_scoreboard
*
*/
apr_status_t ap_cleanup_scoreboard(void *d) {
if (ap_scoreboard_image == NULL)
return APR_SUCCESS;
}
else {
}
return APR_SUCCESS;
}
/* ap_create_scoreboard(apr_pool_t*, ap_scoreboard_e t)
*
* Create or reinit an existing scoreboard. The MPM can control whether
* the scoreboard is shared across multiple processes or not
*
* ###: Is there any reason to export this symbol in the first place?
*/
{
int running_gen = 0;
if (ap_scoreboard_image)
if (ap_scoreboard_image == NULL) {
setup_shared(p);
}
else {
/* A simple malloc will suffice */
char buf[512];
if (ap_scoreboard_image == NULL) {
}
}
}
}
/* Routines called to deal with the scoreboard image
* --- note that we do *not* need write locks, since update_child_status
* only updates a *single* record in place, and only one process writes to
* a given scoreboard slot at a time (either the child process owning that
* slot, or the parent, noting that the child has died).
*
* As a final note --- setting the score entry to getpid() is always safe,
* since when the parent is writing an entry, it's only noting SERVER_DEAD
* anyway.
*/
void ap_sync_scoreboard_image(void)
{
}
AP_DECLARE(int) ap_exists_scoreboard_image(void)
{
return (ap_scoreboard_image ? 1 : 0);
}
{
/* XXX - needs to be fixed to account for threads */
#ifdef SCOREBOARD_FILE
#endif
}
void update_scoreboard_global(void)
{
#ifdef SCOREBOARD_FILE
sizeof ap_scoreboard_image->global);
#endif
}
{
#ifdef HAVE_TIMES
#endif
ws->access_count++;
ws->my_access_count++;
ws->conn_count++;
}
{
int i;
int max_daemons_limit;
for (i = 0; i < max_daemons_limit; ++i)
return i;
return -1;
}
{
int old_status;
if (child_num < 0)
return -1;
if (status == SERVER_READY
&& old_status == SERVER_STARTING) {
}
if (ap_extended_status) {
/*
* Reset individual counters
*/
if (status == SERVER_DEAD) {
ws->my_access_count = 0L;
ws->my_bytes_served = 0L;
}
ws->conn_count = (unsigned short) 0;
ws->conn_bytes = (unsigned long) 0;
}
if (r) {
conn_rec *c = r->connection;
if (r->the_request == NULL) {
} else {
/* Don't reveal the password in the server-status view */
}
}
}
return old_status;
}
{
if (child_num < 0)
return;
if (status == START_PREQUEST) {
}
else if (status == STOP_PREQUEST) {
}
}
worker_score *ap_get_servers_scoreboard(int x, int y)
{
if (((x < 0) || (HARD_SERVER_LIMIT < x)) ||
((y < 0) || (HARD_THREAD_LIMIT < y))) {
return(NULL); /* Out of range */
}
return(&ap_scoreboard_image->servers[x][y]);
}
{
if ((x < 0) || (HARD_SERVER_LIMIT < x)) {
return(NULL); /* Out of range */
}
return(&ap_scoreboard_image->parent[x]);
}