1
0
mirror of https://github.com/apache/httpd.git synced 2026-01-06 09:01:14 +03:00

The old, legacy (and unused) code in which the scoreboard was totally

and completely contained in a file (SCOREBOARD_FILE) has been
removed. This does not affect scoreboards which are *mapped* to
files using named-shared-memory at all. This implies that scoreboards
must be based, at some level, on native shared memory (mmap, shm_open,
shmget, whatever), but the code has assumed that for quite awhile
now. Having the scoreboard be *based* on a file makes no sense today.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94306 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Jagielski
2002-03-29 14:33:50 +00:00
parent 3e2ce19baf
commit 70bb2575ea
7 changed files with 8 additions and 63 deletions

View File

@@ -1,5 +1,10 @@
Changes with Apache 2.0.35
*) The old, legacy (and unused) code in which the scoreboard was totally
and completely contained in a file (SCOREBOARD_FILE) has been
removed. This does not affect scoreboards which are *mapped* to
files using named-shared-memory. [Jim Jagielski]
*) Change bucket brigades API to allow a "bucket allocator" to be
passed in at certain points. This allows us to implement freelists
so that we can stop using malloc/free so frequently.

View File

@@ -203,7 +203,6 @@ void ap_sync_scoreboard_image(void);
AP_DECLARE(void) ap_create_sb_handle(ap_sb_handle_t **new_sbh, apr_pool_t *p,
int child_num, int thread_num);
void update_scoreboard_global(void);
AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid);
AP_DECLARE(int) ap_update_child_status(ap_sb_handle_t *sbh, int status, request_rec *r);
AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num, int thread_num,

View File

@@ -127,11 +127,7 @@ pid_t os_fork(server_rec *s, int slot)
ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s,
"unable to replace stdout with sock device driver");
input_parms.generation = ap_my_generation;
#ifdef SCOREBOARD_FILE
input_parms.scoreboard_fd = scoreboard_fd;
#else /* must be USE_TPF_SCOREBOARD or USE_SHMGET_SCOREBOARD */
input_parms.scoreboard_heap = ap_scoreboard_image;
#endif
lr = ap_listeners;
count = 0;

View File

@@ -956,7 +956,6 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
*/
++ap_my_generation;
ap_scoreboard_image->global->running_generation = ap_my_generation;
update_scoreboard_global();
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
"Graceful restart requested, doing restart");

View File

@@ -317,7 +317,6 @@ int reap_children(int *exitcode, apr_exit_why_e *status)
int n, pid;
for (n = 0; n < ap_max_daemons_limit; ++n) {
ap_sync_scoreboard_image();
if (ap_scoreboard_image->servers[n][0].status != SERVER_DEAD &&
kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) {
ap_update_child_status_from_indexes(n, 0, SERVER_DEAD, NULL);
@@ -563,8 +562,6 @@ static void child_main(int child_num_arg)
(void) ap_update_child_status(sbh, SERVER_READY, (request_rec *) NULL);
ap_sync_scoreboard_image();
/* Set up the pollfd array */
listensocks = apr_pcalloc(pchild,
sizeof(*listensocks) * (num_listensocks));
@@ -651,7 +648,6 @@ static void child_main(int child_num_arg)
* defer the exit
*/
for (;;) {
ap_sync_scoreboard_image();
status = listensocks[offset].accept_func(&csd,
&listensocks[offset], ptrans);
@@ -691,7 +687,6 @@ static void child_main(int child_num_arg)
*/
die_now = 1;
}
ap_sync_scoreboard_image();
}
clean_child_exit(0);
}
@@ -771,11 +766,6 @@ static int make_child(server_rec *s, int slot)
}
ap_scoreboard_image->parent[slot].pid = pid;
#ifdef SCOREBOARD_FILE
lseek(scoreboard_fd, APR_XtOffsetOf(scoreboard, parent[slot]), 0);
force_write(scoreboard_fd, &ap_scoreboard_image->parent[slot],
sizeof(process_score));
#endif
return 0;
}
@@ -829,7 +819,6 @@ static void perform_idle_server_maintenance(apr_pool_t *p)
last_non_dead = -1;
total_non_dead = 0;
ap_sync_scoreboard_image();
for (i = 0; i < ap_daemons_limit; ++i) {
int status;
@@ -982,14 +971,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
* cleared scoreboard
*/
ap_scoreboard_image->global->running_generation = ap_my_generation;
update_scoreboard_global();
}
#ifdef SCOREBOARD_FILE
else {
ap_scoreboard_fname = ap_server_root_relative(pconf, ap_scoreboard_fname);
ap_note_cleanups_for_fd(pconf, scoreboard_fd);
}
#endif
set_signals();
@@ -1053,7 +1035,6 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
}
/* non-fatal death... note that it's gone in the scoreboard. */
ap_sync_scoreboard_image();
child_slot = find_child_by_pid(&pid);
if (child_slot >= 0) {
(void) ap_update_child_status_from_indexes(child_slot, 0, SERVER_DEAD,
@@ -1154,7 +1135,6 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
*/
++ap_my_generation;
ap_scoreboard_image->global->running_generation = ap_my_generation;
update_scoreboard_global();
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
@@ -1163,19 +1143,16 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
/* kill off the idle ones */
ap_mpm_pod_killpg(pod, ap_daemons_limit);
#ifndef SCOREBOARD_FILE
/* This is mostly for debugging... so that we know what is still
* gracefully dealing with existing request. But we can't really
* do it if we're in a SCOREBOARD_FILE because it'll cause
* corruption too easily.
* gracefully dealing with existing request. This will break
* in a very nasty way if we ever have the scoreboard totally
* file-based (no shared memory)
*/
ap_sync_scoreboard_image();
for (index = 0; index < ap_daemons_limit; ++index) {
if (ap_scoreboard_image->servers[index][0].status != SERVER_DEAD) {
ap_scoreboard_image->servers[index][0].status = SERVER_GRACEFUL;
}
}
#endif
}
else {
/* Kill 'em off */

View File

@@ -1354,7 +1354,6 @@ static void perform_idle_server_maintenance(void)
last_non_dead = -1;
total_non_dead = 0;
ap_sync_scoreboard_image();
for (i = 0; i < ap_daemons_limit; ++i) {
/* Initialization to satisfy the compiler. It doesn't know
* that ap_threads_per_child is always > 0 */
@@ -1606,7 +1605,6 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
* cleared scoreboard
*/
ap_scoreboard_image->global->running_generation = ap_my_generation;
update_scoreboard_global();
}
set_signals();
@@ -1688,7 +1686,6 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
*/
++ap_my_generation;
ap_scoreboard_image->global->running_generation = ap_my_generation;
update_scoreboard_global();
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,

View File

@@ -351,35 +351,11 @@ int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
* anyway.
*/
void ap_sync_scoreboard_image(void)
{
}
AP_DECLARE(int) ap_exists_scoreboard_image(void)
{
return (ap_scoreboard_image ? 1 : 0);
}
static APR_INLINE void put_scoreboard_info(int child_num, int thread_num,
worker_score *new_score_rec)
{
/* XXX - needs to be fixed to account for threads */
#ifdef SCOREBOARD_FILE
lseek(scoreboard_fd, sizeof(global_score)
+ (long)child_num * sizeof(worker_score), 0);
force_write(scoreboard_fd, new_score_rec, sizeof(worker_score));
#endif
}
void update_scoreboard_global(void)
{
#ifdef SCOREBOARD_FILE
lseek(scoreboard_fd, 0, 0);
force_write(scoreboard_fd, &ap_scoreboard_image->global,
sizeof ap_scoreboard_image->global);
#endif
}
AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sb, request_rec *r)
{
worker_score *ws;
@@ -395,8 +371,6 @@ AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sb, request_rec *r)
ws->bytes_served += r->bytes_sent;
ws->my_bytes_served += r->bytes_sent;
ws->conn_bytes += r->bytes_sent;
put_scoreboard_info(sb->child_num, sb->thread_num, ws);
}
AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid)
@@ -482,7 +456,6 @@ AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num,
}
}
put_scoreboard_info(child_num, thread_num, ws);
return old_status;
}
@@ -509,7 +482,6 @@ void ap_time_process_request(int child_num, int thread_num, int status)
else if (status == STOP_PREQUEST) {
ws->stop_time = apr_time_now();
}
put_scoreboard_info(child_num, thread_num, ws);
}
AP_DECLARE(worker_score *) ap_get_scoreboard_worker(int x, int y)