scoreboard.c revision ef7bef3137b6efe36e9269fb15d3e031ad674870
/* ====================================================================
* 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 "apr_strings.h"
#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 "scoreboard.h"
#include "mpm.h" /* for ap_max_daemons_limit */
#ifdef HAVE_SYS_TYPES_H
#endif
/*****************************************************************
*
* 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"
apr_status_t ap_cleanup_shared_mem(void *d)
{
return APR_SUCCESS;
}
static void setup_shared_mem(apr_pool_t *p)
{
char buf[512];
const char *fname;
}
if (ap_scoreboard_image == NULL) {
}
}
void reinit_scoreboard(apr_pool_t *p)
{
if (ap_scoreboard_image == NULL) {
setup_shared_mem(p);
}
}
#endif /* APR_SHARED_MEM */
/****
* Above code is shmem code. Below code is interacting with the shmem
****/
static int maintain_connection_status = 1;
void ap_perchild_set_maintain_connection_status(int flag) {
return;
}
/* Useful to erase the status of children that might be from previous
* generations */
void ap_perchild_force_reset_connection_status(long conn_id)
{
int i;
for (i = 0; i < STATUSES_PER_CONNECTION; i++) {
}
}
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 "";
while (i < STATUSES_PER_CONNECTION) {
break;
}
}
}
return NULL;
}
{
int i;
long *array_slot;
connection_list = apr_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 < ap_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) {
break;
}
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;
/* 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 < ap_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;
}