httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r903020 - in /httpd/httpd/trunk: include/mpm_common.h include/scoreboard.h modules/generators/mod_status.c server/core.c server/mpm_common.c server/scoreboard.c
Date Tue, 26 Jan 2010 00:05:38 GMT
Author: wrowe
Date: Tue Jan 26 00:05:37 2010
New Revision: 903020

URL: http://svn.apache.org/viewvc?rev=903020&view=rev
Log:
Refactor mod_status out of the ExtendedStatus toggle picture, as other
modules can and should be able to use this scoreboard information.
Rename suggestions for such a directive are welcomed.

Note that mod_status toggles the default, to present the ExtendedStatus 
for server operators, whenever it is loaded.  Docs changes to follow.


Modified:
    httpd/httpd/trunk/include/mpm_common.h
    httpd/httpd/trunk/include/scoreboard.h
    httpd/httpd/trunk/modules/generators/mod_status.c
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/mpm_common.c
    httpd/httpd/trunk/server/scoreboard.c

Modified: httpd/httpd/trunk/include/mpm_common.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/mpm_common.h?rev=903020&r1=903019&r2=903020&view=diff
==============================================================================
--- httpd/httpd/trunk/include/mpm_common.h (original)
+++ httpd/httpd/trunk/include/mpm_common.h Tue Jan 26 00:05:37 2010
@@ -265,12 +265,6 @@
                                const char *arg);
 
 /*
- * Set the scorboard file.
- */
-const char *ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy,
-                                  const char *arg);
-
-/*
  * The directory that the server changes directory to dump core.
  */
 extern char ap_coredump_dir[MAX_STRING_LEN];

Modified: httpd/httpd/trunk/include/scoreboard.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/scoreboard.h?rev=903020&r1=903019&r2=903020&view=diff
==============================================================================
--- httpd/httpd/trunk/include/scoreboard.h (original)
+++ httpd/httpd/trunk/include/scoreboard.h Tue Jan 26 00:05:37 2010
@@ -32,6 +32,7 @@
 #endif
 
 #include "ap_config.h"
+#include "http_config.h"
 #include "apr_hooks.h"
 #include "apr_thread_proc.h"
 #include "apr_portable.h"
@@ -188,6 +189,13 @@
 AP_DECLARE_DATA extern int ap_extended_status;
 AP_DECLARE_DATA extern int ap_mod_status_reqtail;
 
+/*
+ * Command handlers [internal]
+ */
+const char *ap_set_scoreboard(cmd_parms *cmd, void *dummy, const char *arg);
+const char *ap_set_extended_status(cmd_parms *cmd, void *dummy, int arg);
+const char *ap_set_reqtail(cmd_parms *cmd, void *dummy, int arg);
+
 /* Hooks */
 /**
   * Hook for post scoreboard creation, pre mpm.

Modified: httpd/httpd/trunk/modules/generators/mod_status.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_status.c?rev=903020&r1=903019&r2=903020&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_status.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_status.c Tue Jan 26 00:05:37 2010
@@ -102,41 +102,6 @@
 static pid_t child_pid;
 #endif
 
-/*
- * command-related code. This is here to prevent use of ExtendedStatus
- * without status_module included.
- */
-static const char *set_extended_status(cmd_parms *cmd, void *dummy, int arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-    ap_extended_status = arg;
-    return NULL;
-}
-
-static const char *set_reqtail(cmd_parms *cmd, void *dummy, int arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-    ap_mod_status_reqtail = arg;
-    return NULL;
-}
-
-
-static const command_rec status_module_cmds[] =
-{
-    AP_INIT_FLAG("ExtendedStatus", set_extended_status, NULL, RSRC_CONF,
-      "\"On\" to enable extended status information, \"Off\" to disable"),
-    AP_INIT_FLAG("SeeRequestTail", set_reqtail, NULL, RSRC_CONF,
-      "For verbose requests, \"On\" to see the last 63 chars of the request, "
-      "\"Off\" (default) to see the first 63 in extended status display"),
-    {NULL}
-};
-
 /* Format the number of bytes nicely */
 static void format_byte_out(request_rec *r, apr_off_t bytes)
 {
@@ -815,6 +780,15 @@
     return 0;
 }
 
+static void status_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
+{
+    /* When mod_status is loaded, default our ExtendedStatus to 'on'
+     * other modules which prefer verbose scoreboards may play a similar game.
+     * If left to their own requirements, mpm modules can make do with simple
+     * scoreboard entries.
+     */
+    ap_extended_status = 1;
+}
 
 static int status_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp,
                        server_rec *s)
@@ -845,6 +819,7 @@
 static void register_hooks(apr_pool_t *p)
 {
     ap_hook_handler(status_handler, NULL, NULL, APR_HOOK_MIDDLE);
+    ap_hook_pre_config(status_pre_config, NULL, NULL, APR_HOOK_LAST);
     ap_hook_post_config(status_init, NULL, NULL, APR_HOOK_MIDDLE);
 #ifdef HAVE_TIMES
     ap_hook_child_init(status_child_init, NULL, NULL, APR_HOOK_MIDDLE);
@@ -858,7 +833,7 @@
     NULL,                       /* dir merger --- default is to override */
     NULL,                       /* server config */
     NULL,                       /* merge server config */
-    status_module_cmds,         /* command table */
+    NULL,                       /* command table */
     register_hooks              /* register_hooks */
 };
 

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=903020&r1=903019&r2=903020&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Tue Jan 26 00:05:37 2010
@@ -3379,6 +3379,15 @@
 AP_INIT_FLAG("AllowEncodedSlashes", set_allow2f, NULL, RSRC_CONF,
              "Allow URLs containing '/' encoded as '%2F'"),
 
+/* scoreboard.c directives */
+AP_INIT_TAKE1("ScoreboardFile", ap_set_scoreboard, NULL, RSRC_CONF,
+              "A file for Apache to maintain runtime process management information"),
+AP_INIT_FLAG("ExtendedStatus", ap_set_extended_status, NULL, RSRC_CONF,
+             "\"On\" to track extended status information, \"Off\" to disable"),
+AP_INIT_FLAG("SeeRequestTail", ap_set_reqtail, NULL, RSRC_CONF,
+             "For extended status, \"On\" to see the last 63 chars of "
+             "the request line, \"Off\" (default) to see the first 63"),
+
 /*
  * These are default configuration directives that mpms can/should
  * pay attention to.
@@ -3387,8 +3396,6 @@
  */
 AP_INIT_TAKE1("PidFile",  ap_mpm_set_pidfile, NULL, RSRC_CONF,
               "A file for logging the server process ID"),
-AP_INIT_TAKE1("ScoreBoardFile", ap_mpm_set_scoreboard, NULL, RSRC_CONF,
-              "A file for Apache to maintain runtime process management information"),
 AP_INIT_TAKE1("MaxRequestsPerChild", ap_mpm_set_max_requests, NULL, RSRC_CONF,
               "Maximum number of requests a particular child serves before dying."),
 AP_INIT_TAKE1("CoreDumpDirectory", ap_mpm_set_coredumpdir, NULL, RSRC_CONF,

Modified: httpd/httpd/trunk/server/mpm_common.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_common.c?rev=903020&r1=903019&r2=903020&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_common.c (original)
+++ httpd/httpd/trunk/server/mpm_common.c Tue Jan 26 00:05:37 2010
@@ -241,18 +241,6 @@
     return NULL;
 }
 
-const char * ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy,
-                                   const char *arg)
-{
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-    if (err != NULL) {
-        return err;
-    }
-
-    ap_scoreboard_fname = arg;
-    return NULL;
-}
-
 int ap_max_requests_per_child = 0;
 
 const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy,

Modified: httpd/httpd/trunk/server/scoreboard.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=903020&r1=903019&r2=903020&view=diff
==============================================================================
--- httpd/httpd/trunk/server/scoreboard.c (original)
+++ httpd/httpd/trunk/server/scoreboard.c Tue Jan 26 00:05:37 2010
@@ -38,9 +38,44 @@
 
 AP_DECLARE_DATA scoreboard *ap_scoreboard_image = NULL;
 AP_DECLARE_DATA const char *ap_scoreboard_fname = NULL;
+
+const char * ap_set_scoreboard(cmd_parms *cmd, void *dummy,
+                               const char *arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+
+    ap_scoreboard_fname = arg;
+    return NULL;
+}
+
+/* Default to false when mod_status is not loaded */
 AP_DECLARE_DATA int ap_extended_status = 0;
+
+const char *ap_set_extended_status(cmd_parms *cmd, void *dummy, int arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+    ap_extended_status = arg;
+    return NULL;
+}
+
 AP_DECLARE_DATA int ap_mod_status_reqtail = 0;
 
+const char *ap_set_reqtail(cmd_parms *cmd, void *dummy, int arg)
+{
+    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+    if (err != NULL) {
+        return err;
+    }
+    ap_mod_status_reqtail = arg;
+    return NULL;
+}
+
 #if APR_HAS_SHARED_MEMORY
 
 #include "apr_shm.h"



Mime
View raw message