I know this idea isn't totaly popular, but I thought I would throw this
out and see what people think.  Aaron's most recent patch to the scoreboard
creation logic allows you to make the apache scoreboard shared memory image
accessible to external programs.  This is very usefull and we have employed
this same methodology to monitor apache 1.3 in the past.

The problem with the new scoreboard though is that its size depends on configure
time variables rather than compile time variables.  There's no easy way for an
external program to be adaptable without parsing the conf files.

This patch adds the configured server_limit and thread_limit elements to the
global score and sets them at the time the scoreboard is intialized.

If there is a better way to derive this information, someone please tell me!

-adam

Index: include/scoreboard.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/include/scoreboard.h,v
retrieving revision 1.41
diff -u -r1.41 scoreboard.h
--- include/scoreboard.h        19 Feb 2002 21:09:27 -0000      1.41
+++ include/scoreboard.h        20 Feb 2002 21:41:53 -0000
@@ -159,6 +159,8 @@
 };
 
 typedef struct {
+    int             server_limit;
+    int             thread_limit;
     ap_scoreboard_e sb_type;
     ap_generation_t running_generation;        /* the generation of children which
                                          * should still be serving requests. */
Index: server/scoreboard.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/scoreboard.c,v
retrieving revision 1.57
diff -u -r1.57 scoreboard.c
--- server/scoreboard.c 19 Feb 2002 21:09:27 -0000      1.57
+++ server/scoreboard.c 20 Feb 2002 21:41:53 -0000
@@ -158,6 +158,8 @@
         more_storage += thread_limit * sizeof(worker_score);
     }
     ap_assert(more_storage == (char*)shared_score + scoreboard_size);
+    ap_scoreboard_image->global->server_limit = server_limit;
+    ap_scoreboard_image->global->thread_limit = thread_limit;
 }
 
 /**

Reply via email to