httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r240465 - in /httpd/httpd/trunk: include/mpm_common.h server/mpm_common.c
Date Sat, 27 Aug 2005 22:12:12 GMT
Author: colm
Date: Sat Aug 27 15:12:08 2005
New Revision: 240465

URL: http://svn.apache.org/viewcvs?rev=240465&view=rev
Log:

Add ap_relieve_child_processess(), a non-infanticidal copy of
ap_reclaim_child_processes(). Allows us to waitpid() each process in the
scoreboard and each "extra" process with a single call.


Modified:
    httpd/httpd/trunk/include/mpm_common.h
    httpd/httpd/trunk/server/mpm_common.c

Modified: httpd/httpd/trunk/include/mpm_common.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/include/mpm_common.h?rev=240465&r1=240464&r2=240465&view=diff
==============================================================================
--- httpd/httpd/trunk/include/mpm_common.h (original)
+++ httpd/httpd/trunk/include/mpm_common.h Sat Aug 27 15:12:08 2005
@@ -95,8 +95,25 @@
 #endif
 
 /**
- * Tell ap_reclaim_child_processes() about an MPM child process which has no
- * entry in the scoreboard.
+ * Catch any child processes that have been spawned by the parent process
+ * which have exited. This includes processes registered as "other_children".
+ * @warning This is only defined if the MPM defines 
+ *          AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
+ * @tip This function requires that some macros are defined by the MPM: <pre>
+ *  MPM_CHILD_PID -- Get the pid from the specified spot in the scoreboard
+ *  MPM_NOTE_CHILD_KILLED -- Note the child died in the scoreboard
+ * </pre>
+ * @tip The MPM child processes which are relieved are those listed
+ * in the scoreboard as well as those currently registered via
+ * ap_register_extra_mpm_process().
+ */
+#ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
+void ap_relieve_child_processes(void);
+#endif
+
+/**
+ * Tell ap_reclaim_child_processes() and ap_relieve_child_processes() about 
+ * an MPM child process which has no entry in the scoreboard.
  * @warning This is only defined if the MPM defines
  *          AP_MPM_WANT_RECLAIM_CHILD_PROCESSES
  * @param pid The process id of an MPM child process which should be

Modified: httpd/httpd/trunk/server/mpm_common.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/mpm_common.c?rev=240465&r1=240464&r2=240465&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Sat Aug 27 15:12:08 2005
@@ -273,6 +273,38 @@
     } while (not_dead_yet > 0 &&
              action_table[cur_action].action != GIVEUP);
 }
+
+void ap_relieve_child_processes(void)
+{
+    int i;
+    extra_process_t *cur_extra;
+    int max_daemons;
+
+    ap_mpm_query(AP_MPMQ_MAX_DAEMON_USED, &max_daemons);
+
+    /* now see who is done */
+    for (i = 0; i < max_daemons; ++i) {
+        pid_t pid = MPM_CHILD_PID(i);
+
+        if (pid == 0) {
+            continue; /* not every scoreboard entry is in use */
+        }
+
+        if (reclaim_one_pid(pid, DO_NOTHING)) {
+            MPM_NOTE_CHILD_KILLED(i);
+        }
+    }
+
+    cur_extra = extras;
+    while (cur_extra) {
+        extra_process_t *next = cur_extra->next;
+
+        if (reclaim_one_pid(cur_extra->pid, DO_NOTHING)) {
+            AP_DEBUG_ASSERT(1 == ap_unregister_extra_mpm_process(cur_extra->pid));
+        }
+        cur_extra = next;
+    }
+}
 #endif /* AP_MPM_WANT_RECLAIM_CHILD_PROCESSES */
 
 #ifdef AP_MPM_WANT_WAIT_OR_TIMEOUT



Mime
View raw message