]> granicus.if.org Git - apache/commitdiff
the mpm_get_child_pid hook is unnecessary, as was the per-MPM MPM_CHILD_PID() macro...
authorJeff Trawick <trawick@apache.org>
Sun, 29 Mar 2009 19:30:17 +0000 (19:30 +0000)
committerJeff Trawick <trawick@apache.org>
Sun, 29 Mar 2009 19:30:17 +0000 (19:30 +0000)
axe this new hook, and use ap_get_scoreboard_process() instead

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@759757 13f79535-47bb-0310-9956-ffa450edef68

include/mpm_common.h
server/mpm/event/event.c
server/mpm/prefork/prefork.c
server/mpm/worker/worker.c
server/mpm_common.c
server/mpm_unix.c

index a3cde481d7ebe3a9eb336e2626836231556aaf31..ce86ab12bff7505be5837ec47b11ef26d973b3e9 100644 (file)
@@ -86,8 +86,7 @@ extern "C" {
  * @param terminate Either 1 or 0.  If 1, send the child processes SIGTERM
  *        each time through the loop.  If 0, give the process time to die
  *        on its own before signalling it.
- * @tip This function requires that some hooks are implemented by the MPM: <pre>
- *  mpm_get_child_pid -- Get the pid from the specified spot in the scoreboard
+ * @tip This function requires that a hook is implemented by the MPM: <pre>
  *  mpm_note_child_killed -- Note the child died in the scoreboard
  * </pre>
  * @tip The MPM child processes which are reclaimed are those listed
@@ -99,8 +98,7 @@ void ap_reclaim_child_processes(int terminate);
 /**
  * Catch any child processes that have been spawned by the parent process
  * which have exited. This includes processes registered as "other_children".
- * @tip This function requires that some hooks are implemented by the MPM: <pre>
- *  mpm_get_child_pid -- Get the pid from the specified spot in the scoreboard
+ * @tip This function requires that a hook is implemented by the MPM: <pre>
  *  mpm_note_child_killed -- Note the child died in the scoreboard
  * </pre>
  * @tip The MPM child processes which are relieved are those listed
@@ -314,7 +312,6 @@ extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
                                              const char *arg);
 #endif
 
-AP_DECLARE(pid_t) ap_mpm_get_child_pid(int childnum);
 AP_DECLARE(apr_status_t) ap_mpm_note_child_killed(int childnum);
 
 AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p))
@@ -329,9 +326,6 @@ AP_DECLARE_HOOK(int, mpm, (apr_pool_t *pconf, apr_pool_t *plog, server_rec *s))
 /* implement the mpm query function */
 AP_DECLARE_HOOK(apr_status_t, mpm_query, (int query_code, int *result))
 
-/* get pid of child by index */
-AP_DECLARE_HOOK(pid_t, mpm_get_child_pid, (int childnum))
-
 /* child specified by index has been killed */
 AP_DECLARE_HOOK(apr_status_t, mpm_note_child_killed, (int childnum))
 
index 71c7bd90fb5de3fcdc4e5b5fafe13a0f6543ab43..e6299092d21f1cd607bc26dabcaad3931841e78b 100644 (file)
@@ -404,11 +404,6 @@ static apr_status_t event_query(int query_code, int *result)
     return APR_ENOTIMPL;
 }
 
-static pid_t event_get_child_pid(int childnum)
-{
-    return ap_scoreboard_image->parent[childnum].pid;
-}
-
 static apr_status_t event_note_child_killed(int childnum)
 {
     ap_scoreboard_image->parent[childnum].pid = 0;
@@ -2744,7 +2739,6 @@ static void event_hooks(apr_pool_t * p)
     ap_hook_check_config(event_check_config, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm(event_run, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_query(event_query, NULL, NULL, APR_HOOK_MIDDLE);
-    ap_hook_mpm_get_child_pid(event_get_child_pid, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_note_child_killed(event_note_child_killed, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_register_timed_callback(event_register_timed_callback, NULL, NULL,
                                         APR_HOOK_MIDDLE);
index 553355deacad89e3e78926a12be6962747d12a18..9f65a754b7f0bf9ab25c2956b397b4bacb2805a8 100644 (file)
@@ -291,11 +291,6 @@ static apr_status_t prefork_query(int query_code, int *result)
     return APR_ENOTIMPL;
 }
 
-static pid_t prefork_get_child_pid(int childnum)
-{
-    return ap_scoreboard_image->parent[childnum].pid;
-}
-
 static apr_status_t prefork_note_child_killed(int childnum)
 {
     ap_scoreboard_image->parent[childnum].pid = 0;
@@ -1458,7 +1453,6 @@ static void prefork_hooks(apr_pool_t *p)
     ap_hook_check_config(prefork_check_config, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm(prefork_run, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_query(prefork_query, NULL, NULL, APR_HOOK_MIDDLE);
-    ap_hook_mpm_get_child_pid(prefork_get_child_pid, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_note_child_killed(prefork_note_child_killed, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_get_name(prefork_get_name, NULL, NULL, APR_HOOK_MIDDLE);
 }
index f486c9762e7620a528dbac4866fc92143db801c9..8f502b26e35d4d5aba4078a22229e70a224445c9 100644 (file)
@@ -354,11 +354,6 @@ static apr_status_t worker_query(int query_code, int *result)
     return APR_ENOTIMPL;
 }
 
-static pid_t worker_get_child_pid(int childnum)
-{
-    return ap_scoreboard_image->parent[childnum].pid;
-}
-
 static apr_status_t worker_note_child_killed(int childnum)
 {
     ap_scoreboard_image->parent[childnum].pid = 0;
@@ -2245,7 +2240,6 @@ static void worker_hooks(apr_pool_t *p)
     ap_hook_check_config(worker_check_config, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm(worker_run, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_query(worker_query, NULL, NULL, APR_HOOK_MIDDLE);
-    ap_hook_mpm_get_child_pid(worker_get_child_pid, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_note_child_killed(worker_note_child_killed, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_mpm_get_name(worker_get_name, NULL, NULL, APR_HOOK_MIDDLE);
 }
index 2d365434b84d24eca3c8d4124b1c535b1f2c7722..597e388960f556e681f42d7f9688e3e4b0042f98 100644 (file)
@@ -63,7 +63,6 @@ APR_HOOK_STRUCT(
     APR_HOOK_LINK(drop_privileges)
     APR_HOOK_LINK(mpm)
     APR_HOOK_LINK(mpm_query)
-    APR_HOOK_LINK(mpm_get_child_pid)
     APR_HOOK_LINK(mpm_note_child_killed)
     APR_HOOK_LINK(mpm_register_timed_callback)
     APR_HOOK_LINK(mpm_get_name)
@@ -76,7 +75,6 @@ APR_HOOK_STRUCT(
     APR_HOOK_LINK(drop_privileges)
     APR_HOOK_LINK(mpm)
     APR_HOOK_LINK(mpm_query)
-    APR_HOOK_LINK(mpm_get_child_pid)
     APR_HOOK_LINK(mpm_note_child_killed)
     APR_HOOK_LINK(mpm_register_timed_callback)
     APR_HOOK_LINK(mpm_get_name)
@@ -93,9 +91,6 @@ AP_IMPLEMENT_HOOK_RUN_FIRST(int, mpm,
 AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_query,
                             (int query_code, int *result),
                             (query_code, result), APR_ENOTIMPL)
-AP_IMPLEMENT_HOOK_RUN_FIRST(pid_t, mpm_get_child_pid,
-                            (int childnum),
-                            (childnum), 0)
 AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_note_child_killed,
                             (int childnum),
                             (childnum), APR_ENOTIMPL)
@@ -413,11 +408,6 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
     return ap_run_mpm_query(query_code, result);
 }
 
-AP_DECLARE(pid_t) ap_mpm_get_child_pid(int childnum)
-{
-    return ap_run_mpm_get_child_pid(childnum);
-}
-
 AP_DECLARE(apr_status_t) ap_mpm_note_child_killed(int childnum)
 {
     return ap_run_mpm_note_child_killed(childnum);
index d3137776c335a9ab5b1dbd1e097e113a64c607f2..3333e18fe953345e4aeb2a4eb90523612611e1f7 100644 (file)
@@ -42,6 +42,7 @@
 #include "mpm_common.h"
 #include "ap_mpm.h"
 #include "ap_listen.h"
+#include "scoreboard.h"
 #include "util_mutex.h"
 
 #ifdef HAVE_PWD_H
@@ -217,7 +218,8 @@ void ap_reclaim_child_processes(int terminate)
         /* now see who is done */
         not_dead_yet = 0;
         for (i = 0; i < max_daemons; ++i) {
-            pid_t pid = ap_mpm_get_child_pid(i);
+            process_score *ps = ap_get_scoreboard_process(i);
+            pid_t pid = ps->pid;
 
             if (pid == 0) {
                 continue; /* not every scoreboard entry is in use */
@@ -261,7 +263,8 @@ void ap_relieve_child_processes(void)
 
     /* now see who is done */
     for (i = 0; i < max_daemons; ++i) {
-        pid_t pid = ap_mpm_get_child_pid(i);
+        process_score *ps = ap_get_scoreboard_process(i);
+        pid_t pid = ps->pid;
 
         if (pid == 0) {
             continue; /* not every scoreboard entry is in use */