You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2001/04/13 21:00:39 UTC

cvs commit: httpd-2.0/server/mpm/winnt mpm.h mpm_winnt.c

rbb         01/04/13 12:00:39

  Modified:    include  ap_mpm.h
               modules/generators mod_info.c
               server   config.c
               server/mpm/beos beos.c mpm.h
               server/mpm/perchild mpm.h perchild.c
               server/mpm/prefork mpm.h prefork.c
               server/mpm/spmt_os2 mpm.h spmt_os2.c
               server/mpm/threaded mpm.h threaded.c
               server/mpm/winnt mpm.h mpm_winnt.c
  Log:
  Add more options to the ap_mpm_query function.  This also allows MPMs to
  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 <ha...@covalent.net>
  
  Revision  Changes    Path
  1.26      +16 -3     httpd-2.0/include/ap_mpm.h
  
  Index: ap_mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/ap_mpm.h,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -d -b -w -u -r1.25 -r1.26
  --- ap_mpm.h	2001/04/06 20:11:58	1.25
  +++ ap_mpm.h	2001/04/13 19:00:36	1.26
  @@ -147,10 +147,23 @@
       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_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.  
  
  
  
  1.35      +1 -0      httpd-2.0/modules/generators/mod_info.c
  
  Index: mod_info.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_info.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -d -b -w -u -r1.34 -r1.35
  --- mod_info.c	2001/03/26 15:39:45	1.34
  +++ mod_info.c	2001/04/13 19:00:36	1.35
  @@ -327,6 +327,7 @@
               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",
  
  
  
  1.124     +5 -0      httpd-2.0/server/config.c
  
  Index: config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/config.c,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -d -b -w -u -r1.123 -r1.124
  --- config.c	2001/04/10 23:18:27	1.123
  +++ config.c	2001/04/13 19:00:37	1.124
  @@ -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 @@
   	printf("  %s\n", ap_loaded_modules[n]->name);
   }
   
  +AP_DECLARE(const char *) ap_show_mpm(void)
  +{
  +    return MPM_NAME;
  +}
  
  
  
  1.51      +11 -2     httpd-2.0/server/mpm/beos/beos.c
  
  Index: beos.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/beos/beos.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -d -b -w -u -r1.50 -r1.51
  --- beos.c	2001/03/30 20:01:49	1.50
  +++ beos.c	2001/04/13 19:00:37	1.51
  @@ -657,10 +657,19 @@
               *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;
  
  
  
  1.8       +1 -0      httpd-2.0/server/mpm/beos/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/beos/mpm.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -d -b -w -u -r1.7 -r1.8
  --- mpm.h	2001/03/19 13:07:27	1.7
  +++ mpm.h	2001/04/13 19:00:37	1.8
  @@ -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)
  
  
  
  1.7       +2 -0      httpd-2.0/server/mpm/perchild/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/perchild/mpm.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -d -b -w -u -r1.6 -r1.7
  --- mpm.h	2001/03/19 13:07:27	1.6
  +++ mpm.h	2001/04/13 19:00:37	1.7
  @@ -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)
  
  
  
  1.62      +11 -2     httpd-2.0/server/mpm/perchild/perchild.c
  
  Index: perchild.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/perchild/perchild.c,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -d -b -w -u -r1.61 -r1.62
  --- perchild.c	2001/04/13 00:41:34	1.61
  +++ perchild.c	2001/04/13 19:00:37	1.62
  @@ -222,10 +222,19 @@
               *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;
  
  
  
  1.11      +2 -0      httpd-2.0/server/mpm/prefork/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/mpm.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -d -b -w -u -r1.10 -r1.11
  --- mpm.h	2001/03/19 13:07:28	1.10
  +++ mpm.h	2001/04/13 19:00:38	1.11
  @@ -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)
  
  
  
  1.173     +11 -2     httpd-2.0/server/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v
  retrieving revision 1.172
  retrieving revision 1.173
  diff -u -d -b -w -u -r1.172 -r1.173
  --- prefork.c	2001/04/12 13:37:23	1.172
  +++ prefork.c	2001/04/13 19:00:38	1.173
  @@ -310,10 +310,19 @@
               *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;
  
  
  
  1.8       +2 -0      httpd-2.0/server/mpm/spmt_os2/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/spmt_os2/mpm.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -d -b -w -u -r1.7 -r1.8
  --- mpm.h	2001/02/16 04:26:51	1.7
  +++ mpm.h	2001/04/13 19:00:38	1.8
  @@ -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;
  
  
  
  1.92      +11 -2     httpd-2.0/server/mpm/spmt_os2/spmt_os2.c
  
  Index: spmt_os2.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/spmt_os2/spmt_os2.c,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -d -b -w -u -r1.91 -r1.92
  --- spmt_os2.c	2001/04/07 13:45:19	1.91
  +++ spmt_os2.c	2001/04/13 19:00:38	1.92
  @@ -885,10 +885,19 @@
               *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;
  
  
  
  1.4       +2 -0      httpd-2.0/server/mpm/threaded/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/mpm.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -d -b -w -u -r1.3 -r1.4
  --- mpm.h	2001/03/19 13:07:28	1.3
  +++ mpm.h	2001/04/13 19:00:38	1.4
  @@ -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)
  
  
  
  1.22      +11 -2     httpd-2.0/server/mpm/threaded/threaded.c
  
  Index: threaded.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/threaded.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -d -b -w -u -r1.21 -r1.22
  --- threaded.c	2001/04/12 18:46:32	1.21
  +++ threaded.c	2001/04/13 19:00:38	1.22
  @@ -178,10 +178,19 @@
               *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;
  
  
  
  1.5       +3 -0      httpd-2.0/server/mpm/winnt/mpm.h
  
  Index: mpm.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -d -b -w -u -r1.4 -r1.5
  --- mpm.h	2001/02/16 04:26:52	1.4
  +++ mpm.h	2001/04/13 19:00:39	1.5
  @@ -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 */
  
  
  
  1.157     +11 -2     httpd-2.0/server/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.156
  retrieving revision 1.157
  diff -u -d -b -w -u -r1.156 -r1.157
  --- mpm_winnt.c	2001/04/12 13:58:33	1.156
  +++ mpm_winnt.c	2001/04/13 19:00:39	1.157
  @@ -1538,10 +1538,19 @@
               *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;