scoreboard.c revision ca47a2b6bcea23e8af185c68f256dcbbfd2a0f9d
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering/* ====================================================================
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * The Apache Software License, Version 1.1
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * Redistribution and use in source and binary forms, with or without
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * modification, are permitted provided that the following conditions
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering * 1. Redistributions of source code must retain the above copyright
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering * notice, this list of conditions and the following disclaimer.
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * 2. Redistributions in binary form must reproduce the above copyright
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * notice, this list of conditions and the following disclaimer in
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * the documentation and/or other materials provided with the
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * distribution.
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * 3. The end-user documentation included with the redistribution,
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering * if any, must include the following acknowledgment:
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * "This product includes software developed by the
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * Apache Software Foundation (http://www.apache.org/)."
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * Alternately, this acknowledgment may appear in the software itself,
9f23530860942a8f94b7c535ead80c38f02424b1Lennart Poettering * if and wherever such third-party acknowledgments normally appear.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * 4. The names "Apache" and "Apache Software Foundation" must
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * not be used to endorse or promote products derived from this
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * software without prior written permission. For written
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * permission, please contact apache@apache.org.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * 5. Products derived from this software may not be called "Apache",
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * nor may "Apache" appear in their name, without prior written
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * permission of the Apache Software Foundation.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * ====================================================================
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * This software consists of voluntary contributions made by many
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * individuals on behalf of the Apache Software Foundation. For more
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * information on the Apache Software Foundation, please see
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * Portions of this software are based upon public domain software
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * originally written at the National Center for Supercomputing Applications,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * University of Illinois, Urbana-Champaign.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE_DATA const char *ap_scoreboard_fname=NULL;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE_DATA int ap_extended_status = 0;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE_DATA apr_time_t ap_restart_time = 0;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekstatic apr_shmem_t *scoreboard_shm = NULL;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek (apr_pool_t *p, ap_scoreboard_e sb_type),
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekstatic int server_limit, thread_limit;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekstatic apr_size_t scoreboard_size;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * This function should be renamed to cleanup_shared
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * and it should handle cleaning up a scoreboard shared
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * between processes using any form of IPC (file, shared memory
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * segment, etc.). Leave it as is now because it is being used
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * by various MPMs.
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekstatic apr_status_t ap_cleanup_shared_mem(void *d)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_shm_free(scoreboard_shm, ap_scoreboard_image);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_shm_destroy(scoreboard_shm);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekstatic void calc_scoreboard_size(void)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &thread_limit);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &server_limit);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek scoreboard_size = sizeof(scoreboard);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek scoreboard_size += sizeof(process_score) * server_limit;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek scoreboard_size += sizeof(worker_score * ) * server_limit;
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Sateler scoreboard_size += sizeof(worker_score) * server_limit * thread_limit;
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Satelerstatic void init_scoreboard(void)
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Sateler memset(ap_scoreboard_image, 0, scoreboard_size);
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Sateler more_storage = (char *)(ap_scoreboard_image + 1);
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Sateler ap_scoreboard_image->parent = (process_score *)more_storage;
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Sateler more_storage += sizeof(process_score) * server_limit;
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Sateler ap_scoreboard_image->servers = (worker_score **)more_storage;
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Sateler more_storage += server_limit * sizeof(worker_score *);
1abc8ae604f6acd18f7dec1ae8e7371c7773d0b0Felipe Sateler for (i = 0; i < server_limit; i++) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_scoreboard_image->servers[i] = (worker_score *)more_storage;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek more_storage += thread_limit * sizeof(worker_score);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_assert(more_storage - (char *)ap_scoreboard_image == scoreboard_size);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek/* ToDo: This function should be made to handle setting up
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * a scoreboard shared between processes using any IPC technique,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * not just a shared memory segment
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekstatic void setup_shared(apr_pool_t *p)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek fname = ap_server_root_relative(p, ap_scoreboard_fname);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek rv = apr_shm_init(&scoreboard_shm, scoreboard_size, fname, p);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_snprintf(buf, sizeof(buf), "%s: could not open(create) scoreboard: (%d)%s",
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_server_argv0, rv, apr_strerror(rv, errmsg, sizeof errmsg));
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_scoreboard_image = apr_shm_malloc(scoreboard_shm, scoreboard_size);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (ap_scoreboard_image == NULL) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard",
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek perror(buf); /* o.k. since MM sets errno */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_shm_destroy(scoreboard_shm);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek /* everything will be cleared shortly */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(void) reopen_scoreboard(apr_pool_t *p)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek/* ap_cleanup_scoreboard
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekapr_status_t ap_cleanup_scoreboard(void *d) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (ap_scoreboard_image == NULL)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (ap_scoreboard_image->global.sb_type == SB_SHARED) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek/* ap_create_scoreboard(apr_pool_t*, ap_scoreboard_e t)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * Create or reinit an existing scoreboard. The MPM can control whether
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * the scoreboard is shared across multiple processes or not
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * ###: Is there any reason to export this symbol in the first place?
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE_NONSTD(void) ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek running_gen = ap_scoreboard_image->global.running_generation;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (ap_scoreboard_image == NULL) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek /* A simple malloc will suffice */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_scoreboard_image = (scoreboard *) malloc(scoreboard_size);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (ap_scoreboard_image == NULL) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_snprintf(buf, sizeof(buf), "%s: cannot allocate scoreboard",
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek perror(buf); /* o.k. since MM sets errno */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek init_scoreboard(); /* can't just memset() */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_scoreboard_image->global.sb_type = sb_type;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_scoreboard_image->global.running_generation = running_gen;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_restart_time = apr_time_now();
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_pool_cleanup_register(p, NULL, ap_cleanup_scoreboard, apr_pool_cleanup_null);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek/* Routines called to deal with the scoreboard image
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * --- note that we do *not* need write locks, since update_child_status
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * only updates a *single* record in place, and only one process writes to
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * a given scoreboard slot at a time (either the child process owning that
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * slot, or the parent, noting that the child has died).
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * As a final note --- setting the score entry to getpid() is always safe,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * since when the parent is writing an entry, it's only noting SERVER_DEAD
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekvoid ap_sync_scoreboard_image(void)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(int) ap_exists_scoreboard_image(void)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek return (ap_scoreboard_image ? 1 : 0);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekstatic APR_INLINE void put_scoreboard_info(int child_num, int thread_num,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek /* XXX - needs to be fixed to account for threads */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek lseek(scoreboard_fd, (long) child_num * sizeof(worker_score), 0);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek force_write(scoreboard_fd, new_score_rec, sizeof(worker_score));
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekvoid update_scoreboard_global(void)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek (char *) &ap_scoreboard_image->global -(char *) ap_scoreboard_image, 0);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek force_write(scoreboard_fd, &ap_scoreboard_image->global,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek sizeof ap_scoreboard_image->global);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(void) ap_increment_counts(void *sbh, request_rec *r)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws = &ap_scoreboard_image->servers[sb->child_num][sb->thread_num];
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws->bytes_served += r->bytes_sent;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws->my_bytes_served += r->bytes_sent;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws->conn_bytes += r->bytes_sent;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek put_scoreboard_info(sb->child_num, sb->thread_num, ws);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(int) find_child_by_pid(apr_proc_t *pid)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_daemons_limit);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek for (i = 0; i < max_daemons_limit; ++i)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (ap_scoreboard_image->parent[i].pid == pid->pid)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(void) ap_create_sb_handle(void **new_handle, apr_pool_t *p,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek sbh = (sb_handle *)apr_palloc(p, sizeof *sbh);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(int) ap_update_child_status_from_indexes(int child_num, int thread_num,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws = &ap_scoreboard_image->servers[child_num][thread_num];
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ps = &ap_scoreboard_image->parent[child_num];
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek && old_status == SERVER_STARTING) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws->thread_num = child_num * server_limit + thread_num;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (ps->generation != ap_my_generation) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek for (i = 0; i < thread_limit; i++) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ap_scoreboard_image->servers[child_num][i].vhostrec = NULL;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ps->generation = ap_my_generation;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (status == SERVER_READY || status == SERVER_DEAD) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek * Reset individual counters
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws->conn_count = (unsigned short) 0;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws->conn_bytes = (unsigned long) 0;
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_cpystrn(ws->client, ap_get_remote_host(c, r->per_dir_config,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek REMOTE_NOLOOKUP, NULL), sizeof(ws->client));
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_cpystrn(ws->request, "NULL", sizeof(ws->request));
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek } else if (r->parsed_uri.password == NULL) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_cpystrn(ws->request, r->the_request, sizeof(ws->request));
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek /* Don't reveal the password in the server-status view */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_cpystrn(ws->request, apr_pstrcat(r->pool, r->method, " ",
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek apr_uri_unparse(r->pool, &r->parsed_uri, APR_URI_UNP_OMITPASSWORD),
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek r->assbackwards ? NULL : " ", r->protocol, NULL),
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek put_scoreboard_info(child_num, thread_num, ws);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(int)ap_update_child_status(void *sbh, int status, request_rec *r)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek return ap_update_child_status_from_indexes(sb->child_num, sb->thread_num,
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmekvoid ap_time_process_request(int child_num, int thread_num, int status)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws = &ap_scoreboard_image->servers[child_num][thread_num];
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ws->start_time = apr_time_now();
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek else if (status == STOP_PREQUEST) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek put_scoreboard_info(child_num, thread_num, ws);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(worker_score *) ap_get_servers_scoreboard(int x, int y)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if (((x < 0) || (server_limit < x)) ||
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek ((y < 0) || (thread_limit < y))) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek return(NULL); /* Out of range */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek return(&ap_scoreboard_image->servers[x][y]);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(process_score *) ap_get_parent_scoreboard(int x)
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek if ((x < 0) || (server_limit < x)) {
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek return(NULL); /* Out of range */
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-Szmek return(&ap_scoreboard_image->parent[x]);
798d3a524ea57aaf40cb53858aaa45ec702f012dZbigniew Jędrzejewski-SzmekAP_DECLARE(global_score *) ap_get_global_scoreboard()