Commit 0759cf53 authored by Ryan Bloom's avatar Ryan Bloom
Browse files

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 <harrie@covalent.net>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88851 13f79535-47bb-0310-9956-ffa450edef68
parent ebcd9462
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -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_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 −0
Original line number Diff line number Diff line
@@ -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",
+5 −0
Original line number Diff line number Diff line
@@ -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;
}
+11 −2
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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)
Loading