From 35e3599b25f9331d242420b3ffb1dd54af755e0c Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Sun, 29 Mar 2009 19:30:17 +0000 Subject: [PATCH] the mpm_get_child_pid hook is unnecessary, as was the per-MPM MPM_CHILD_PID() macro which it replaced 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 | 10 ++-------- server/mpm/event/event.c | 6 ------ server/mpm/prefork/prefork.c | 6 ------ server/mpm/worker/worker.c | 6 ------ server/mpm_common.c | 10 ---------- server/mpm_unix.c | 7 +++++-- 6 files changed, 7 insertions(+), 38 deletions(-) diff --git a/include/mpm_common.h b/include/mpm_common.h index a3cde481d7..ce86ab12bf 100644 --- a/include/mpm_common.h +++ b/include/mpm_common.h @@ -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:
- *  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: 
  *  mpm_note_child_killed -- Note the child died in the scoreboard
  * 
* @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:
- *  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: 
  *  mpm_note_child_killed -- Note the child died in the scoreboard
  * 
* @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)) diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 71c7bd90fb..e6299092d2 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -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); diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 553355deac..9f65a754b7 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -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); } diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index f486c9762e..8f502b26e3 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -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); } diff --git a/server/mpm_common.c b/server/mpm_common.c index 2d365434b8..597e388960 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -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); diff --git a/server/mpm_unix.c b/server/mpm_unix.c index d3137776c3..3333e18fe9 100644 --- a/server/mpm_unix.c +++ b/server/mpm_unix.c @@ -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 */ -- 2.50.1