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/04/05 19:54:23 UTC

svn commit: r762127 - in /httpd/httpd/trunk: include/ server/ server/mpm/event/ server/mpm/prefork/ server/mpm/simple/ server/mpm/winnt/ server/mpm/worker/

Author: trawick
Date: Sun Apr  5 17:54:22 2009
New Revision: 762127

URL: http://svn.apache.org/viewvc?rev=762127&view=rev
Log:
main() can use ap_run_mpm() directly, so axe the old ap_mpm_run() function

change the mpm hooks to return OK/DONE instead of 0/1

Modified:
    httpd/httpd/trunk/include/ap_mpm.h
    httpd/httpd/trunk/include/mpm_common.h
    httpd/httpd/trunk/server/main.c
    httpd/httpd/trunk/server/mpm/event/event.c
    httpd/httpd/trunk/server/mpm/prefork/prefork.c
    httpd/httpd/trunk/server/mpm/simple/simple_api.c
    httpd/httpd/trunk/server/mpm/simple/simple_run.c
    httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c
    httpd/httpd/trunk/server/mpm/worker/worker.c
    httpd/httpd/trunk/server/mpm_common.c

Modified: httpd/httpd/trunk/include/ap_mpm.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mpm.h?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mpm.h (original)
+++ httpd/httpd/trunk/include/ap_mpm.h Sun Apr  5 17:54:22 2009
@@ -80,16 +80,15 @@
 */
 
 /**
- * This is the function that passes control to the MPM for steady-state
- * processing.  It is responsible for controlling the parent and child
- * processes.  It will run until a restart/shutdown is indicated.
+ * Pass control to the MPM for steady-state processing.  It is responsible
+ * for controlling the parent and child processes.  It will run until a
+ * restart/shutdown is indicated.
  * @param pconf the configuration pool, reset before the config file is read
  * @param plog the log pool, reset after the config file is read
  * @param server_conf the global server config.
- * @return 1 for shutdown 0 otherwise.
- * @fn int ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf)
+ * @return DONE for shutdown OK otherwise.
  */
-AP_DECLARE(int) ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf);
+AP_DECLARE_HOOK(int, mpm, (apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf))
 
 /**
  * Spawn a process with privileges that another module has requested

Modified: httpd/httpd/trunk/include/mpm_common.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/mpm_common.h?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/include/mpm_common.h (original)
+++ httpd/httpd/trunk/include/mpm_common.h Sun Apr  5 17:54:22 2009
@@ -320,9 +320,6 @@
 AP_DECLARE(int) ap_sys_privileges_handlers(int inc);
 AP_DECLARE_HOOK(int, drop_privileges, (apr_pool_t * pchild, server_rec * s))
 
-/* pass control to the MPM */
-AP_DECLARE_HOOK(int, mpm, (apr_pool_t *pconf, apr_pool_t *plog, server_rec *s))
-
 /* implement the ap_mpm_query() function
  * The MPM should return OK+APR_ENOTIMPL for any unimplemented query codes;
  * modules which intercede for specific query codes should DECLINE for others.

Modified: httpd/httpd/trunk/server/main.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/main.c?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/server/main.c (original)
+++ httpd/httpd/trunk/server/main.c Sun Apr  5 17:54:22 2009
@@ -39,7 +39,6 @@
 #include "apr_uri.h"
 #include "util_ebcdic.h"
 #include "ap_mpm.h"
-#include "mpm_common.h"
 #include "ap_expr.h"
 
 #if APR_HAVE_UNISTD_H
@@ -779,7 +778,7 @@
 
         ap_run_optional_fn_retrieve();
 
-        if (ap_mpm_run(pconf, plog, ap_server_conf))
+        if (ap_run_mpm(pconf, plog, ap_server_conf) != OK)
             break;
 
         apr_pool_lock(pconf, 0);

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Sun Apr  5 17:54:22 2009
@@ -2210,7 +2210,7 @@
     if (!is_graceful) {
         if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
             mpm_state = AP_MPMQ_STOPPING;
-            return 1;
+            return DONE;
         }
         /* fix the generation number in the global score; we just got a new,
          * cleared scoreboard
@@ -2278,7 +2278,7 @@
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0,
                          ap_server_conf, "caught SIGTERM, shutting down");
         }
-        return 1;
+        return DONE;
     } else if (shutdown_pending) {
         /* Time to gracefully shut down:
          * Kill child processes, tell them to call child_exit, etc...
@@ -2339,7 +2339,7 @@
         ap_event_pod_killpg(pod, ap_daemons_limit, FALSE);
         ap_reclaim_child_processes(1);
 
-        return 1;
+        return DONE;
     }
 
     /* we've been told to restart */
@@ -2347,7 +2347,7 @@
 
     if (one_process) {
         /* not worth thinking about */
-        return 1;
+        return DONE;
     }
 
     /* advance to the next generation */
@@ -2382,7 +2382,7 @@
                      "SIGHUP received.  Attempting to restart");
     }
 
-    return 0;
+    return OK;
 }
 
 /* This really should be a post_config hook, but the error log is already

Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
+++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Sun Apr  5 17:54:22 2009
@@ -915,7 +915,7 @@
                      "Couldn't create accept lock (%s) (%d)",
                      ap_lock_fname, ap_accept_lock_mech);
         mpm_state = AP_MPMQ_STOPPING;
-        return 1;
+        return DONE;
     }
 
 #if APR_USE_SYSVSEM_SERIALIZE
@@ -930,14 +930,14 @@
                          "Couldn't set permissions on cross-process lock; "
                          "check User and Group directives");
             mpm_state = AP_MPMQ_STOPPING;
-            return 1;
+            return DONE;
         }
     }
 
     if (!is_graceful) {
         if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
             mpm_state = AP_MPMQ_STOPPING;
-            return 1;
+            return DONE;
         }
         /* fix the generation number in the global score; we just got a new,
          * cleared scoreboard
@@ -1008,7 +1008,7 @@
             processed_status = ap_process_child_status(&pid, exitwhy, status);
             if (processed_status == APEXIT_CHILDFATAL) {
                 mpm_state = AP_MPMQ_STOPPING;
-                return 1;
+                return DONE;
             }
 
             /* non-fatal death... note that it's gone in the scoreboard. */
@@ -1095,7 +1095,7 @@
         ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf,
                     "caught SIGTERM, shutting down");
 
-        return 1;
+        return DONE;
     } else if (shutdown_pending) {
         /* Time to perform a graceful shut down:
          * Reap the inactive children, and ask the active ones
@@ -1169,7 +1169,7 @@
          */
         ap_unixd_killpg(getpgrp(), SIGTERM);
 
-        return 1;
+        return DONE;
     }
 
     /* we've been told to restart */
@@ -1177,7 +1177,7 @@
     apr_signal(AP_SIG_GRACEFUL, SIG_IGN);
     if (one_process) {
         /* not worth thinking about */
-        return 1;
+        return DONE;
     }
 
     /* advance to the next generation */
@@ -1223,7 +1223,7 @@
                     "SIGHUP received.  Attempting to restart");
     }
 
-    return 0;
+    return OK;
 }
 
 /* This really should be a post_config hook, but the error log is already

Modified: httpd/httpd/trunk/server/mpm/simple/simple_api.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_api.c?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/simple/simple_api.c (original)
+++ httpd/httpd/trunk/server/mpm/simple/simple_api.c Sun Apr  5 17:54:22 2009
@@ -35,7 +35,7 @@
 
     if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
         sc->mpm_state = AP_MPMQ_STOPPING;
-        return 1;
+        return DONE;
     }
 
     return simple_main_loop(sc);

Modified: httpd/httpd/trunk/server/mpm/simple/simple_run.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/simple/simple_run.c?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/simple/simple_run.c (original)
+++ httpd/httpd/trunk/server/mpm/simple/simple_run.c Sun Apr  5 17:54:22 2009
@@ -177,7 +177,7 @@
             if (!APR_STATUS_IS_EINTR(rv) && !APR_STATUS_IS_TIMEUP(rv)) {
                 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
                              "simple_main_loop: apr_pollcb_poll failed");
-                return !OK;
+                return DONE;
             }
         }
 
@@ -225,7 +225,7 @@
         }
     }
 
-    return 0;
+    return OK;
 }
 
 void simple_single_process_hack(simple_core_t * sc)

Modified: httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/mpm_winnt.c Sun Apr  5 17:54:22 2009
@@ -1671,7 +1671,7 @@
     if (!restart && ((parent_pid == my_pid) || one_process)) {
         /* Set up the scoreboard. */
         if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
-            return 1;
+            return DONE;
         }
     }
 
@@ -1686,7 +1686,7 @@
 
         ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                      "Child %d: Child process is exiting", my_pid);
-        return 1;
+        return DONE;
     }
     else
     {
@@ -1714,11 +1714,11 @@
             CloseHandle(restart_event);
             CloseHandle(shutdown_event);
 
-            return 1;
+            return DONE;
         }
     }
 
-    return 0; /* Restart */
+    return OK; /* Restart */
 }
 
 static void winnt_hooks(apr_pool_t *p)

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Sun Apr  5 17:54:22 2009
@@ -1695,7 +1695,7 @@
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
                      "Couldn't create accept lock");
         mpm_state = AP_MPMQ_STOPPING;
-        return 1;
+        return DONE;
     }
 
 #if APR_USE_SYSVSEM_SERIALIZE
@@ -1710,14 +1710,14 @@
                          "Couldn't set permissions on cross-process lock; "
                          "check User and Group directives");
             mpm_state = AP_MPMQ_STOPPING;
-            return 1;
+            return DONE;
         }
     }
 
     if (!is_graceful) {
         if (ap_run_pre_mpm(s->process->pool, SB_SHARED) != OK) {
             mpm_state = AP_MPMQ_STOPPING;
-            return 1;
+            return DONE;
         }
         /* fix the generation number in the global score; we just got a new,
          * cleared scoreboard
@@ -1788,7 +1788,7 @@
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0,
                          ap_server_conf, "caught SIGTERM, shutting down");
         }
-        return 1;
+        return DONE;
     } else if (shutdown_pending) {
         /* Time to gracefully shut down:
          * Kill child processes, tell them to call child_exit, etc...
@@ -1849,7 +1849,7 @@
         ap_worker_pod_killpg(pod, ap_daemons_limit, FALSE);
         ap_reclaim_child_processes(1);
 
-        return 1;
+        return DONE;
     }
 
     /* we've been told to restart */
@@ -1857,7 +1857,7 @@
 
     if (one_process) {
         /* not worth thinking about */
-        return 1;
+        return DONE;
     }
 
     /* advance to the next generation */

Modified: httpd/httpd/trunk/server/mpm_common.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_common.c?rev=762127&r1=762126&r2=762127&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Sun Apr  5 17:54:22 2009
@@ -398,11 +398,6 @@
     return NULL;
 }
 
-AP_DECLARE(int) ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf)
-{
-    return ap_run_mpm(pconf, plog, server_conf);
-}
-
 AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
 {
     apr_status_t rv;