mod_status.c revision 24b534291150023e6b68eca89ddd33e475ccddc0
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/* ====================================================================
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * The Apache Software License, Version 1.1
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding *
b99dbaab171d91e1b664397cc40e039d0c087c65fielding * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * reserved.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Redistribution and use in source and binary forms, with or without
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * modification, are permitted provided that the following conditions
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * are met:
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * 1. Redistributions of source code must retain the above copyright
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * notice, this list of conditions and the following disclaimer.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * 2. Redistributions in binary form must reproduce the above copyright
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * notice, this list of conditions and the following disclaimer in
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * the documentation and/or other materials provided with the
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * distribution.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * 3. The end-user documentation included with the redistribution,
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * if any, must include the following acknowledgment:
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * "This product includes software developed by the
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * Apache Software Foundation (http://www.apache.org/)."
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * Alternately, this acknowledgment may appear in the software itself,
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * if and wherever such third-party acknowledgments normally appear.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * 4. The names "Apache" and "Apache Software Foundation" must
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * not be used to endorse or promote products derived from this
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * software without prior written permission. For written
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * permission, please contact apache@apache.org.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * 5. Products derived from this software may not be called "Apache",
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * nor may "Apache" appear in their name, without prior written
64185f9824e42f21ca7b9ae6c004484215c031a7rbb * permission of the Apache Software Foundation.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * SUCH DAMAGE.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * ====================================================================
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * This software consists of voluntary contributions made by many
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * individuals on behalf of the Apache Software Foundation. For more
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * information on the Apache Software Foundation, please see
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * <http://www.apache.org/>.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding *
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * Portions of this software are based upon public domain software
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * originally written at the National Center for Supercomputing Applications,
ab2c1c1c83ec91415565da5a71fbc15d9685caa6fielding * University of Illinois, Urbana-Champaign.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
3568de757bac0b47256647504c186d17ca272f85rbb/* Status Module. Display lots of internal data about how Apache is
3568de757bac0b47256647504c186d17ca272f85rbb * performing and the state of all children processes.
3568de757bac0b47256647504c186d17ca272f85rbb *
3568de757bac0b47256647504c186d17ca272f85rbb * To enable this, add the following lines into any config file:
3568de757bac0b47256647504c186d17ca272f85rbb *
3568de757bac0b47256647504c186d17ca272f85rbb * <Location /server-status>
3568de757bac0b47256647504c186d17ca272f85rbb * SetHandler server-status
3568de757bac0b47256647504c186d17ca272f85rbb * </Location>
3568de757bac0b47256647504c186d17ca272f85rbb *
3568de757bac0b47256647504c186d17ca272f85rbb * You may want to protect this location by password or domain so no one
3568de757bac0b47256647504c186d17ca272f85rbb * else can look at it. Then you can access the statistics with a URL like:
3568de757bac0b47256647504c186d17ca272f85rbb *
3568de757bac0b47256647504c186d17ca272f85rbb * http://your_server_name/server-status
3568de757bac0b47256647504c186d17ca272f85rbb *
3568de757bac0b47256647504c186d17ca272f85rbb * /server-status - Returns page using tables
3568de757bac0b47256647504c186d17ca272f85rbb * /server-status?notable - Returns page for browsers without table support
3568de757bac0b47256647504c186d17ca272f85rbb * /server-status?refresh - Returns page with 1 second refresh
3568de757bac0b47256647504c186d17ca272f85rbb * /server-status?refresh=6 - Returns page with refresh every 6 seconds
3568de757bac0b47256647504c186d17ca272f85rbb * /server-status?auto - Returns page with data for automatic parsing
3568de757bac0b47256647504c186d17ca272f85rbb *
3568de757bac0b47256647504c186d17ca272f85rbb * Mark Cox, mark@ukweb.com, November 1995
3568de757bac0b47256647504c186d17ca272f85rbb *
3568de757bac0b47256647504c186d17ca272f85rbb * 12.11.95 Initial version for www.telescope.org
3568de757bac0b47256647504c186d17ca272f85rbb * 13.3.96 Updated to remove rprintf's [Mark]
3568de757bac0b47256647504c186d17ca272f85rbb * 18.3.96 Added CPU usage, process information, and tidied [Ben Laurie]
3568de757bac0b47256647504c186d17ca272f85rbb * 18.3.96 Make extra Scoreboard variables #definable
3568de757bac0b47256647504c186d17ca272f85rbb * 25.3.96 Make short report have full precision [Ben Laurie suggested]
3568de757bac0b47256647504c186d17ca272f85rbb * 25.3.96 Show uptime better [Mark/Ben Laurie]
3568de757bac0b47256647504c186d17ca272f85rbb * 29.3.96 Better HTML and explanation [Mark/Rob Hartill suggested]
3568de757bac0b47256647504c186d17ca272f85rbb * 09.4.96 Added message for non-STATUS compiled version
3568de757bac0b47256647504c186d17ca272f85rbb * 18.4.96 Added per child and per slot counters [Jim Jagielski]
3568de757bac0b47256647504c186d17ca272f85rbb * 01.5.96 Table format, cleanup, even more spiffy data [Chuck Murcko/Jim J.]
3568de757bac0b47256647504c186d17ca272f85rbb * 18.5.96 Adapted to use new rprintf() routine, incidentally fixing a missing
3568de757bac0b47256647504c186d17ca272f85rbb * piece in short reports [Ben Laurie]
3568de757bac0b47256647504c186d17ca272f85rbb * 21.5.96 Additional Status codes (DNS and LOGGING only enabled if
3568de757bac0b47256647504c186d17ca272f85rbb * extended STATUS is enabled) [George Burgyan/Jim J.]
3568de757bac0b47256647504c186d17ca272f85rbb * 10.8.98 Allow for extended status info at runtime (no more STATUS)
3568de757bac0b47256647504c186d17ca272f85rbb * [Jim J.]
3568de757bac0b47256647504c186d17ca272f85rbb */
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb#define CORE_PRIVATE
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "httpd.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_config.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_core.h"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#include "http_protocol.h"
3568de757bac0b47256647504c186d17ca272f85rbb#include "http_main.h"
3568de757bac0b47256647504c186d17ca272f85rbb#include "util_script.h"
3568de757bac0b47256647504c186d17ca272f85rbb#include <time.h>
3568de757bac0b47256647504c186d17ca272f85rbb#include "scoreboard.h"
3568de757bac0b47256647504c186d17ca272f85rbb#include "http_log.h"
db12cd62083041bf90945eeb90cc40fbd2340797trawick#if APR_HAVE_UNISTD_H
db12cd62083041bf90945eeb90cc40fbd2340797trawick#include <unistd.h>
db12cd62083041bf90945eeb90cc40fbd2340797trawick#endif
333eac96e4fb7d6901cb75e6ca7bb22b2ccb84cetrawick#define APR_WANT_STRFUNC
333eac96e4fb7d6901cb75e6ca7bb22b2ccb84cetrawick#include "apr_want.h"
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb#ifdef NEXT
3568de757bac0b47256647504c186d17ca272f85rbb#if (NX_CURRENT_COMPILER_RELEASE == 410)
3568de757bac0b47256647504c186d17ca272f85rbb#ifdef m68k
3568de757bac0b47256647504c186d17ca272f85rbb#define HZ 64
3568de757bac0b47256647504c186d17ca272f85rbb#else
3568de757bac0b47256647504c186d17ca272f85rbb#define HZ 100
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb#else
3568de757bac0b47256647504c186d17ca272f85rbb#include <machine/param.h>
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb#endif /* NEXT */
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb#define STATUS_MAXLINE 64
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb#define KBYTE 1024
3568de757bac0b47256647504c186d17ca272f85rbb#define MBYTE 1048576L
3568de757bac0b47256647504c186d17ca272f85rbb#define GBYTE 1073741824L
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#ifndef DEFAULT_TIME_FORMAT
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#define DEFAULT_TIME_FORMAT "%A, %d-%b-%Y %H:%M:%S %Z"
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding#endif
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
8f3ec4772d2aeb347cf40e87c77627bb784dd018rbb#define STATUS_MAGIC_TYPE "application/x-httpd-status"
8f3ec4772d2aeb347cf40e87c77627bb784dd018rbb
3d96ee83babeec32482c9082c9426340cee8c44dwrowemodule AP_MODULE_DECLARE_DATA status_module;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
3568de757bac0b47256647504c186d17ca272f85rbb/*
3568de757bac0b47256647504c186d17ca272f85rbb *command-related code. This is here to prevent use of ExtendedStatus
3568de757bac0b47256647504c186d17ca272f85rbb * without status_module included.
3568de757bac0b47256647504c186d17ca272f85rbb */
3568de757bac0b47256647504c186d17ca272f85rbbstatic const char *set_extended_status(cmd_parms *cmd, void *dummy, int arg)
3568de757bac0b47256647504c186d17ca272f85rbb{
3568de757bac0b47256647504c186d17ca272f85rbb const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
3568de757bac0b47256647504c186d17ca272f85rbb if (err != NULL) {
3568de757bac0b47256647504c186d17ca272f85rbb return err;
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb ap_extended_status = arg;
3568de757bac0b47256647504c186d17ca272f85rbb return NULL;
3568de757bac0b47256647504c186d17ca272f85rbb}
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbbstatic const command_rec status_module_cmds[] =
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding{
3568de757bac0b47256647504c186d17ca272f85rbb AP_INIT_FLAG("ExtendedStatus", set_extended_status, NULL, RSRC_CONF,
3568de757bac0b47256647504c186d17ca272f85rbb "\"On\" to enable extended status information, \"Off\" to disable"),
3568de757bac0b47256647504c186d17ca272f85rbb {NULL}
3568de757bac0b47256647504c186d17ca272f85rbb};
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb/* Format the number of bytes nicely */
3568de757bac0b47256647504c186d17ca272f85rbbstatic void format_byte_out(request_rec *r, unsigned long bytes)
3568de757bac0b47256647504c186d17ca272f85rbb{
3568de757bac0b47256647504c186d17ca272f85rbb if (bytes < (5 * KBYTE))
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "%d B", (int) bytes);
3568de757bac0b47256647504c186d17ca272f85rbb else if (bytes < (MBYTE / 2))
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "%.1f kB", (float) bytes / KBYTE);
3568de757bac0b47256647504c186d17ca272f85rbb else if (bytes < (GBYTE / 2))
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "%.1f MB", (float) bytes / MBYTE);
3568de757bac0b47256647504c186d17ca272f85rbb else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "%.1f GB", (float) bytes / GBYTE);
3568de757bac0b47256647504c186d17ca272f85rbb}
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
3568de757bac0b47256647504c186d17ca272f85rbbstatic void format_kbyte_out(request_rec *r, unsigned long kbytes)
3568de757bac0b47256647504c186d17ca272f85rbb{
3568de757bac0b47256647504c186d17ca272f85rbb if (kbytes < KBYTE)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "%d kB", (int) kbytes);
3568de757bac0b47256647504c186d17ca272f85rbb else if (kbytes < MBYTE)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "%.1f MB", (float) kbytes / KBYTE);
3568de757bac0b47256647504c186d17ca272f85rbb else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "%.1f GB", (float) kbytes / MBYTE);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding}
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
78ae889ffe0fdfab72f56c6993b0f302cb48da55rbbstatic void show_time(request_rec *r, apr_interval_time_t tsecs)
3568de757bac0b47256647504c186d17ca272f85rbb{
fc1efab92032301e317f07e1b3a00082d9d71f3frbb int days, hrs, mins, secs;
0375f54d32af9c27de0006956d9f85d01b020351stoddard
24b534291150023e6b68eca89ddd33e475ccddc0wrowe secs = (int)(tsecs % 60);
3568de757bac0b47256647504c186d17ca272f85rbb tsecs /= 60;
24b534291150023e6b68eca89ddd33e475ccddc0wrowe mins = (int)(tsecs % 60);
3568de757bac0b47256647504c186d17ca272f85rbb tsecs /= 60;
24b534291150023e6b68eca89ddd33e475ccddc0wrowe hrs = (int)(tsecs % 24);
24b534291150023e6b68eca89ddd33e475ccddc0wrowe days = (int)(tsecs / 24);
3568de757bac0b47256647504c186d17ca272f85rbb if (days)
fc1efab92032301e317f07e1b3a00082d9d71f3frbb ap_rprintf(r, " %d day%s", days, days == 1 ? "" : "s");
3568de757bac0b47256647504c186d17ca272f85rbb if (hrs)
fc1efab92032301e317f07e1b3a00082d9d71f3frbb ap_rprintf(r, " %d hour%s", hrs, hrs == 1 ? "" : "s");
3568de757bac0b47256647504c186d17ca272f85rbb if (mins)
fc1efab92032301e317f07e1b3a00082d9d71f3frbb ap_rprintf(r, " %d minute%s", mins, mins == 1 ? "" : "s");
3568de757bac0b47256647504c186d17ca272f85rbb if (secs)
fc1efab92032301e317f07e1b3a00082d9d71f3frbb ap_rprintf(r, " %d second%s", secs, secs == 1 ? "" : "s");
3568de757bac0b47256647504c186d17ca272f85rbb}
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb/* Main handler for x-httpd-status requests */
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb/* ID values for command table */
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb#define STAT_OPT_END -1
3568de757bac0b47256647504c186d17ca272f85rbb#define STAT_OPT_REFRESH 0
3568de757bac0b47256647504c186d17ca272f85rbb#define STAT_OPT_NOTABLE 1
3568de757bac0b47256647504c186d17ca272f85rbb#define STAT_OPT_AUTO 2
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbbstruct stat_opt {
3568de757bac0b47256647504c186d17ca272f85rbb int id;
3568de757bac0b47256647504c186d17ca272f85rbb const char *form_data_str;
3568de757bac0b47256647504c186d17ca272f85rbb const char *hdr_out_str;
3568de757bac0b47256647504c186d17ca272f85rbb};
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbbstatic const struct stat_opt status_options[] = /* see #defines above */
3568de757bac0b47256647504c186d17ca272f85rbb{
3568de757bac0b47256647504c186d17ca272f85rbb {STAT_OPT_REFRESH, "refresh", "Refresh"},
3568de757bac0b47256647504c186d17ca272f85rbb {STAT_OPT_NOTABLE, "notable", NULL},
3568de757bac0b47256647504c186d17ca272f85rbb {STAT_OPT_AUTO, "auto", NULL},
3568de757bac0b47256647504c186d17ca272f85rbb {STAT_OPT_END, NULL, NULL}
3568de757bac0b47256647504c186d17ca272f85rbb};
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbbstatic char status_flags[SERVER_NUM_STATUS];
3568de757bac0b47256647504c186d17ca272f85rbb
0f081398cf0eef8cc7c66a535d450110a92dc8aefieldingstatic int status_handler(request_rec *r)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding{
3568de757bac0b47256647504c186d17ca272f85rbb const char *loc;
239f998fbee5ac5b114b965bb76e217cce0003edstoddard apr_time_t nowtime;
78ae889ffe0fdfab72f56c6993b0f302cb48da55rbb apr_interval_time_t up_time;
3568de757bac0b47256647504c186d17ca272f85rbb int j, i, res;
3568de757bac0b47256647504c186d17ca272f85rbb int ready = 0;
3568de757bac0b47256647504c186d17ca272f85rbb int busy = 0;
3568de757bac0b47256647504c186d17ca272f85rbb unsigned long count = 0;
3568de757bac0b47256647504c186d17ca272f85rbb unsigned long lres, bytes;
3568de757bac0b47256647504c186d17ca272f85rbb unsigned long my_lres, my_bytes, conn_bytes;
3568de757bac0b47256647504c186d17ca272f85rbb unsigned short conn_lres;
3568de757bac0b47256647504c186d17ca272f85rbb unsigned long bcount = 0;
3568de757bac0b47256647504c186d17ca272f85rbb unsigned long kbcount = 0;
3568de757bac0b47256647504c186d17ca272f85rbb long req_time;
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifdef HAVE_TIMES
3568de757bac0b47256647504c186d17ca272f85rbb#ifdef _SC_CLK_TCK
3568de757bac0b47256647504c186d17ca272f85rbb float tick = sysconf(_SC_CLK_TCK);
3568de757bac0b47256647504c186d17ca272f85rbb#else
3568de757bac0b47256647504c186d17ca272f85rbb float tick = HZ;
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb int short_report = 0;
3568de757bac0b47256647504c186d17ca272f85rbb int no_table_report = 0;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj worker_score ws_record;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj process_score ps_record;
3568de757bac0b47256647504c186d17ca272f85rbb char stat_buffer[HARD_SERVER_LIMIT * HARD_THREAD_LIMIT];
42b95445a3e9b563e716503b91df6b433f9fb29agregames pid_t pid_buffer[HARD_SERVER_LIMIT];
3568de757bac0b47256647504c186d17ca272f85rbb clock_t tu, ts, tcu, tcs;
3568de757bac0b47256647504c186d17ca272f85rbb server_rec *vhost;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
ca53a74f4012a45cbad48e940eddf27d866981f9dougm if (strcmp(r->handler, STATUS_MAGIC_TYPE) && strcmp(r->handler, "server-status")) {
ca53a74f4012a45cbad48e940eddf27d866981f9dougm return DECLINED;
ca53a74f4012a45cbad48e940eddf27d866981f9dougm }
ca53a74f4012a45cbad48e940eddf27d866981f9dougm
239f998fbee5ac5b114b965bb76e217cce0003edstoddard nowtime = apr_time_now();
3568de757bac0b47256647504c186d17ca272f85rbb tu = ts = tcu = tcs = 0;
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (!ap_exists_scoreboard_image()) {
3568de757bac0b47256647504c186d17ca272f85rbb ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r,
3568de757bac0b47256647504c186d17ca272f85rbb "Server status unavailable in inetd mode");
3568de757bac0b47256647504c186d17ca272f85rbb return HTTP_INTERNAL_SERVER_ERROR;
3568de757bac0b47256647504c186d17ca272f85rbb }
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding r->allowed = (1 << M_GET);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding if (r->method_number != M_GET)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding return DECLINED;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding r->content_type = "text/html";
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
3568de757bac0b47256647504c186d17ca272f85rbb /*
3568de757bac0b47256647504c186d17ca272f85rbb * Simple table-driven form data set parser that lets you alter the header
3568de757bac0b47256647504c186d17ca272f85rbb */
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (r->args) {
3568de757bac0b47256647504c186d17ca272f85rbb i = 0;
3568de757bac0b47256647504c186d17ca272f85rbb while (status_options[i].id != STAT_OPT_END) {
3568de757bac0b47256647504c186d17ca272f85rbb if ((loc = ap_strstr_c(r->args, status_options[i].form_data_str)) != NULL) {
3568de757bac0b47256647504c186d17ca272f85rbb switch (status_options[i].id) {
3568de757bac0b47256647504c186d17ca272f85rbb case STAT_OPT_REFRESH:
3568de757bac0b47256647504c186d17ca272f85rbb if (*(loc + strlen(status_options[i].form_data_str)) == '='
3568de757bac0b47256647504c186d17ca272f85rbb && atol(loc + strlen(status_options[i].form_data_str)
3568de757bac0b47256647504c186d17ca272f85rbb + 1) > 0)
3568de757bac0b47256647504c186d17ca272f85rbb apr_table_set(r->headers_out,
3568de757bac0b47256647504c186d17ca272f85rbb status_options[i].hdr_out_str,
3568de757bac0b47256647504c186d17ca272f85rbb loc + strlen(status_options[i].hdr_out_str) + 1);
3568de757bac0b47256647504c186d17ca272f85rbb else
3568de757bac0b47256647504c186d17ca272f85rbb apr_table_set(r->headers_out,
3568de757bac0b47256647504c186d17ca272f85rbb status_options[i].hdr_out_str, "1");
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case STAT_OPT_NOTABLE:
3568de757bac0b47256647504c186d17ca272f85rbb no_table_report = 1;
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case STAT_OPT_AUTO:
3568de757bac0b47256647504c186d17ca272f85rbb r->content_type = "text/plain";
3568de757bac0b47256647504c186d17ca272f85rbb short_report = 1;
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb i++;
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding if (r->header_only)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding return 0;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
5a58a10705b7b154b53294e0c0283d64eabdcb7fstoddard/* ap_sync_scoreboard_image(); */
3568de757bac0b47256647504c186d17ca272f85rbb for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
3568de757bac0b47256647504c186d17ca272f85rbb for (j = 0; j < HARD_THREAD_LIMIT; ++j) {
3568de757bac0b47256647504c186d17ca272f85rbb int indx = (i * HARD_THREAD_LIMIT) + j;
3568de757bac0b47256647504c186d17ca272f85rbb
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record = ap_scoreboard_image->servers[i][j];
3568de757bac0b47256647504c186d17ca272f85rbb ps_record = ap_scoreboard_image->parent[i];
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj res = ws_record.status;
3568de757bac0b47256647504c186d17ca272f85rbb stat_buffer[indx] = status_flags[res];
3568de757bac0b47256647504c186d17ca272f85rbb if (res == SERVER_READY)
3568de757bac0b47256647504c186d17ca272f85rbb ready++;
217bfe402837e5f978d351f3a3135118307b498dtrawick else if (res != SERVER_DEAD && res != SERVER_IDLE_KILL)
3568de757bac0b47256647504c186d17ca272f85rbb busy++;
3568de757bac0b47256647504c186d17ca272f85rbb if (ap_extended_status) {
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj lres = ws_record.access_count;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj bytes = ws_record.bytes_served;
3568de757bac0b47256647504c186d17ca272f85rbb if (lres != 0 || (res != SERVER_READY && res != SERVER_DEAD)) {
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifdef HAVE_TIMES
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj tu += ws_record.times.tms_utime;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ts += ws_record.times.tms_stime;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj tcu += ws_record.times.tms_cutime;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj tcs += ws_record.times.tms_cstime;
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#endif /* HAVE_TIMES */
3568de757bac0b47256647504c186d17ca272f85rbb count += lres;
3568de757bac0b47256647504c186d17ca272f85rbb bcount += bytes;
3568de757bac0b47256647504c186d17ca272f85rbb if (bcount >= KBYTE) {
3568de757bac0b47256647504c186d17ca272f85rbb kbcount += (bcount >> 10);
3568de757bac0b47256647504c186d17ca272f85rbb bcount = bcount & 0x3ff;
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb }
42b95445a3e9b563e716503b91df6b433f9fb29agregames pid_buffer[i] = ps_record.pid;
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
74fd6d9aeadb9022086259c5c1ae00bc0dda9c9astoddard /* up_time in seconds */
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick up_time = (apr_uint32_t) ((nowtime - ap_restart_time)/APR_USEC_PER_SEC);
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (!short_report) {
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs(DOCTYPE_HTML_3_2
3568de757bac0b47256647504c186d17ca272f85rbb "<HTML><HEAD>\n<TITLE>Apache Status</TITLE>\n</HEAD><BODY>\n",
3568de757bac0b47256647504c186d17ca272f85rbb r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<H1>Apache Server Status for ", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rvputs(r, ap_get_server_name(r), "</H1>\n\n", NULL);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rvputs(r, "Server Version: ",
3568de757bac0b47256647504c186d17ca272f85rbb ap_get_server_version(), "<br>\n", NULL);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rvputs(r, "Server Built: ",
3568de757bac0b47256647504c186d17ca272f85rbb ap_get_server_built(), "<br>\n<hr>\n", NULL);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rvputs(r, "Current Time: ",
3568de757bac0b47256647504c186d17ca272f85rbb ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), "<br>\n", NULL);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rvputs(r, "Restart Time: ",
3568de757bac0b47256647504c186d17ca272f85rbb ap_ht_time(r->pool, ap_restart_time, DEFAULT_TIME_FORMAT, 0),
3568de757bac0b47256647504c186d17ca272f85rbb "<br>\n", NULL);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "Parent Server Generation: %d <br>\n", (int) ap_my_generation);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("Server uptime: ", r);
3568de757bac0b47256647504c186d17ca272f85rbb show_time(r, up_time);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<br>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (ap_extended_status) {
3568de757bac0b47256647504c186d17ca272f85rbb if (short_report) {
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "Total Accesses: %lu\nTotal kBytes: %lu\n",
3568de757bac0b47256647504c186d17ca272f85rbb count, kbcount);
3568de757bac0b47256647504c186d17ca272f85rbb
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifdef HAVE_TIMES
3568de757bac0b47256647504c186d17ca272f85rbb /* Allow for OS/2 not having CPU stats */
3568de757bac0b47256647504c186d17ca272f85rbb if (ts || tu || tcu || tcs)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "CPULoad: %g\n",
3568de757bac0b47256647504c186d17ca272f85rbb (tu + ts + tcu + tcs) / tick / up_time * 100.);
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "Uptime: %ld\n", (long) (up_time));
3568de757bac0b47256647504c186d17ca272f85rbb if (up_time > 0)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "ReqPerSec: %g\n",
3568de757bac0b47256647504c186d17ca272f85rbb (float) count / (float) up_time);
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (up_time > 0)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "BytesPerSec: %g\n",
3568de757bac0b47256647504c186d17ca272f85rbb KBYTE * (float) kbcount / (float) up_time);
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (count > 0)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "BytesPerReq: %g\n",
3568de757bac0b47256647504c186d17ca272f85rbb KBYTE * (float) kbcount / (float) count);
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb else { /* !short_report */
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "Total accesses: %lu - Total Traffic: ", count);
3568de757bac0b47256647504c186d17ca272f85rbb format_kbyte_out(r, kbcount);
3568de757bac0b47256647504c186d17ca272f85rbb
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifdef HAVE_TIMES
3568de757bac0b47256647504c186d17ca272f85rbb /* Allow for OS/2 not having CPU stats */
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<br>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "CPU Usage: u%g s%g cu%g cs%g",
3568de757bac0b47256647504c186d17ca272f85rbb tu / tick, ts / tick, tcu / tick, tcs / tick);
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (ts || tu || tcu || tcs)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, " - %.3g%% CPU load",
3568de757bac0b47256647504c186d17ca272f85rbb (tu + ts + tcu + tcs) / tick / up_time * 100.);
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<br>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (up_time > 0)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "%.3g requests/sec - ",
3568de757bac0b47256647504c186d17ca272f85rbb (float) count / (float) up_time);
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (up_time > 0) {
24b534291150023e6b68eca89ddd33e475ccddc0wrowe format_byte_out(r, (unsigned long)(KBYTE * (float) kbcount
24b534291150023e6b68eca89ddd33e475ccddc0wrowe / (float) up_time));
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("/second - ", r);
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (count > 0) {
24b534291150023e6b68eca89ddd33e475ccddc0wrowe format_byte_out(r, (unsigned long)(KBYTE * (float) kbcount
24b534291150023e6b68eca89ddd33e475ccddc0wrowe / (float) count));
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("/request", r);
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<br>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb } /* short_report */
3568de757bac0b47256647504c186d17ca272f85rbb } /* ap_extended_status */
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (!short_report)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "\n%d requests currently being processed, %d idle servers\n"
3568de757bac0b47256647504c186d17ca272f85rbb ,busy, ready);
3568de757bac0b47256647504c186d17ca272f85rbb else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "BusyServers: %d\nIdleServers: %d\n", busy, ready);
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb /* send the scoreboard 'table' out */
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (!short_report)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<PRE>", r);
3568de757bac0b47256647504c186d17ca272f85rbb else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("Scoreboard: ", r);
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
3568de757bac0b47256647504c186d17ca272f85rbb for (j = 0; j < HARD_THREAD_LIMIT; ++j) {
3568de757bac0b47256647504c186d17ca272f85rbb int indx = (i * HARD_THREAD_LIMIT) + j;
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputc(stat_buffer[indx], r);
3568de757bac0b47256647504c186d17ca272f85rbb if ((indx % STATUS_MAXLINE == (STATUS_MAXLINE - 1)) && !short_report)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\n", r);
beb70d51e435dc36c56a72b6cd83556c04db9283wrowe }
fe6baec9bbcd36f932b71a355120cd7b5a685d6cfielding }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (short_report)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb else {
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("</PRE>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("Scoreboard Key: <br>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\"<B><code>_</code></B>\" Waiting for Connection, \n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\"<B><code>S</code></B>\" Starting up, \n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\"<B><code>R</code></B>\" Reading Request,<BR>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\"<B><code>W</code></B>\" Sending Reply, \n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\"<B><code>K</code></B>\" Keepalive (read), \n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\"<B><code>D</code></B>\" DNS Lookup,<BR>\n", r);
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames ap_rputs("\"<B><code>C</code></B>\" Closing connection, \n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\"<B><code>L</code></B>\" Logging, \n", r);
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames ap_rputs("\"<B><code>G</code></B>\" Gracefully finishing,<BR> \n", r);
ce03576b2434cec77f2921db9d5b6a0510581c23rederpj ap_rputs("\"<B><code>I</code></B>\" Idle cleanup of worker, \n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\"<B><code>.</code></B>\" Open slot with no current process<P>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<P>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb if (!ap_extended_status) {
8e9734d1a4af74c141e2a0f880bb51bb061fa03atrawick int j;
8e9734d1a4af74c141e2a0f880bb51bb061fa03atrawick int k = 0;
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("PID Key: <br>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<PRE>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
8e9734d1a4af74c141e2a0f880bb51bb061fa03atrawick for (j = 0; j < HARD_THREAD_LIMIT; ++j) {
3568de757bac0b47256647504c186d17ca272f85rbb int indx = (i * HARD_THREAD_LIMIT) + j;
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (stat_buffer[indx] != '.') {
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick ap_rprintf(r, " %" APR_OS_PROC_T_FMT
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick " in state: %c ", pid_buffer[i],
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick stat_buffer[indx]);
8e9734d1a4af74c141e2a0f880bb51bb061fa03atrawick if (++k >= 3) {
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\n", r);
8e9734d1a4af74c141e2a0f880bb51bb061fa03atrawick k = 0;
3568de757bac0b47256647504c186d17ca272f85rbb } else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs(",", r);
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("</PRE>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (ap_extended_status) {
3568de757bac0b47256647504c186d17ca272f85rbb if (!short_report) {
3568de757bac0b47256647504c186d17ca272f85rbb if (no_table_report)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<p><hr><h2>Server Details</h2>\n\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb else
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifndef HAVE_TIMES
3568de757bac0b47256647504c186d17ca272f85rbb /* Allow for OS/2 not having CPU stats */
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client<th>VHost<th>Request</tr>\n\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb#else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<p>\n\n<table border=0><tr><th>Srv<th>PID<th>Acc<th>M<th>CPU\n<th>SS<th>Req<th>Conn<th>Child<th>Slot<th>Client<th>VHost<th>Request</tr>\n\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb for (i = 0; i < HARD_SERVER_LIMIT; ++i) {
3568de757bac0b47256647504c186d17ca272f85rbb for (j = 0; j < HARD_THREAD_LIMIT; ++j) {
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record = ap_scoreboard_image->servers[i][j];
3568de757bac0b47256647504c186d17ca272f85rbb ps_record = ap_scoreboard_image->parent[i];
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj vhost = ws_record.vhostrec;
3568de757bac0b47256647504c186d17ca272f85rbb if (ps_record.generation != ap_my_generation) {
3568de757bac0b47256647504c186d17ca272f85rbb vhost = NULL;
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb#if defined(NO_GETTIMEOFDAY)
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifdef HAVE_TIMES
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj if (ws_record.start_time == (clock_t) 0)
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#endif /* HAVE_TIMES */
3568de757bac0b47256647504c186d17ca272f85rbb req_time = 0L;
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifdef HAVE_TIMES
3568de757bac0b47256647504c186d17ca272f85rbb else {
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj req_time = ws_record.stop_time - ws_record.start_time;
3568de757bac0b47256647504c186d17ca272f85rbb req_time = (req_time * 1000) / (int) tick;
3568de757bac0b47256647504c186d17ca272f85rbb }
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#endif /* HAVE_TIMES */
3568de757bac0b47256647504c186d17ca272f85rbb#else
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj if (ws_record.start_time == 0L &&
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record.start_time == 0L)
3568de757bac0b47256647504c186d17ca272f85rbb req_time = 0L;
3568de757bac0b47256647504c186d17ca272f85rbb else
24b534291150023e6b68eca89ddd33e475ccddc0wrowe req_time = (long)
24b534291150023e6b68eca89ddd33e475ccddc0wrowe (((ws_record.stop_time - ws_record.start_time) * 1000)
24b534291150023e6b68eca89ddd33e475ccddc0wrowe + ((ws_record.stop_time - ws_record.start_time) / 1000));
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb if (req_time < 0L)
3568de757bac0b47256647504c186d17ca272f85rbb req_time = 0L;
3568de757bac0b47256647504c186d17ca272f85rbb
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj lres = ws_record.access_count;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj my_lres = ws_record.my_access_count;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj conn_lres = ws_record.conn_count;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj bytes = ws_record.bytes_served;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj my_bytes = ws_record.my_bytes_served;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj conn_bytes = ws_record.conn_bytes;
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj if (lres != 0 || (ws_record.status != SERVER_READY
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj && ws_record.status != SERVER_DEAD)) {
3568de757bac0b47256647504c186d17ca272f85rbb if (!short_report) {
3568de757bac0b47256647504c186d17ca272f85rbb if (no_table_report) {
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj if (ws_record.status == SERVER_DEAD)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r,
3568de757bac0b47256647504c186d17ca272f85rbb "<b>Server %d-%d</b> (-): %d|%lu|%lu [",
3568de757bac0b47256647504c186d17ca272f85rbb i, (int) ps_record.generation, (int) conn_lres,
3568de757bac0b47256647504c186d17ca272f85rbb my_lres, lres);
3568de757bac0b47256647504c186d17ca272f85rbb else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r,
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick "<b>Server %d-%d</b> (%" APR_OS_PROC_T_FMT
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick "): %d|%lu|%lu [",
3568de757bac0b47256647504c186d17ca272f85rbb i, (int) ps_record.generation,
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick ps_record.pid,
3568de757bac0b47256647504c186d17ca272f85rbb (int) conn_lres, my_lres, lres);
3568de757bac0b47256647504c186d17ca272f85rbb
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj switch (ws_record.status) {
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_READY:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("Ready", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_STARTING:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("Starting", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_READ:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<b>Read</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_WRITE:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<b>Write</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_KEEPALIVE:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<b>Keepalive</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_LOG:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<b>Logging</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_DNS:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<b>DNS lookup</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames case SERVER_CLOSING:
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames ap_rputs("<b>Closing</b>", r);
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_DEAD:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("Dead", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_GRACEFUL:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("Graceful", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
5f4e89b7e376d596fbf5167314a3781fd0889064trawick case SERVER_IDLE_KILL:
5f4e89b7e376d596fbf5167314a3781fd0889064trawick ap_rputs("Dying", r);
5f4e89b7e376d596fbf5167314a3781fd0889064trawick break;
3568de757bac0b47256647504c186d17ca272f85rbb default:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("?STATE?", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb }
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifndef HAVE_TIMES
3568de757bac0b47256647504c186d17ca272f85rbb /* Allow for OS/2 not having CPU stats */
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "]\n %.0f %ld (",
3568de757bac0b47256647504c186d17ca272f85rbb#else
3568de757bac0b47256647504c186d17ca272f85rbb
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick ap_rprintf(r, "] u%g s%g cu%g cs%g\n %ld %ld (",
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record.times.tms_utime / tick,
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record.times.tms_stime / tick,
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record.times.tms_cutime / tick,
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record.times.tms_cstime / tick,
3568de757bac0b47256647504c186d17ca272f85rbb#endif
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj (long)((nowtime - ws_record.last_used) / APR_USEC_PER_SEC),
3568de757bac0b47256647504c186d17ca272f85rbb (long) req_time);
3568de757bac0b47256647504c186d17ca272f85rbb format_byte_out(r, conn_bytes);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("|", r);
3568de757bac0b47256647504c186d17ca272f85rbb format_byte_out(r, my_bytes);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("|", r);
3568de757bac0b47256647504c186d17ca272f85rbb format_byte_out(r, bytes);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs(")\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, " <i>%s {%s}</i> <b>[%s]</b><br>\n\n",
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ap_escape_html(r->pool, ws_record.client),
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ap_escape_html(r->pool, ws_record.request),
3568de757bac0b47256647504c186d17ca272f85rbb vhost ? ap_escape_html(r->pool,
3568de757bac0b47256647504c186d17ca272f85rbb vhost->server_hostname) : "(unavailable)");
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb else { /* !no_table_report */
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj if (ws_record.status == SERVER_DEAD)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r,
3568de757bac0b47256647504c186d17ca272f85rbb "<tr><td><b>%d-%d</b><td>-<td>%d/%lu/%lu",
3568de757bac0b47256647504c186d17ca272f85rbb i, (int) ps_record.generation,
3568de757bac0b47256647504c186d17ca272f85rbb (int) conn_lres, my_lres, lres);
3568de757bac0b47256647504c186d17ca272f85rbb else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r,
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick "<tr><td><b>%d-%d</b><td>%" APR_OS_PROC_T_FMT
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick "<td>%d/%lu/%lu",
3568de757bac0b47256647504c186d17ca272f85rbb i, (int) ps_record.generation,
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick ps_record.pid, (int) conn_lres,
3568de757bac0b47256647504c186d17ca272f85rbb my_lres, lres);
3568de757bac0b47256647504c186d17ca272f85rbb
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj switch (ws_record.status) {
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_READY:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td>_", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_STARTING:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td><b>S</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_READ:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td><b>R</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_WRITE:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td><b>W</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_KEEPALIVE:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td><b>K</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_LOG:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td><b>L</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_BUSY_DNS:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td><b>D</b>", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames case SERVER_CLOSING:
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames ap_rputs("<td><b>C</b>", r);
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_DEAD:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td>.", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb case SERVER_GRACEFUL:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td>G", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
5f4e89b7e376d596fbf5167314a3781fd0889064trawick case SERVER_IDLE_KILL:
5f4e89b7e376d596fbf5167314a3781fd0889064trawick ap_rputs("<td>I", r);
5f4e89b7e376d596fbf5167314a3781fd0889064trawick break;
3568de757bac0b47256647504c186d17ca272f85rbb default:
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<td>?", r);
3568de757bac0b47256647504c186d17ca272f85rbb break;
3568de757bac0b47256647504c186d17ca272f85rbb }
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifndef HAVE_TIMES
3568de757bac0b47256647504c186d17ca272f85rbb /* Allow for OS/2 not having CPU stats */
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "\n<td>%.0f<td>%ld",
3568de757bac0b47256647504c186d17ca272f85rbb#else
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick ap_rprintf(r, "\n<td>%.2f<td>%ld<td>%ld",
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj (ws_record.times.tms_utime +
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record.times.tms_stime +
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record.times.tms_cutime +
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ws_record.times.tms_cstime) / tick,
3568de757bac0b47256647504c186d17ca272f85rbb#endif
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj (long)((nowtime - ws_record.last_used) / APR_USEC_PER_SEC),
3568de757bac0b47256647504c186d17ca272f85rbb (long) req_time);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r, "<td>%-1.1f<td>%-2.2f<td>%-2.2f\n",
3568de757bac0b47256647504c186d17ca272f85rbb (float) conn_bytes / KBYTE, (float) my_bytes / MBYTE,
3568de757bac0b47256647504c186d17ca272f85rbb (float) bytes / MBYTE);
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj if (ws_record.status == SERVER_BUSY_READ)
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r,
3568de757bac0b47256647504c186d17ca272f85rbb "<td>?<td nowrap>?<td nowrap>..reading.. </tr>\n\n");
3568de757bac0b47256647504c186d17ca272f85rbb else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rprintf(r,
3568de757bac0b47256647504c186d17ca272f85rbb "<td>%s<td nowrap>%s<td nowrap>%s</tr>\n\n",
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ap_escape_html(r->pool, ws_record.client),
3568de757bac0b47256647504c186d17ca272f85rbb vhost ? ap_escape_html(r->pool,
3568de757bac0b47256647504c186d17ca272f85rbb vhost->server_hostname) : "(unavailable)",
aa616c3b5a4aa59867472cddf7d8e63693808f0erederpj ap_escape_html(r->pool, ws_record.request));
3568de757bac0b47256647504c186d17ca272f85rbb } /* no_table_report */
3568de757bac0b47256647504c186d17ca272f85rbb } /* !short_report */
3568de757bac0b47256647504c186d17ca272f85rbb } /* if (<active child>) */
3568de757bac0b47256647504c186d17ca272f85rbb } /* for () */
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (!(short_report || no_table_report)) {
ad83978f20c7d1a4323059d9af122e56fcd353bdstoddard#ifndef HAVE_TIMES
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("</table>\n \
3568de757bac0b47256647504c186d17ca272f85rbb<hr> \
3568de757bac0b47256647504c186d17ca272f85rbb<table>\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Srv<td>Child Server number - generation\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>PID<td>OS process ID\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Acc<td>Number of accesses this connection / this child / this slot\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>M<td>Mode of operation\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>SS<td>Seconds since beginning of most recent request\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Req<td>Milliseconds required to process most recent request\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Conn<td>Kilobytes transferred this connection\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Child<td>Megabytes transferred this child\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Slot<td>Total megabytes transferred this slot\n \
3568de757bac0b47256647504c186d17ca272f85rbb</table>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb#else
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("</table>\n \
3568de757bac0b47256647504c186d17ca272f85rbb<hr> \
3568de757bac0b47256647504c186d17ca272f85rbb<table>\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Srv<td>Child Server number - generation\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>PID<td>OS process ID\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Acc<td>Number of accesses this connection / this child / this slot\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>M<td>Mode of operation\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>CPU<td>CPU usage, number of seconds\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>SS<td>Seconds since beginning of most recent request\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Req<td>Milliseconds required to process most recent request\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Conn<td>Kilobytes transferred this connection\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Child<td>Megabytes transferred this child\n \
3568de757bac0b47256647504c186d17ca272f85rbb<tr><th>Slot<td>Total megabytes transferred this slot\n \
3568de757bac0b47256647504c186d17ca272f85rbb</table>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb#endif
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb } else {
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (!short_report) {
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("<hr>To obtain a full report with current status information ", r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("you need to use the <code>ExtendedStatus On</code> directive. \n", r);
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbb if (!short_report) {
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs(ap_psignature("<HR>\n",r), r);
3568de757bac0b47256647504c186d17ca272f85rbb ap_rputs("</BODY></HTML>\n", r);
3568de757bac0b47256647504c186d17ca272f85rbb }
3568de757bac0b47256647504c186d17ca272f85rbb
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding return 0;
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding}
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
3568de757bac0b47256647504c186d17ca272f85rbb
3568de757bac0b47256647504c186d17ca272f85rbbstatic void status_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
3568de757bac0b47256647504c186d17ca272f85rbb{
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_DEAD] = '.'; /* We don't want to assume these are in */
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_READY] = '_'; /* any particular order in scoreboard.h */
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_STARTING] = 'S';
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_BUSY_READ] = 'R';
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_BUSY_WRITE] = 'W';
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_BUSY_KEEPALIVE] = 'K';
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_BUSY_LOG] = 'L';
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_BUSY_DNS] = 'D';
ec020ca384efb30d501a5af796ddc3bb237d7b8fgregames status_flags[SERVER_CLOSING] = 'C';
3568de757bac0b47256647504c186d17ca272f85rbb status_flags[SERVER_GRACEFUL] = 'G';
ce03576b2434cec77f2921db9d5b6a0510581c23rederpj status_flags[SERVER_IDLE_KILL] = 'I';
3568de757bac0b47256647504c186d17ca272f85rbb}
3568de757bac0b47256647504c186d17ca272f85rbb
73e8b26287de5c06fa470d36162e103dbac9c7e5wrowestatic void register_hooks(apr_pool_t *p)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding{
b980ad7fdc218b4855cde9f75a747527f50c554dwrowe ap_hook_handler(status_handler, NULL, NULL, APR_HOOK_MIDDLE);
3568de757bac0b47256647504c186d17ca272f85rbb ap_hook_post_config(status_init, NULL, NULL, APR_HOOK_MIDDLE);
ca53a74f4012a45cbad48e940eddf27d866981f9dougm}
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding
3d96ee83babeec32482c9082c9426340cee8c44dwrowemodule AP_MODULE_DECLARE_DATA status_module =
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding{
302dc1f7b3feee23a91ad8f3cf3cb2edd95a557bmanoj STANDARD20_MODULE_STUFF,
3568de757bac0b47256647504c186d17ca272f85rbb NULL, /* dir config creater */
3568de757bac0b47256647504c186d17ca272f85rbb NULL, /* dir merger --- default is to override */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding NULL, /* server config */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding NULL, /* merge server config */
3568de757bac0b47256647504c186d17ca272f85rbb status_module_cmds, /* command table */
3568de757bac0b47256647504c186d17ca272f85rbb register_hooks /* register_hooks */
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding};
3568de757bac0b47256647504c186d17ca272f85rbb