const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy,
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.
*/
#endif
#include "ap_config.h"
+#include "http_config.h"
#include "apr_hooks.h"
#include "apr_thread_proc.h"
#include "apr_portable.h"
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.
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)
{
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)
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);
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 */
};
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.
*/
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,
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,
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"