]> granicus.if.org Git - apache/commitdiff
Change semantics of ap_child_table somewhat. Instead of checking for a
authorManoj Kasichainula <manoj@apache.org>
Sun, 30 Jul 2000 11:49:29 +0000 (11:49 +0000)
committerManoj Kasichainula <manoj@apache.org>
Sun, 30 Jul 2000 11:49:29 +0000 (11:49 +0000)
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

server/mpm/beos/beos.c
server/mpm/dexter/dexter.c
server/mpm/experimental/perchild/perchild.c
server/mpm/mpmt_beos/mpmt_beos.c
server/mpm/perchild/perchild.c
server/mpm_common.c

index 4eda2e69d9d9dda071c04030b0b99c7b220ea286..d65a42a869b50a6df36a2533c76d503ff38f8f04 100644 (file)
@@ -237,7 +237,7 @@ static void tell_workers_to_exit(void)
     int i, code = 99;
 
     for (i=0;i<ap_max_child_assigned;i++) {
-        if (ap_child_table[i].status != SERVER_DEAD)
+        if (ap_child_table[i].pid)
             write_port(port_of_death, code, NULL, 0);
     }
 }
@@ -520,7 +520,7 @@ static void startup_threads(int number_to_start)
     int i;
 
     for (i = 0; number_to_start && i < ap_thread_limit; ++i) {
-       if (ap_child_table[i].status  != SERVER_DEAD) {
+       if (ap_child_table[i].pid) {
            continue;
        }
        if (make_worker(ap_server_conf, i, 0) < 0) {
@@ -555,7 +555,7 @@ static void perform_idle_server_maintenance(void)
     free_length = 0;
 
     for (i = 0; i < ap_thread_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;
@@ -614,7 +614,7 @@ static void server_main_loop(int remaining_threads_to_start)
                 }
             }
             if (child_slot >= 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) {
index 88ccc52f91932a1da2a154a5ee1b0d9ced536f4f..1cf9f5fa64bb8a2f02a82ffbbbfd6d6d38117d20 100644 (file)
@@ -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;
            } 
        }
index a00c86e2cb04b98d1e1320b5afd2af59d2fd4eb4..e68290d1a0ea8543f27695fae5ea308b836ec25c 100644 (file)
@@ -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;
            } 
        }
index 0efb41167720e0fc881dd7ce9e44fe3d30a569d3..e7aad6d22455c7c39c5f92081f76d507bdb70f37 100644 (file)
@@ -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,
index a00c86e2cb04b98d1e1320b5afd2af59d2fd4eb4..e68290d1a0ea8543f27695fae5ea308b836ec25c 100644 (file)
@@ -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;
            } 
        }
index b9c844b6645564dcfff019784620d23d79c7d0bc..12642a53a0e1fa8f3f9771699d5ab43c397d31b2 100644 (file)
@@ -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;