]> granicus.if.org Git - apache/commitdiff
The old, legacy (and unused) code in which the scoreboard was totally
authorJim Jagielski <jim@apache.org>
Fri, 29 Mar 2002 14:33:50 +0000 (14:33 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 29 Mar 2002 14:33:50 +0000 (14:33 +0000)
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

CHANGES
include/scoreboard.h
os/tpf/os.c
server/mpm/netware/mpm_netware.c
server/mpm/prefork/prefork.c
server/mpm/worker/worker.c
server/scoreboard.c

diff --git a/CHANGES b/CHANGES
index fbcf30c462e07e9f45222b2ca34a63937939309b..c743dfb540ee5db8f932504b3d0cf6418a92e073 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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.
index f04bc218b33972ca831329ac1dab256b6a696165..7d4492d3d49a3e34c5499cec7e277473f6256f16 100644 (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,
index bcb6335ac4dba95aa69e7c391882d6501cd02636..53f5de6a1a5f943c738a5e61833f03fe6062176e 100644 (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;
index 6a284c895eb604cb335b2cdfaa6b0237f1f3f1ff..a1618b87bbbe61a3aa5bf5776e129e9613da691f 100644 (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");
index 12c9ae6260a861ae28a57e2be8535da9d52c594c..7ba3aeb9320071f4483c328c3c66a88b9661572e 100644 (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 */
index b871af575e8a0caa73ca15c473ec29dc41178fc0..1e5d7c9c077d096ced30369f41cb1843229c3bde 100644 (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,
index 0e8b692472f5c677761ba394a540fb39b18ad71c..47ecaf5a7776d59328d84761ee7a642f90971476 100644 (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)