You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Geoffrey Young <ge...@modperlcookbook.org> on 2003/08/12 16:31:39 UTC

Re: [patch] have_apache_mpm()

sorry, I'm just now getting around to following up on this :)

William A. Rowe, Jr. wrote:
> At 07:02 PM 7/9/2003, Geoffrey Young wrote:
> 
> 
>>William A. Rowe, Jr. wrote:
>>
>>>It seems like the API for ap_mpm_query would be simpler to follow,
>>>just extended to run outside-of-apache.
>>
>>probably, and it would certainly be safer than checking -V output. the issue I see with this is that thus far Apache-Test is pure perl, so it seems overkill to get into the C API and XS for just for one small feature.  unless I'm missing something, that is :)
> 
> 
> You are :-)  It sounds like httpd -V should grow some ap_mpm_query output
> for the user to know what sorts of flags are toggled for that build of httpd?

did you mean something like this?

Server version: Apache/2.1.0-dev
Server built:   Aug 12 2003 02:25:22
Server's Module Magic Number: 20030213:1
Architecture:   32-bit
Server MPM:     Prefork
   threaded:     no
     forked:     yes (dynamic)
Server compiled with....

Server version: Apache/2.1.0-dev
Server built:   Aug 12 2003 02:28:54
Server's Module Magic Number: 20030213:1
Architecture:   32-bit
Server MPM:     Worker
   threaded:     yes (static)
     forked:     yes (dynamic)
Server compiled with....

--Geoff

Index: server/main.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/main.c,v
retrieving revision 1.144
diff -u -r1.144 main.c
--- server/main.c       22 Feb 2003 14:32:39 -0000      1.144
+++ server/main.c       12 Aug 2003 14:27:13 -0000
@@ -85,7 +85,40 @@
   * Most significant main() global data can be found in http_config.c
   */

-/* XXX - We should be able to grab the per-MPM settings here too */
+static void show_mpm_settings(void)
+{
+    int mpm_query_info;
+
+    printf("Server MPM:     %s\n", ap_show_mpm());
+
+    ap_mpm_query(AP_MPMQ_IS_THREADED, &mpm_query_info);
+
+    printf("  threaded:     ");
+
+    if (mpm_query_info == AP_MPMQ_DYNAMIC) {
+        printf("yes (dynamic)\n");
+    }
+    else if (mpm_query_info == AP_MPMQ_STATIC) {
+        printf("yes (static)\n");
+    }
+    else {
+        printf("no\n");
+    }
+
+    ap_mpm_query(AP_MPMQ_IS_FORKED, &mpm_query_info);
+    printf("    forked:     ");
+
+    if (mpm_query_info == AP_MPMQ_DYNAMIC) {
+        printf("yes (dynamic)\n");
+    }
+    else if (mpm_query_info == AP_MPMQ_STATIC) {
+        printf("yes (static)\n");
+    }
+    else {
+        printf("no\n");
+    }
+}
+
  static void show_compile_settings(void)
  {
      printf("Server version: %s\n", ap_get_server_version());
@@ -98,6 +131,9 @@
       * consistent
       */
      printf("Architecture:   %ld-bit\n", 8 * (long)sizeof(void *));
+
+    show_mpm_settings();
+
      printf("Server compiled with....\n");
  #ifdef BIG_SECURITY_HOLE
      printf(" -D BIG_SECURITY_HOLE\n");