From: Bill Stoddard Date: Tue, 19 Feb 2002 21:09:27 +0000 (+0000) Subject: This fixes a bug in mod_status on Windows where restart time was not X-Git-Tag: 2.0.33~190 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1e828a3bfce35578acbde18857d03b2f7e797f4;p=apache This fixes a bug in mod_status on Windows where restart time was not properly initialized. Move ap_restart_time into the scoreboard global area so the child process on non-forking platforms can have access to it. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93502 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index ac639a4531..cfbe8664e6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ Changes with Apache 2.0.33-dev + *) Win32: Fix bug in mod_status with displaying "Restart Time" + [Bill Stoddard] *) Fix IPv6 name-based virtual hosts. [Jeff Trawick] diff --git a/include/scoreboard.h b/include/scoreboard.h index 6001caf078..bbb3b2f016 100644 --- a/include/scoreboard.h +++ b/include/scoreboard.h @@ -162,6 +162,7 @@ typedef struct { ap_scoreboard_e sb_type; ap_generation_t running_generation; /* the generation of children which * should still be serving requests. */ + apr_time_t restart_time; } global_score; /* stuff which the parent generally writes and the children rarely read */ @@ -214,7 +215,6 @@ AP_DECLARE(global_score *) ap_get_scoreboard_global(void); AP_DECLARE_DATA extern scoreboard *ap_scoreboard_image; AP_DECLARE_DATA extern const char *ap_scoreboard_fname; AP_DECLARE_DATA extern int ap_extended_status; -AP_DECLARE_DATA extern apr_time_t ap_restart_time; AP_DECLARE_DATA extern ap_generation_t volatile ap_my_generation; diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c index 6970243d54..81a813ff78 100644 --- a/modules/generators/mod_status.c +++ b/modules/generators/mod_status.c @@ -358,7 +358,7 @@ static int status_handler(request_rec *r) } /* up_time in seconds */ - up_time = (apr_uint32_t) ((nowtime - ap_restart_time)/APR_USEC_PER_SEC); + up_time = (apr_uint32_t) ((nowtime - ap_scoreboard_image->global->restart_time)/APR_USEC_PER_SEC); if (!short_report) { ap_rputs(DOCTYPE_HTML_3_2 @@ -373,7 +373,7 @@ static int status_handler(request_rec *r) ap_rvputs(r, "
Current Time: ", ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), "
\n", NULL); ap_rvputs(r, "
Restart Time: ", - ap_ht_time(r->pool, ap_restart_time, DEFAULT_TIME_FORMAT, 0), + ap_ht_time(r->pool, ap_scoreboard_image->global->restart_time, DEFAULT_TIME_FORMAT, 0), "
\n", NULL); ap_rprintf(r, "
Parent Server Generation: %d
\n", (int) ap_my_generation); ap_rputs("
Server uptime: ", r); diff --git a/server/scoreboard.c b/server/scoreboard.c index 744fd42905..f10651dae1 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -82,7 +82,6 @@ AP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL; AP_DECLARE_DATA const char *ap_scoreboard_fname = NULL; AP_DECLARE_DATA int ap_extended_status = 0; -AP_DECLARE_DATA apr_time_t ap_restart_time = 0; #if APR_HAS_SHARED_MEMORY @@ -319,7 +318,7 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type) } ap_scoreboard_image->global->sb_type = sb_type; ap_scoreboard_image->global->running_generation = running_gen; - ap_restart_time = apr_time_now(); + ap_scoreboard_image->global->restart_time = apr_time_now(); apr_pool_cleanup_register(p, NULL, ap_cleanup_scoreboard, apr_pool_cleanup_null); return OK; }