1
0
mirror of https://github.com/apache/httpd.git synced 2025-10-31 19:10:37 +03:00

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
This commit is contained in:
Jeff Trawick
2009-03-29 19:30:17 +00:00
parent 2103ba72a1
commit 35e3599b25
6 changed files with 7 additions and 38 deletions

View File

@@ -86,8 +86,7 @@ extern "C" {
* @param terminate Either 1 or 0. If 1, send the child processes SIGTERM * @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 * each time through the loop. If 0, give the process time to die
* on its own before signalling it. * on its own before signalling it.
* @tip This function requires that some hooks are implemented by the MPM: <pre> * @tip This function requires that a hook is implemented by the MPM: <pre>
* mpm_get_child_pid -- Get the pid from the specified spot in the scoreboard
* mpm_note_child_killed -- Note the child died in the scoreboard * mpm_note_child_killed -- Note the child died in the scoreboard
* </pre> * </pre>
* @tip The MPM child processes which are reclaimed are those listed * @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 * Catch any child processes that have been spawned by the parent process
* which have exited. This includes processes registered as "other_children". * which have exited. This includes processes registered as "other_children".
* @tip This function requires that some hooks are implemented by the MPM: <pre> * @tip This function requires that a hook is implemented by the MPM: <pre>
* mpm_get_child_pid -- Get the pid from the specified spot in the scoreboard
* mpm_note_child_killed -- Note the child died in the scoreboard * mpm_note_child_killed -- Note the child died in the scoreboard
* </pre> * </pre>
* @tip The MPM child processes which are relieved are those listed * @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); const char *arg);
#endif #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(apr_status_t) ap_mpm_note_child_killed(int childnum);
AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p)) 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 */ /* implement the mpm query function */
AP_DECLARE_HOOK(apr_status_t, mpm_query, (int query_code, int *result)) 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 */ /* child specified by index has been killed */
AP_DECLARE_HOOK(apr_status_t, mpm_note_child_killed, (int childnum)) AP_DECLARE_HOOK(apr_status_t, mpm_note_child_killed, (int childnum))

View File

@@ -404,11 +404,6 @@ static apr_status_t event_query(int query_code, int *result)
return APR_ENOTIMPL; 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) static apr_status_t event_note_child_killed(int childnum)
{ {
ap_scoreboard_image->parent[childnum].pid = 0; 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_check_config(event_check_config, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_mpm(event_run, 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_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_note_child_killed(event_note_child_killed, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_mpm_register_timed_callback(event_register_timed_callback, NULL, NULL, ap_hook_mpm_register_timed_callback(event_register_timed_callback, NULL, NULL,
APR_HOOK_MIDDLE); APR_HOOK_MIDDLE);

View File

@@ -291,11 +291,6 @@ static apr_status_t prefork_query(int query_code, int *result)
return APR_ENOTIMPL; 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) static apr_status_t prefork_note_child_killed(int childnum)
{ {
ap_scoreboard_image->parent[childnum].pid = 0; 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_check_config(prefork_check_config, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_mpm(prefork_run, 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_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_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); ap_hook_mpm_get_name(prefork_get_name, NULL, NULL, APR_HOOK_MIDDLE);
} }

View File

@@ -354,11 +354,6 @@ static apr_status_t worker_query(int query_code, int *result)
return APR_ENOTIMPL; 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) static apr_status_t worker_note_child_killed(int childnum)
{ {
ap_scoreboard_image->parent[childnum].pid = 0; 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_check_config(worker_check_config, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_mpm(worker_run, 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_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_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); ap_hook_mpm_get_name(worker_get_name, NULL, NULL, APR_HOOK_MIDDLE);
} }

View File

@@ -63,7 +63,6 @@ APR_HOOK_STRUCT(
APR_HOOK_LINK(drop_privileges) APR_HOOK_LINK(drop_privileges)
APR_HOOK_LINK(mpm) APR_HOOK_LINK(mpm)
APR_HOOK_LINK(mpm_query) APR_HOOK_LINK(mpm_query)
APR_HOOK_LINK(mpm_get_child_pid)
APR_HOOK_LINK(mpm_note_child_killed) APR_HOOK_LINK(mpm_note_child_killed)
APR_HOOK_LINK(mpm_register_timed_callback) APR_HOOK_LINK(mpm_register_timed_callback)
APR_HOOK_LINK(mpm_get_name) APR_HOOK_LINK(mpm_get_name)
@@ -76,7 +75,6 @@ APR_HOOK_STRUCT(
APR_HOOK_LINK(drop_privileges) APR_HOOK_LINK(drop_privileges)
APR_HOOK_LINK(mpm) APR_HOOK_LINK(mpm)
APR_HOOK_LINK(mpm_query) APR_HOOK_LINK(mpm_query)
APR_HOOK_LINK(mpm_get_child_pid)
APR_HOOK_LINK(mpm_note_child_killed) APR_HOOK_LINK(mpm_note_child_killed)
APR_HOOK_LINK(mpm_register_timed_callback) APR_HOOK_LINK(mpm_register_timed_callback)
APR_HOOK_LINK(mpm_get_name) 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, AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_query,
(int query_code, int *result), (int query_code, int *result),
(query_code, result), APR_ENOTIMPL) (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, AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_note_child_killed,
(int childnum), (int childnum),
(childnum), APR_ENOTIMPL) (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); 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) AP_DECLARE(apr_status_t) ap_mpm_note_child_killed(int childnum)
{ {
return ap_run_mpm_note_child_killed(childnum); return ap_run_mpm_note_child_killed(childnum);

View File

@@ -42,6 +42,7 @@
#include "mpm_common.h" #include "mpm_common.h"
#include "ap_mpm.h" #include "ap_mpm.h"
#include "ap_listen.h" #include "ap_listen.h"
#include "scoreboard.h"
#include "util_mutex.h" #include "util_mutex.h"
#ifdef HAVE_PWD_H #ifdef HAVE_PWD_H
@@ -217,7 +218,8 @@ void ap_reclaim_child_processes(int terminate)
/* now see who is done */ /* now see who is done */
not_dead_yet = 0; not_dead_yet = 0;
for (i = 0; i < max_daemons; ++i) { 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) { if (pid == 0) {
continue; /* not every scoreboard entry is in use */ continue; /* not every scoreboard entry is in use */
@@ -261,7 +263,8 @@ void ap_relieve_child_processes(void)
/* now see who is done */ /* now see who is done */
for (i = 0; i < max_daemons; ++i) { 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) { if (pid == 0) {
continue; /* not every scoreboard entry is in use */ continue; /* not every scoreboard entry is in use */