]> granicus.if.org Git - apache/commitdiff
Add more options to the ap_mpm_query function. This also allows MPMs to
authorRyan Bloom <rbb@apache.org>
Fri, 13 Apr 2001 19:00:39 +0000 (19:00 +0000)
committerRyan Bloom <rbb@apache.org>
Fri, 13 Apr 2001 19:00:39 +0000 (19:00 +0000)
report if their threads are dynamic or static.  Finally, this also
implements a new API, ap_show_mpm, which returns the MPM that was
required into the core.

We tried to make all of the MPMs report their threading capabilities
correctly, but each MPM expert should double check us.

Submitted by: Harrie Hazewinkel <harrie@covalent.net>

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

17 files changed:
include/ap_mpm.h
modules/generators/mod_info.c
server/config.c
server/mpm/beos/beos.c
server/mpm/beos/mpm.h
server/mpm/experimental/perchild/mpm.h
server/mpm/experimental/perchild/perchild.c
server/mpm/perchild/mpm.h
server/mpm/perchild/perchild.c
server/mpm/prefork/mpm.h
server/mpm/prefork/prefork.c
server/mpm/spmt_os2/mpm.h
server/mpm/spmt_os2/spmt_os2.c
server/mpm/threaded/mpm.h
server/mpm/threaded/threaded.c
server/mpm/winnt/mpm.h
server/mpm/winnt/mpm_winnt.c

index 549faf71ccbc93fdd0ee738eea5d57e088c02f88..8072c823d8e5816f1bff7dfcb9c73b58f978617d 100644 (file)
@@ -147,10 +147,23 @@ AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
     apr_procattr_t *attr, 
     apr_pool_t *p);
 
+/* Subtypes/Values for AP_MPMQ_IS_THREADED and AP_MPMQ_IS_FORKED        */
+#define AP_MPMQ_NOT_SUPPORTED      0  /* This value specifies whether */
+                                      /* an MPM is capable of         */
+                                      /* threading or forking.        */
+#define AP_MPMQ_STATIC             1  /* This value specifies whether */
+                                      /* an MPM is using a static #   */
+                                      /* threads or daemons.          */
+#define AP_MPMQ_DYNAMIC            2  /* This value specifies whether */
+                                      /* an MPM is using a dynamic #  */
+                                      /* threads or daemons.          */
 
-#define AP_MPMQ_MAX_DAEMONS 1    /* Max # of daemons     */
-#define AP_MPMQ_IS_THREADED 2    /* MPM can do threading */
-#define AP_MPMQ_IS_FORKED   3    /* MPM can do forking   */
+#define AP_MPMQ_MAX_DAEMONS        1  /* Max # of daemons     */
+#define AP_MPMQ_IS_THREADED        2  /* MPM can do threading */
+#define AP_MPMQ_IS_FORKED          3  /* MPM can do forking   */
+#define AP_MPMQ_HARD_LIMIT_DAEMONS 4  /* The compiled max # deamons   */
+#define AP_MPMQ_HARD_LIMIT_THREADS 5  /* The compiled max # threads   */
+#define AP_MPMQ_MAX_THREADS        6  /* Max # of threads             */
 
 /**
  * Query a property of the current MPM.  
index cfe57e2991eb646148954dd0dad18f26e9766a83..3c5e014fcfbae4338e1c3fedea4de0fb399b4702 100644 (file)
@@ -327,6 +327,7 @@ static int display_info(request_rec *r)
             ap_mpm_query(AP_MPMQ_MAX_DAEMONS, &max_daemons);
             ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded);
             ap_mpm_query(AP_MPMQ_IS_FORKED, &forked);
+            ap_rprintf(r, "MPM used is %s<br>\n", ap_show_mpm());
             ap_rprintf(r, "<strong>MPM Information:</strong> "
                       "<tt>Max Daemons: %d Threaded: %s Forked: %s</tt><br>\n",
                        max_daemons, threaded ? "yes" : "no",
index bf52650d85e060bdadaa27ca464b3937862ea288..8391140f2184a149708d71bc32320ebc0ad1ab3f 100644 (file)
@@ -92,6 +92,7 @@
 #include "http_main.h"
 #include "http_vhost.h"
 #include "util_cfgtree.h"
+#include "mpm.h"
 
 
 AP_DECLARE_DATA const char *ap_server_argv0;
@@ -1737,3 +1738,7 @@ AP_DECLARE(void) ap_show_modules(void)
        printf("  %s\n", ap_loaded_modules[n]->name);
 }
 
+AP_DECLARE(const char *) ap_show_mpm(void)
+{
+    return MPM_NAME;
+}
index 2ad631cc59b43a673d262444842ddaf0b44228a1..c0128df9b52a9067aca194b45cdbeb044ce97aae 100644 (file)
@@ -657,10 +657,19 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
             *result = ap_max_child_assigned;
             return APR_SUCCESS;
         case AP_MPMQ_IS_THREADED:
-            *result = 1;
+            *result = AP_MPMQ_DYNAMIC;
             return APR_SUCCESS;
         case AP_MPMQ_IS_FORKED:
-            *result = 0;
+            *result = AP_MPMQ_NOT_SUPPORTED;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_DAEMONS:
+            *result = HARD_SERVER_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_THREADS:
+            *result = HARD_THREAD_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_MAX_THREADS:
+            *result = ap_threads_per_child;
             return APR_SUCCESS;
     }
     return APR_ENOTIMPL;
index e6de2765569cea518aacc54d69fc2828823bb4d7..3a652f050275c0e917be5629ccbea61815276c9e 100644 (file)
@@ -62,6 +62,7 @@
 #define BEOS_MPM
 #include "scoreboard.h"
 
+#define MPM_NAME "Beos"
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE()
 #define MPM_CHILD_PID(i) (ap_scoreboard_image->servers[0][i].tid)
index d360ae67d6e643747d3b6a391a18d54d4205e8f5..d24f8b4abaa9f6705d4a6699c8583f7d76adedd9 100644 (file)
@@ -65,6 +65,8 @@
 
 #define PERCHILD_MPM
 
+#define MPM_NAME "Perchild"
+
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE()
 #define MPM_CHILD_PID(i) (ap_child_table[i].pid)
index 425d7eccee96a2b04d094c4311280581760a608f..4555bb11ceb4917ea4f04e58fccbcb61bb7a2295 100644 (file)
@@ -222,10 +222,19 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
             *result = ap_max_daemons_limit;
             return APR_SUCCESS;
         case AP_MPMQ_IS_THREADED:
-            *result = 1;
+            *result = AP_MPMQ_DYNAMIC;
             return APR_SUCCESS;
         case AP_MPMQ_IS_FORKED:
-            *result = 1;
+            *result = AP_MPMQ_STATIC;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_DAEMONS:
+            *result = HARD_SERVER_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_THREADS:
+            *result = HARD_THREAD_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_MAX_THREADS:
+            *result = max_threads;
             return APR_SUCCESS;
     }
     return APR_ENOTIMPL;
index d360ae67d6e643747d3b6a391a18d54d4205e8f5..d24f8b4abaa9f6705d4a6699c8583f7d76adedd9 100644 (file)
@@ -65,6 +65,8 @@
 
 #define PERCHILD_MPM
 
+#define MPM_NAME "Perchild"
+
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE()
 #define MPM_CHILD_PID(i) (ap_child_table[i].pid)
index 425d7eccee96a2b04d094c4311280581760a608f..4555bb11ceb4917ea4f04e58fccbcb61bb7a2295 100644 (file)
@@ -222,10 +222,19 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
             *result = ap_max_daemons_limit;
             return APR_SUCCESS;
         case AP_MPMQ_IS_THREADED:
-            *result = 1;
+            *result = AP_MPMQ_DYNAMIC;
             return APR_SUCCESS;
         case AP_MPMQ_IS_FORKED:
-            *result = 1;
+            *result = AP_MPMQ_STATIC;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_DAEMONS:
+            *result = HARD_SERVER_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_THREADS:
+            *result = HARD_THREAD_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_MAX_THREADS:
+            *result = max_threads;
             return APR_SUCCESS;
     }
     return APR_ENOTIMPL;
index debd270e253c26ea6b89a6c9520cc6a139b19708..6a923b063637244d3ec63e26adf03f788e0c01df 100644 (file)
@@ -66,6 +66,8 @@
 
 #define PREFORK_MPM
 
+#define MPM_NAME "Prefork"
+
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image())
 #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
index b6f6696ad987f860ca8d13395a3e272a3904ca15..a8d6da354f71eb925641e50706f59e6bb46a2536 100644 (file)
@@ -310,10 +310,19 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
             *result = ap_daemons_limit;
             return APR_SUCCESS;
         case AP_MPMQ_IS_THREADED:
-            *result = 0;
+            *result = AP_MPMQ_NOT_SUPPORTED;
             return APR_SUCCESS;
         case AP_MPMQ_IS_FORKED:
-            *result = 1;
+            *result = AP_MPMQ_DYNAMIC;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_DAEMONS:
+            *result = HARD_SERVER_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_THREADS:
+            *result = HARD_THREAD_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_MAX_THREADS:
+            *result = 0;
             return APR_SUCCESS;
     }
     return APR_ENOTIMPL;
index 13b0cf5979dbead32ebe636806972ef5cca1a7f9..96062ed7d6ee984cb4747bfd7bdc3f42a6cbb358 100644 (file)
@@ -65,6 +65,8 @@
 #include "mpm_default.h"
 #include "scoreboard.h"
 
+#define MPM_NAME "SPMT_OS2"
+
 extern char ap_coredump_dir[MAX_STRING_LEN];
 extern server_rec *ap_server_conf;
 extern int ap_threads_per_child;
index b796fb2eaa0d59178ff7cf3430835f8627ca83e1..b991c9df3687b83c76548985f3f4a1b62b5937d3 100644 (file)
@@ -885,10 +885,19 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
             *result = max_daemons_limit;
             return APR_SUCCESS;
         case AP_MPMQ_IS_THREADED:
-            *result = 1;
+            *result = AP_MPMQ_DYNAMIC;
             return APR_SUCCESS;
         case AP_MPMQ_IS_FORKED:
-            *result = 0;
+            *result = AP_MPMQ_NOT_SUPPORTED;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_DAEMONS:
+            *result = HARD_SERVER_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_THREADS:
+            *result = HARD_THREAD_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_MAX_THREADS:
+            *result = ap_threads_per_child;
             return APR_SUCCESS;
     }
     return APR_ENOTIMPL;
index a6ea915e6280c991cbf6d79e4da0f9505aeaa2e9..3359f8cca5f4ed035ff9518483ca7382b313958f 100644 (file)
@@ -63,6 +63,8 @@
 
 #define THREADED_MPM
 
+#define MPM_NAME "Threaded"
+
 #define AP_MPM_NEEDS_RECLAIM_CHILD_PROCESSES 1
 #define MPM_SYNC_CHILD_TABLE() (ap_sync_scoreboard_image())
 #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid)
index 1a9415912fd61820f29d116bc4a33a90cc3f27e4..ba7b2bb2abf8f432a05fc43257738e4e1fc01b8e 100644 (file)
@@ -178,10 +178,19 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
             *result = ap_max_daemons_limit;
             return APR_SUCCESS;
         case AP_MPMQ_IS_THREADED:
-            *result = 1;
+            *result = AP_MPMQ_STATIC;
             return APR_SUCCESS;
         case AP_MPMQ_IS_FORKED:
-            *result = 1;
+            *result = AP_MPMQ_DYNAMIC;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_DAEMONS:
+            *result = HARD_SERVER_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_THREADS:
+            *result = HARD_THREAD_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_MAX_THREADS:
+            *result = ap_threads_per_child;
             return APR_SUCCESS;
     }
     return APR_ENOTIMPL;
index f5215b386a7a371d935b4c6efb4a4490b4dceb63..4c17b8a55f833b00a5797f89ad4e11cd5fbe9e01 100644 (file)
@@ -63,6 +63,9 @@
  * shared with non-mpm specific code in the server.  Hummm, perhaps we can
  * move most of this stuff to mpm_common.h?
  */
+
+#define MPM_NAME "WinNT"
+
 extern int ap_threads_per_child;
 
 #endif /* APACHE_MPM_H */
index 0ee41a9dd26ddb91d847e5d9652f05a4a10c9d45..921e362ddd4e77f039ac55c6a668992b3caca5bc 100644 (file)
@@ -1538,10 +1538,19 @@ AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result)
             *result = MAXIMUM_WAIT_OBJECTS;
             return APR_SUCCESS;
         case AP_MPMQ_IS_THREADED:
-            *result = 1;
+            *result = AP_MPMQ_STATIC;
             return APR_SUCCESS;
         case AP_MPMQ_IS_FORKED:
-            *result = 0;
+            *result = AP_MPMQ_NOT_SUPPORTED;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_DAEMONS:
+            *result = HARD_SERVER_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_HARD_LIMIT_THREADS:
+            *result = HARD_THREAD_LIMIT;
+            return APR_SUCCESS;
+        case AP_MPMQ_MAX_THREADS:
+            *result = ap_threads_per_child;
             return APR_SUCCESS;
     }
     return APR_ENOTIMPL;