]> granicus.if.org Git - apache/commitdiff
main() can use ap_run_mpm() directly, so axe the old ap_mpm_run() function
authorJeff Trawick <trawick@apache.org>
Sun, 5 Apr 2009 17:54:22 +0000 (17:54 +0000)
committerJeff Trawick <trawick@apache.org>
Sun, 5 Apr 2009 17:54:22 +0000 (17:54 +0000)
change the mpm hooks to return OK/DONE instead of 0/1

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@762127 13f79535-47bb-0310-9956-ffa450edef68

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

index d5844a912c7c6050d87649e5912583c78a6d4251..3a0da9de5d316bbdd0b49fa59082c6326af80e6e 100644 (file)
@@ -80,16 +80,15 @@ extern "C" {
 */
 
 /**
- * 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
index 511ae1cd7cd932a4f0f6504d199c3c9ead9ee73d..0e8143b5c38b7b6143c2083e2d4bf27ab781cab2 100644 (file)
@@ -320,9 +320,6 @@ AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p))
 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.
index 948c56f7d67c3e45719da77f8719f8599ef39bb9..d44ee4e796b61b88d00da6d3c70a5a0830f889ca 100644 (file)
@@ -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 @@ int main(int argc, const char * const argv[])
 
         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);
index fac39c49b882c786f7787e4e7e041b8074cf43c5..84bd2a6831049520ab7dbba63a2f58652a76c04f 100644 (file)
@@ -2210,7 +2210,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
     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 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
             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 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
         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 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
 
     if (one_process) {
         /* not worth thinking about */
-        return 1;
+        return DONE;
     }
 
     /* advance to the next generation */
@@ -2382,7 +2382,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
                      "SIGHUP received.  Attempting to restart");
     }
 
-    return 0;
+    return OK;
 }
 
 /* This really should be a post_config hook, but the error log is already
index 3b9d4fd6cbd4db440668334d0ba6e57a9e8cd877..d1559c7997fb1808ae515818efa7594644b0fb2f 100644 (file)
@@ -915,7 +915,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
                      "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 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
                          "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 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
             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 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
         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 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
          */
         ap_unixd_killpg(getpgrp(), SIGTERM);
 
-        return 1;
+        return DONE;
     }
 
     /* we've been told to restart */
@@ -1177,7 +1177,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
     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 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
                     "SIGHUP received.  Attempting to restart");
     }
 
-    return 0;
+    return OK;
 }
 
 /* This really should be a post_config hook, but the error log is already
index 24b4a6af310e0f3977315b609806385a5816f33c..1023cd6fa42696d58adfde840f0c56dcc2fe0da0 100644 (file)
@@ -35,7 +35,7 @@ static int simple_run(apr_pool_t * pconf, apr_pool_t * plog, server_rec * s)
 
     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);
index 0004885273a759256efbc7024347cae857c535e8..3ac7046943deed51b5c1c8f6e402f21fb4e581b4 100644 (file)
@@ -177,7 +177,7 @@ static int simple_run_loop(simple_core_t * sc)
             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 @@ static int simple_run_loop(simple_core_t * sc)
         }
     }
 
-    return 0;
+    return OK;
 }
 
 void simple_single_process_hack(simple_core_t * sc)
index dcbf00d5ea1072c373659f81ad48b5d9b1130161..6cac77a99cab37ab5cf91195d40fbfde968c8f28 100644 (file)
@@ -1671,7 +1671,7 @@ static int winnt_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
     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 @@ static int winnt_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
 
         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 @@ static int winnt_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
             CloseHandle(restart_event);
             CloseHandle(shutdown_event);
 
-            return 1;
+            return DONE;
         }
     }
 
-    return 0; /* Restart */
+    return OK; /* Restart */
 }
 
 static void winnt_hooks(apr_pool_t *p)
index 9971162b155d366a35070ab9082f735036e45b85..45840328b8768b9dff4319e7e16ddae26fcb9a40 100644 (file)
@@ -1695,7 +1695,7 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
         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 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
                          "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 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
             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 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
         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 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     if (one_process) {
         /* not worth thinking about */
-        return 1;
+        return DONE;
     }
 
     /* advance to the next generation */
index 59e175306f00d1f3a694ffa5bda6fb649652aab6..e7af61db8a7bfdf12b5218e18714f6f190897aed 100644 (file)
@@ -398,11 +398,6 @@ const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy,
     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;