This patch removes, for good, the concept of *only* file-based scoreboards.
Not named-based and file-based shared memory scoreboards, but scoreboards
that exist only as files.

In the process, this allows us to remove some dead and useless function
calls which may be optimized away anyway, but this ensures it.

Index: include/scoreboard.h
===================================================================
RCS file: /home/cvs/httpd-2.0/include/scoreboard.h,v
retrieving revision 1.44
diff -u -r1.44 scoreboard.h
--- include/scoreboard.h        13 Mar 2002 20:47:42 -0000      1.44
+++ include/scoreboard.h        27 Mar 2002 19:06:50 -0000
@@ -203,7 +203,6 @@
 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: os/tpf/os.c
===================================================================
RCS file: /home/cvs/httpd-2.0/os/tpf/os.c,v
retrieving revision 1.18
diff -u -r1.18 os.c
--- os/tpf/os.c 13 Mar 2002 20:47:58 -0000      1.18
+++ os/tpf/os.c 27 Mar 2002 19:06:52 -0000
@@ -127,11 +127,7 @@
         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: server/scoreboard.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/scoreboard.c,v
retrieving revision 1.65
diff -u -r1.65 scoreboard.c
--- server/scoreboard.c 20 Mar 2002 20:30:46 -0000      1.65
+++ server/scoreboard.c 27 Mar 2002 19:06:53 -0000
@@ -351,35 +351,11 @@
  * 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 @@
     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 @@
         }
     }
     
-    put_scoreboard_info(child_num, thread_num, ws);
     return old_status;
 }
 
@@ -509,7 +482,6 @@
     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)
Index: server/mpm/netware/mpm_netware.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/netware/mpm_netware.c,v
retrieving revision 1.40
diff -u -r1.40 mpm_netware.c
--- server/mpm/netware/mpm_netware.c    20 Mar 2002 22:19:11 -0000      1.40
+++ server/mpm/netware/mpm_netware.c    27 Mar 2002 19:06:56 -0000
@@ -952,7 +952,6 @@
          */
         ++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: server/mpm/prefork/prefork.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v
retrieving revision 1.255
diff -u -r1.255 prefork.c
--- server/mpm/prefork/prefork.c        20 Mar 2002 22:19:11 -0000      1.255
+++ server/mpm/prefork/prefork.c        27 Mar 2002 19:07:00 -0000
@@ -317,7 +317,6 @@
     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);
@@ -562,8 +561,6 @@
 
     (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));
@@ -648,7 +645,6 @@
         * defer the exit
         */
        for (;;) {
-            ap_sync_scoreboard_image();
             status = listensocks[offset].accept_func(&csd, 
                                        &listensocks[offset], ptrans);
 
@@ -688,7 +684,6 @@
              */
             die_now = 1;
         }
-        ap_sync_scoreboard_image();
     }
     clean_child_exit(0);
 }
@@ -768,11 +763,6 @@
     }
 
     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;
 }
@@ -826,7 +816,6 @@
     last_non_dead = -1;
     total_non_dead = 0;
 
-    ap_sync_scoreboard_image();
     for (i = 0; i < ap_daemons_limit; ++i) {
        int status;
 
@@ -979,14 +968,7 @@
          * 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();
 
@@ -1050,7 +1032,6 @@
             }
 
            /* 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,
@@ -1151,7 +1132,6 @@
      */
     ++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,
@@ -1160,19 +1140,16 @@
        /* 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: server/mpm/worker/worker.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v
retrieving revision 1.106
diff -u -r1.106 worker.c
--- server/mpm/worker/worker.c  22 Mar 2002 03:43:22 -0000      1.106
+++ server/mpm/worker/worker.c  27 Mar 2002 19:07:05 -0000
@@ -1334,7 +1334,6 @@
     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 */
@@ -1586,7 +1585,6 @@
          * cleared scoreboard
          */
         ap_scoreboard_image->global->running_generation = ap_my_generation;
-        update_scoreboard_global();
     }
 
     set_signals();
@@ -1668,7 +1666,6 @@
      */
     ++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,
-- 
===========================================================================
   Jim Jagielski   [|]   [EMAIL PROTECTED]   [|]   http://www.jaguNET.com/
      "A society that will trade a little liberty for a little order
             will lose both and deserve neither" - T.Jefferson

Reply via email to