From 5f0b2584a4dcda2eb716c0de99e8c625fffd429d Mon Sep 17 00:00:00 2001 From: Manoj Kasichainula Date: Sun, 30 Jul 2000 12:03:48 +0000 Subject: [PATCH] Eliminate references to specific MPMs from mpm_common.c by having the MPMs export interfaces to the tables used to keep track of children. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85951 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/beos/mpm.h | 6 ++++++ server/mpm/dexter/mpm.h | 5 +++++ server/mpm/experimental/perchild/mpm.h | 5 +++++ server/mpm/mpmt_beos/mpm.h | 5 +++++ server/mpm/mpmt_pthread/mpm.h | 5 +++++ server/mpm/perchild/mpm.h | 5 +++++ server/mpm/prefork/mpm.h | 5 +++++ server/mpm_common.c | 25 +++++-------------------- 8 files changed, 41 insertions(+), 20 deletions(-) diff --git a/server/mpm/beos/mpm.h b/server/mpm/beos/mpm.h index e792f0cd3d..e6980b21c8 100644 --- a/server/mpm/beos/mpm.h +++ b/server/mpm/beos/mpm.h @@ -60,6 +60,12 @@ #define APACHE_MPM_BEOS_H #define BEOS_MPM + +#define MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 +#define MPM_SYNC_CHILD_TABLE() +#define MPM_CHILD_PID(i) (ap_child_table[i].pid) +#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) + extern int ap_max_child_assigned; #include "scoreboard.h" diff --git a/server/mpm/dexter/mpm.h b/server/mpm/dexter/mpm.h index ffcccc122c..cd7da3c058 100644 --- a/server/mpm/dexter/mpm.h +++ b/server/mpm/dexter/mpm.h @@ -65,6 +65,11 @@ #define DEXTER_MPM +#define MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 +#define MPM_SYNC_CHILD_TABLE() +#define MPM_CHILD_PID(i) (ap_child_table[i].pid) +#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) + /* Table of child status */ #define SERVER_DEAD 0 #define SERVER_DYING 1 diff --git a/server/mpm/experimental/perchild/mpm.h b/server/mpm/experimental/perchild/mpm.h index eef0032dd3..c5c74e74b7 100644 --- a/server/mpm/experimental/perchild/mpm.h +++ b/server/mpm/experimental/perchild/mpm.h @@ -65,6 +65,11 @@ #define PERCHILD_MPM +#define MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 +#define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image()) +#define MPM_CHILD_PID(i) (ap_child_table[i].pid) +#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) + /* Table of child status */ #define SERVER_DEAD 0 #define SERVER_DYING 1 diff --git a/server/mpm/mpmt_beos/mpm.h b/server/mpm/mpmt_beos/mpm.h index 486c8d8981..bc37d4e0f2 100644 --- a/server/mpm/mpmt_beos/mpm.h +++ b/server/mpm/mpmt_beos/mpm.h @@ -62,6 +62,11 @@ #define MPMT_BEOS_MPM +#define MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 +#define MPM_SYNC_CHILD_TABLE() +#define MPM_CHILD_PID(i) (ap_child_table[i].pid) +#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) + #define SERVER_DEAD 0 #define SERVER_DYING 1 #define SERVER_ALIVE 2 diff --git a/server/mpm/mpmt_pthread/mpm.h b/server/mpm/mpmt_pthread/mpm.h index 109d553ef8..3f6e43c464 100644 --- a/server/mpm/mpmt_pthread/mpm.h +++ b/server/mpm/mpmt_pthread/mpm.h @@ -63,6 +63,11 @@ #define MPMT_PTHREAD_MPM +#define MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 +#define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image()) +#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) +#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) + extern int ap_threads_per_child; extern int ap_max_requests_per_child; extern int ap_extended_status; diff --git a/server/mpm/perchild/mpm.h b/server/mpm/perchild/mpm.h index eef0032dd3..c5c74e74b7 100644 --- a/server/mpm/perchild/mpm.h +++ b/server/mpm/perchild/mpm.h @@ -65,6 +65,11 @@ #define PERCHILD_MPM +#define MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 +#define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image()) +#define MPM_CHILD_PID(i) (ap_child_table[i].pid) +#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) + /* Table of child status */ #define SERVER_DEAD 0 #define SERVER_DYING 1 diff --git a/server/mpm/prefork/mpm.h b/server/mpm/prefork/mpm.h index 248591716e..d458c8a0c2 100644 --- a/server/mpm/prefork/mpm.h +++ b/server/mpm/prefork/mpm.h @@ -66,6 +66,11 @@ #define PREFORK_MPM +#define MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1 +#define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image()) +#define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) +#define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) + extern int ap_max_daemons_limit; extern scoreboard *ap_scoreboard_image; extern server_rec *ap_server_conf; diff --git a/server/mpm_common.c b/server/mpm_common.c index 12642a53a0..5825d68f33 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -81,16 +81,7 @@ #include /* for setsockopt prototype */ #endif -#if defined(DEXTER_MPM) || defined(MPMT_BEOS_MPM) || defined(BEOS_MPM) || defined(PERCHILD_MPM) -#define CHILD_TABLE 1 -#define CHILD_INFO_TABLE ap_child_table -#elif defined(MPMT_PTHREAD) || defined(PREFORK_MPM) -#define SCOREBOARD 1 -#define CHILD_INFO_TABLE ap_scoreboard_image->parent -#endif - - -#ifdef CHILD_INFO_TABLE +#ifdef MPM_NEEDS_RECLAIM_CHILD_PROCESSES void ap_reclaim_child_processes(int terminate) { int i; @@ -100,9 +91,7 @@ void ap_reclaim_child_processes(int terminate) int not_dead_yet; int max_daemons = ap_get_max_daemons(); -#ifdef SCOREBOARD - ap_sync_scoreboard_image(); -#endif + MPM_SYNC_CHILD_TABLE(); for (tries = terminate ? 4 : 1; tries <= 9; ++tries) { /* don't want to hold up progress any more than @@ -115,20 +104,16 @@ 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 = CHILD_INFO_TABLE[i].pid; + pid_t pid = MPM_CHILD_PID(i); ap_proc_t proc; -#ifdef CHILD_TABLE if (pid == 0) -#elif defined(SCOREBOARD) - if (pid == ap_my_pid || pid == 0) -#endif continue; proc.pid = pid; waitret = ap_wait_proc(&proc, APR_NOWAIT); if (waitret != APR_CHILD_NOTDONE) { - CHILD_INFO_TABLE[i].pid = 0; + MPM_NOTE_CHILD_KILLED(i); continue; } ++not_dead_yet; @@ -186,7 +171,7 @@ void ap_reclaim_child_processes(int terminate) } } } -#endif +#endif /* NEED_RECLAIM_CHILD_PROCESSES */ /* number of calls to wait_or_timeout between writable probes */ #ifndef INTERVAL_OF_WRITABLE_PROBES -- 2.50.1