scoreboard.c revision f45b17d6bf6de6acf28b35f222d4c590703258ac
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 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 "ap_config.h"
#include "httpd.h"
#include "http_log.h"
#include "http_main.h"
#include "http_core.h"
#include "http_config.h"
#include "unixd.h"
#include "http_conf_globals.h"
#include "mpm_status.h"
#include "mpmt_pthread.h"
#include "scoreboard.h"
static int maintain_connection_status = 1;
/*****************************************************************
*
* Dealing with the scoreboard... a lot of these variables are global
* only to avoid getting clobbered by the longjmp() that happens when
* a hard timeout expires...
*
* We begin with routines which deal with the file itself...
*/
#include "apr_shmem.h"
static ap_status_t cleanup_shared_mem(void *d)
{
}
static void setup_shared_mem(ap_context_t *p)
{
char buf[512];
const char *fname;
if (ap_shm_init(&scoreboard_shm, SCOREBOARD_SIZE + NEW_SCOREBOARD_SIZE + 40, fname, p) != APR_SUCCESS) {
}
}
}
void reopen_scoreboard(ap_context_t *p)
{
}
#endif /* APR_SHARED_MEM */
/* Called by parent process */
void reinit_scoreboard(ap_context_t *p)
{
int running_gen = 0;
if (ap_scoreboard_image)
if (ap_scoreboard_image == NULL) {
setup_shared_mem(p);
}
}
/* 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.
*/
ap_inline void ap_sync_scoreboard_image(void)
{
}
API_EXPORT(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
}
{
long int bs = 0;
if (r->sent_bodyct)
#ifdef HAVE_TIMES
#endif
ss->access_count++;
ss->my_access_count++;
ss->conn_count++;
}
{
int i;
int max_daemons_limit = ap_get_max_daemons();
for (i = 0; i < max_daemons_limit; ++i)
return i;
return -1;
}
{
int old_status;
if (child_num < 0)
return -1;
&& old_status == SERVER_STARTING) {
}
if (ap_extended_status) {
/*
* Reset individual counters
*/
if (status == SERVER_DEAD) {
ss->my_access_count = 0L;
ss->my_bytes_served = 0L;
}
ss->conn_count = (unsigned short) 0;
ss->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) {
/*ss->start_time = GetCurrentTime(); return time in uS since the
epoch. Some platforms do not support gettimeofday. Create a routine
to get the current time is some useful units. */
}
}
else if (status == STOP_PREQUEST) {
/*ss->stop_time = GetCurrentTime();
return time in uS since the epoch */
}
}
}
/* Useful to erase the status of children that might be from previous
* generations */
{
int i;
for (i = 0; i < STATUSES_PER_CONNECTION; i++) { ap_new_scoreboard_image->table[conn_id][i].key[0] = '\0';
} }
void ap_reset_connection_status(long conn_id)
{
if (maintain_connection_status) {
}
}
/* Don't mess with the string you get back from this function */
{
int i = 0;
if (!maintain_connection_status) return "";
}
}
}
return NULL;
}
{
int i;
long *array_slot;
int max_daemons_limit = ap_get_max_daemons();
connection_list = ap_make_array(p, 0, sizeof(long));
/* We assume that there is a connection iff it has an entry in the status
* table. Connections without any status sound problematic to me, so this
* is probably for the best. - manoj */
for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) {
*array_slot = i;
}
}
return connection_list;
}
{
int i = 0;
char **array_slot;
while (i < STATUSES_PER_CONNECTION) {
break;
}
i++;
}
return key_list;
}
/* Note: no effort is made here to prevent multiple threads from messing with
* a single connection at the same time. ap_update_connection_status should
* only be called by the thread that owns the connection */
const char *value)
{
int i = 0;
if (!maintain_connection_status) return;
while (i < STATUSES_PER_CONNECTION) {
return;
}
i++;
}
/* Not found. Add an entry for this value */
if (i >= STATUSES_PER_CONNECTION) {
/* No room. Oh well, not much anyone can do about it. */
return;
}
return;
}
{
int i, j;
int max_daemons_limit = ap_get_max_daemons();
/* Go ahead and return what's in the connection status table even if we
* aren't maintaining it. We can at least look at what children from
* previous generations are up to. */
for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) {
continue;
array_slot->conn_id = i;
for (j = 0; j < STATUSES_PER_CONNECTION; j++) {
}
else {
break;
}
}
}
return server_status;
}