You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2009/03/29 21:30:17 UTC

svn commit: r759757 - in /httpd/httpd/trunk: include/mpm_common.h server/mpm/event/event.c server/mpm/prefork/prefork.c server/mpm/worker/worker.c server/mpm_common.c server/mpm_unix.c

Author: trawick
Date: Sun Mar 29 19:30:17 2009
New Revision: 759757

URL: http://svn.apache.org/viewvc?rev=759757&view=rev
Log:
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

Modified:
    httpd/httpd/trunk/include/mpm_common.h
    httpd/httpd/trunk/server/mpm/event/event.c
    httpd/httpd/trunk/server/mpm/prefork/prefork.c
    httpd/httpd/trunk/server/mpm/worker/worker.c
    httpd/httpd/trunk/server/mpm_common.c
    httpd/httpd/trunk/server/mpm_unix.c

Modified: httpd/httpd/trunk/include/mpm_common.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/mpm_common.h?rev=759757&r1=759756&r2=759757&view=diff
==============================================================================
--- httpd/httpd/trunk/include/mpm_common.h (original)
+++ httpd/httpd/trunk/include/mpm_common.h Sun Mar 29 19:30:17 2009
@@ -86,8 +86,7 @@
  * @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
  *        on its own before signalling it.
- * @tip This function requires that some hooks are implemented by the MPM: <pre>
- *  mpm_get_child_pid -- Get the pid from the specified spot in the scoreboard
+ * @tip This function requires that a hook is implemented by the MPM: <pre>
  *  mpm_note_child_killed -- Note the child died in the scoreboard
  * </pre>
  * @tip The MPM child processes which are reclaimed are those listed
@@ -99,8 +98,7 @@
 /**
  * Catch any child processes that have been spawned by the parent process
  * which have exited. This includes processes registered as "other_children".
- * @tip This function requires that some hooks are implemented by the MPM: <pre>
- *  mpm_get_child_pid -- Get the pid from the specified spot in the scoreboard
+ * @tip This function requires that a hook is implemented by the MPM: <pre>
  *  mpm_note_child_killed -- Note the child died in the scoreboard
  * </pre>
  * @tip The MPM child processes which are relieved are those listed
@@ -314,7 +312,6 @@
                                              const char *arg);
 #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_HOOK(int,monitor,(apr_pool_t *p))
@@ -329,9 +326,6 @@
 /* implement the mpm query function */
 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 */
 AP_DECLARE_HOOK(apr_status_t, mpm_note_child_killed, (int childnum))
 

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=759757&r1=759756&r2=759757&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Sun Mar 29 19:30:17 2009
@@ -404,11 +404,6 @@
     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)
 {
     ap_scoreboard_image->parent[childnum].pid = 0;
@@ -2744,7 +2739,6 @@
     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_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_register_timed_callback(event_register_timed_callback, NULL, NULL,
                                         APR_HOOK_MIDDLE);

Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=759757&r1=759756&r2=759757&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
+++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Sun Mar 29 19:30:17 2009
@@ -291,11 +291,6 @@
     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)
 {
     ap_scoreboard_image->parent[childnum].pid = 0;
@@ -1458,7 +1453,6 @@
     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_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_get_name(prefork_get_name, NULL, NULL, APR_HOOK_MIDDLE);
 }

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=759757&r1=759756&r2=759757&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Sun Mar 29 19:30:17 2009
@@ -354,11 +354,6 @@
     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)
 {
     ap_scoreboard_image->parent[childnum].pid = 0;
@@ -2245,7 +2240,6 @@
     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_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_get_name(worker_get_name, NULL, NULL, APR_HOOK_MIDDLE);
 }

Modified: httpd/httpd/trunk/server/mpm_common.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_common.c?rev=759757&r1=759756&r2=759757&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Sun Mar 29 19:30:17 2009
@@ -63,7 +63,6 @@
     APR_HOOK_LINK(drop_privileges)
     APR_HOOK_LINK(mpm)
     APR_HOOK_LINK(mpm_query)
-    APR_HOOK_LINK(mpm_get_child_pid)
     APR_HOOK_LINK(mpm_note_child_killed)
     APR_HOOK_LINK(mpm_register_timed_callback)
     APR_HOOK_LINK(mpm_get_name)
@@ -76,7 +75,6 @@
     APR_HOOK_LINK(drop_privileges)
     APR_HOOK_LINK(mpm)
     APR_HOOK_LINK(mpm_query)
-    APR_HOOK_LINK(mpm_get_child_pid)
     APR_HOOK_LINK(mpm_note_child_killed)
     APR_HOOK_LINK(mpm_register_timed_callback)
     APR_HOOK_LINK(mpm_get_name)
@@ -93,9 +91,6 @@
 AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, mpm_query,
                             (int query_code, int *result),
                             (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,
                             (int childnum),
                             (childnum), APR_ENOTIMPL)
@@ -413,11 +408,6 @@
     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)
 {
     return ap_run_mpm_note_child_killed(childnum);

Modified: httpd/httpd/trunk/server/mpm_unix.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_unix.c?rev=759757&r1=759756&r2=759757&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_unix.c (original)
+++ httpd/httpd/trunk/server/mpm_unix.c Sun Mar 29 19:30:17 2009
@@ -42,6 +42,7 @@
 #include "mpm_common.h"
 #include "ap_mpm.h"
 #include "ap_listen.h"
+#include "scoreboard.h"
 #include "util_mutex.h"
 
 #ifdef HAVE_PWD_H
@@ -217,7 +218,8 @@
         /* now see who is done */
         not_dead_yet = 0;
         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) {
                 continue; /* not every scoreboard entry is in use */
@@ -261,7 +263,8 @@
 
     /* now see who is done */
     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) {
             continue; /* not every scoreboard entry is in use */