From: Manoj Kasichainula Date: Sun, 30 Jul 2000 11:49:29 +0000 (+0000) Subject: Change semantics of ap_child_table somewhat. Instead of checking for a X-Git-Tag: APACHE_2_0_ALPHA_5~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de6d7efcca236b129e2aedc3d6b7255b8d207b63;p=apache Change semantics of ap_child_table somewhat. Instead of checking for a dead process with status == SERVER_DEAD, check with pid == 0. This makes somewhat more sense conceptually, and also matches the behavior of MPMs that use a shmem scoreboard to track children. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85950 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index 4eda2e69d9..d65a42a869 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -237,7 +237,7 @@ static void tell_workers_to_exit(void) int i, code = 99; for (i=0;i= 0) { - ap_child_table[child_slot].status = SERVER_DEAD; + ap_child_table[child_slot].pid = 0; if (remaining_threads_to_start && child_slot < ap_thread_limit) { diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index 88ccc52f91..1cf9f5fa64 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -819,7 +819,7 @@ static int startup_children(int number_to_start) int i; for (i = 0; number_to_start && i < num_daemons; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { + if (ap_child_table[i].pid) { continue; } if (make_child(ap_server_conf, i, 0) < 0) { @@ -855,7 +855,7 @@ static void perform_child_maintenance(void) free_length = 0; for (i = 0; i < num_daemons; ++i) { - if (ap_child_table[i].status == SERVER_DEAD) { + if (ap_child_table[i].pid == 0) { if (free_length < spawn_rate) { free_slots[free_length] = i; ++free_length; @@ -917,7 +917,7 @@ static void server_main_loop(int remaining_children_to_start) } } if (child_slot >= 0) { - ap_child_table[child_slot].status = SERVER_DEAD; + ap_child_table[child_slot].pid = 0; if (remaining_children_to_start && child_slot < num_daemons) { @@ -1017,7 +1017,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) /* Initialize the child table */ if (!is_graceful) { for (i = 0; i < HARD_SERVER_LIMIT; i++) { - ap_child_table[i].status = SERVER_DEAD; + ap_child_table[i].pid = 0; } } @@ -1097,7 +1097,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) */ for (i = 0; i < num_daemons; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { + if (ap_child_table[i].pid) { ap_child_table[i].status = SERVER_DYING; } } diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index a00c86e2cb..e68290d1a0 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -985,7 +985,7 @@ static int startup_children(int number_to_start) int i; for (i = 0; number_to_start && i < num_daemons; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { + if (ap_child_table[i].pid) { continue; } if (make_child(ap_server_conf, i, 0) < 0) { @@ -1021,7 +1021,7 @@ static void perform_child_maintenance(void) free_length = 0; for (i = 0; i < num_daemons; ++i) { - if (ap_child_table[i].status == SERVER_DEAD) { + if (ap_child_table[i].pid == 0) { if (free_length < spawn_rate) { free_slots[free_length] = i; ++free_length; @@ -1083,7 +1083,7 @@ static void server_main_loop(int remaining_children_to_start) } } if (child_slot >= 0) { - ap_child_table[child_slot].status = SERVER_DEAD; + ap_child_table[child_slot].pid = 0; if (remaining_children_to_start && child_slot < num_daemons) { @@ -1183,7 +1183,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) /* Initialize the child table */ if (!is_graceful) { for (i = 0; i < HARD_SERVER_LIMIT; i++) { - ap_child_table[i].status = SERVER_DEAD; + ap_child_table[i].pid = 0; } } @@ -1263,7 +1263,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) */ for (i = 0; i < num_daemons; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { + if (ap_child_table[i].pid) { ap_child_table[i].status = SERVER_DYING; } } diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index 0efb411677..e7aad6d224 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -553,7 +553,7 @@ static void startup_children(int number_to_start) int i; for (i = 0; number_to_start && i < ap_daemons_limit; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { + if (ap_child_table[i].pid) { continue; } if (make_child(ap_server_conf, i, 0) < 0) { @@ -588,7 +588,7 @@ static void perform_idle_server_maintenance(void) free_length = 0; for (i = 0; i < ap_daemons_limit; ++i) { - if (ap_child_table[i].status == SERVER_DEAD) { + if (ap_child_table[i].pid == 0) { if (free_length < spawn_rate) { free_slots[free_length] = i; ++free_length; @@ -647,7 +647,7 @@ static void server_main_loop(int remaining_children_to_start) } } if (child_slot >= 0) { - ap_child_table[child_slot].status = SERVER_DEAD; + ap_child_table[child_slot].pid = 0; if (remaining_children_to_start && child_slot < ap_daemons_limit) { @@ -807,7 +807,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) /* give the children the signal to die */ for (i = 0; i < ap_daemons_limit;) { - if(ap_child_table[i].status != SERVER_DEAD) { + if(ap_child_table[i].pid) { if (write_port(port_of_death, 99, &char_of_death, 1) != B_OK) { if (errno == EINTR) continue; ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index a00c86e2cb..e68290d1a0 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -985,7 +985,7 @@ static int startup_children(int number_to_start) int i; for (i = 0; number_to_start && i < num_daemons; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { + if (ap_child_table[i].pid) { continue; } if (make_child(ap_server_conf, i, 0) < 0) { @@ -1021,7 +1021,7 @@ static void perform_child_maintenance(void) free_length = 0; for (i = 0; i < num_daemons; ++i) { - if (ap_child_table[i].status == SERVER_DEAD) { + if (ap_child_table[i].pid == 0) { if (free_length < spawn_rate) { free_slots[free_length] = i; ++free_length; @@ -1083,7 +1083,7 @@ static void server_main_loop(int remaining_children_to_start) } } if (child_slot >= 0) { - ap_child_table[child_slot].status = SERVER_DEAD; + ap_child_table[child_slot].pid = 0; if (remaining_children_to_start && child_slot < num_daemons) { @@ -1183,7 +1183,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) /* Initialize the child table */ if (!is_graceful) { for (i = 0; i < HARD_SERVER_LIMIT; i++) { - ap_child_table[i].status = SERVER_DEAD; + ap_child_table[i].pid = 0; } } @@ -1263,7 +1263,7 @@ int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s) */ for (i = 0; i < num_daemons; ++i) { - if (ap_child_table[i].status != SERVER_DEAD) { + if (ap_child_table[i].pid) { ap_child_table[i].status = SERVER_DYING; } } diff --git a/server/mpm_common.c b/server/mpm_common.c index b9c844b664..12642a53a0 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -119,7 +119,7 @@ void ap_reclaim_child_processes(int terminate) ap_proc_t proc; #ifdef CHILD_TABLE - if (ap_child_table[i].status == SERVER_DEAD) + if (pid == 0) #elif defined(SCOREBOARD) if (pid == ap_my_pid || pid == 0) #endif @@ -128,11 +128,7 @@ void ap_reclaim_child_processes(int terminate) proc.pid = pid; waitret = ap_wait_proc(&proc, APR_NOWAIT); if (waitret != APR_CHILD_NOTDONE) { -#ifdef CHILD_TABLE - ap_child_table[i].status = SERVER_DEAD; -#elif defined(SCOREBOARD) - ap_scoreboard_image->parent[i].pid = 0; -#endif + CHILD_INFO_TABLE[i].pid = 0; continue; } ++not_dead_yet;