HI,

Attached patch will put two functions in the core
via which a worker_score or server_score can be
retrieved from the scoreboard.

Both functions have depending on the dimensions of the array
have 1 or 2 integers as parameters. Those indicate the
array index of the struct to be returned. Within the
function it also check whether the indexes asked are within
the range allowed.

Harrie

PS: Based upon an idea of Jon Travis.
-- 
address: Covalent Technologies, 645 Howard St, San Francisco, CA - 94105
phone: +1-415-536-5221                               fax:+1-415-536-5210
personal website: http://www.lisanza.net/
--- server/scoreboard.c-orig    Tue Jun 26 15:32:10 2001
+++ server/scoreboard.c Wed Jun 27 15:04:29 2001
@@ -348,3 +348,29 @@
     put_scoreboard_info(child_num, thread_num, ws);
 }
 
+worker_score *ap_get_servers_scoreboard(int x, int y)
+{
+int hard_server_limit;
+int hard_thread_limit;
+
+    ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &hard_server_limit);
+    ap_mpm_query(AP_MPMQ_HARD_LIMIT_THREADS, &hard_thread_limit);
+
+    if (((x < 0) || (hard_server_limit < x)) &&
+        ((y < 0) || (hard_thread_limit < y))) {
+        return(&ap_scoreboard_image->servers[x][y]);
+    }
+    return(NULL);
+}
+
+process_score *ap_get_parent_scoreboard(int x)
+{
+int hard_server_limit;
+
+    ap_mpm_query(AP_MPMQ_HARD_LIMIT_DAEMONS, &hard_server_limit);
+    
+    if ((x < 0) || (hard_server_limit < x)) {
+        return(&ap_scoreboard_image->parent[x]);
+    }
+    return(NULL);
+}
--- include/scoreboard.h-orig   Wed Jun 27 14:42:55 2001
+++ include/scoreboard.h        Wed Jun 27 14:46:39 2001
@@ -216,6 +219,8 @@
 AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid);
 int ap_update_child_status(int child_num, int thread_num, int status, request_rec *r);
 void ap_time_process_request(int child_num, int thread_num, int status);
+worker_score *ap_get_servers_scoreboard(int x, int y);
+process_score *ap_get_parent_scoreboard(int x);
 
 
 AP_DECLARE_DATA extern scoreboard *ap_scoreboard_image;

Reply via email to