You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2010/08/21 20:06:41 UTC

svn commit: r987806 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h include/mpm_common.h server/config.c server/mpm_common.c

Author: sf
Date: Sat Aug 21 18:06:41 2010
New Revision: 987806

URL: http://svn.apache.org/viewvc?rev=987806&view=rev
Log:
core: Abort with sensible error message if no or more than one MPM is
loaded.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/include/ap_mmn.h
    httpd/httpd/trunk/include/mpm_common.h
    httpd/httpd/trunk/server/config.c
    httpd/httpd/trunk/server/mpm_common.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=987806&r1=987805&r2=987806&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Aug 21 18:06:41 2010
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.8
 
+  *) core: Abort with sensible error message if no or more than one MPM is
+     loaded. [Stefan Fritsch]
+
   *) mod_proxy: Rename erroronstatus to failonstatus.
      [Daniel Ruggeri <DRuggeri primary.net>]
 

Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=987806&r1=987805&r2=987806&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Sat Aug 21 18:06:41 2010
@@ -244,6 +244,7 @@
  * 20100723.1 (2.3.7-dev)  Added ap_proxy_hashfunc() and hash elements to
  *                         proxy worker structs
  * 20100723.2 (2.3.7-dev)  Add ap_request_has_body()
+ * 20100723.3 (2.3.8-dev)  Add ap_check_mpm()
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -251,7 +252,7 @@
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20100723
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 2                     /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 3                     /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a

Modified: httpd/httpd/trunk/include/mpm_common.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/mpm_common.h?rev=987806&r1=987805&r2=987806&view=diff
==============================================================================
--- httpd/httpd/trunk/include/mpm_common.h (original)
+++ httpd/httpd/trunk/include/mpm_common.h Sat Aug 21 18:06:41 2010
@@ -242,6 +242,12 @@ AP_DECLARE(apr_status_t) ap_mpm_pod_sign
  */
 AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num);
 
+/**
+ * Check that exactly one MPM is loaded
+ * Returns NULL if yes, error string if not.
+ */
+AP_DECLARE(const char *) ap_check_mpm(void);
+
 /*
  * These data members are common to all mpms. Each new mpm
  * should either use the appropriate ap_mpm_set_* function

Modified: httpd/httpd/trunk/server/config.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/config.c?rev=987806&r1=987805&r2=987806&view=diff
==============================================================================
--- httpd/httpd/trunk/server/config.c (original)
+++ httpd/httpd/trunk/server/config.c Sat Aug 21 18:06:41 2010
@@ -49,6 +49,7 @@
 #include "http_main.h"
 #include "http_vhost.h"
 #include "util_cfgtree.h"
+#include "mpm_common.h"
 
 #define APLOG_UNSET   (APLOG_NO_MODULE - 1)
 APLOG_USE_MODULE(core);
@@ -2242,6 +2243,13 @@ AP_DECLARE(server_rec*) ap_read_config(p
         return NULL;
     }
 
+    error = ap_check_mpm();
+    if (error) {
+        ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, 0, NULL,
+                     "%s: Configuration error: %s", ap_server_argv0, error);
+        return NULL;
+    }
+
     /*
      * We have loaded the dynamic modules. From now on we know exactly how
      * long the config vectors need to be.

Modified: httpd/httpd/trunk/server/mpm_common.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_common.c?rev=987806&r1=987805&r2=987806&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Sat Aug 21 18:06:41 2010
@@ -375,3 +375,13 @@ AP_DECLARE(const char *)ap_show_mpm(void
 
     return name;
 }
+
+AP_DECLARE(const char *)ap_check_mpm(void)
+{
+    if (!_hooks.link_mpm || _hooks.link_mpm->nelts == 0)
+        return "No MPM loaded.";
+    else if (_hooks.link_mpm->nelts > 1)
+        return "More than one MPM loaded.";
+    else
+        return NULL;
+}