1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Enhance ap_hook_monitor to pass along a server_rec (in

general the ap_server_conf) and tuck away some storage
in there which may be useful as an opaque data pointer.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@818825 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Jagielski
2009-09-25 11:59:30 +00:00
parent 1a82a91410
commit 83532ab628
10 changed files with 17 additions and 11 deletions

View File

@@ -196,6 +196,8 @@
* 20090401.1 (2.3.3-dev) Protected log.c internals, http_log.h changes * 20090401.1 (2.3.3-dev) Protected log.c internals, http_log.h changes
* 20090401.2 (2.3.3-dev) Added tmp_flush_bb to core_output_filter_ctx_t * 20090401.2 (2.3.3-dev) Added tmp_flush_bb to core_output_filter_ctx_t
* 20090401.3 (2.3.3-dev) Added DAV options provider to mod_dav.h * 20090401.3 (2.3.3-dev) Added DAV options provider to mod_dav.h
* 20090925.0 (2.3.3-dev) Added server_rec::context and added *server_rec
* param to ap_wait_or_timeout()
* *
*/ */

View File

@@ -1235,6 +1235,9 @@ struct server_rec {
/** The server request scheme for redirect responses */ /** The server request scheme for redirect responses */
const char *server_scheme; const char *server_scheme;
/** Opaque storage location */
void *context;
}; };
typedef struct core_output_filter_ctx { typedef struct core_output_filter_ctx {

View File

@@ -145,9 +145,10 @@ apr_status_t ap_mpm_safe_kill(pid_t pid, int sig);
* @param status The return code if a process has died * @param status The return code if a process has died
* @param ret The process id of the process that died * @param ret The process id of the process that died
* @param p The pool to allocate out of * @param p The pool to allocate out of
* @param s The server_rec to pass
*/ */
void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret,
apr_pool_t *p); apr_pool_t *p, server_rec *s);
/** /**
* Log why a child died to the error log, if the child died without the * Log why a child died to the error log, if the child died without the

View File

@@ -1399,7 +1399,7 @@ static int x_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type)
* *
* This is a RUN_ALL hook. * This is a RUN_ALL hook.
*/ */
static int x_monitor(apr_pool_t *p) static int x_monitor(apr_pool_t *p, server_rec *s)
{ {
trace_nocontext(p, __FILE__, __LINE__, "x_monitor()"); trace_nocontext(p, __FILE__, __LINE__, "x_monitor()");
return DECLINED; return DECLINED;

View File

@@ -98,7 +98,7 @@ static int noloris_conn(conn_rec *conn)
return DECLINED; return DECLINED;
} }
static int noloris_monitor(apr_pool_t *pool) static int noloris_monitor(apr_pool_t *pool, server_rec *s)
{ {
static apr_hash_t *connections = NULL; static apr_hash_t *connections = NULL;
static apr_time_t last_check = 0; static apr_time_t last_check = 0;

View File

@@ -379,7 +379,7 @@ static apr_status_t dbd_remove(request_rec * r, const char *key)
* The monitor hook doesn't help us that much, as we have no handle into the * The monitor hook doesn't help us that much, as we have no handle into the
* server, and so we need to come up with a way to do this safely. * server, and so we need to come up with a way to do this safely.
*/ */
static apr_status_t dbd_clean(apr_pool_t *p) static apr_status_t dbd_clean(apr_pool_t *p, server_rec *s)
{ {
return APR_ENOTIMPL; return APR_ENOTIMPL;
@@ -471,10 +471,10 @@ static int session_dbd_save(request_rec * r, session_rec * z)
* This function performs housekeeping on the database, deleting expired * This function performs housekeeping on the database, deleting expired
* sessions. * sessions.
*/ */
static int session_dbd_monitor(apr_pool_t *p) static int session_dbd_monitor(apr_pool_t *p, server_rec *s)
{ {
/* TODO handle housekeeping */ /* TODO handle housekeeping */
dbd_clean(p); dbd_clean(p, s);
return OK; return OK;
} }

View File

@@ -2109,7 +2109,7 @@ static void server_main_loop(int remaining_children_to_start)
int i; int i;
while (!restart_pending && !shutdown_pending) { while (!restart_pending && !shutdown_pending) {
ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); ap_wait_or_timeout(&exitwhy, &status, &pid, pconf, ap_server_conf);
if (pid.pid != -1) { if (pid.pid != -1) {
processed_status = ap_process_child_status(&pid, exitwhy, status); processed_status = ap_process_child_status(&pid, exitwhy, status);

View File

@@ -1002,7 +1002,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
/* this is a memory leak, but I'll fix it later. */ /* this is a memory leak, but I'll fix it later. */
apr_proc_t pid; apr_proc_t pid;
ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); ap_wait_or_timeout(&exitwhy, &status, &pid, pconf, ap_server_conf);
/* XXX: if it takes longer than 1 second for all our children /* XXX: if it takes longer than 1 second for all our children
* to start up and get into IDLE state then we may spawn an * to start up and get into IDLE state then we may spawn an

View File

@@ -1604,7 +1604,7 @@ static void server_main_loop(int remaining_children_to_start)
int i; int i;
while (!restart_pending && !shutdown_pending) { while (!restart_pending && !shutdown_pending) {
ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); ap_wait_or_timeout(&exitwhy, &status, &pid, pconf, ap_server_conf);
if (pid.pid != -1) { if (pid.pid != -1) {
processed_status = ap_process_child_status(&pid, exitwhy, status); processed_status = ap_process_child_status(&pid, exitwhy, status);

View File

@@ -108,14 +108,14 @@ AP_IMPLEMENT_HOOK_RUN_FIRST(const char *, mpm_get_name,
static int wait_or_timeout_counter; static int wait_or_timeout_counter;
void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret,
apr_pool_t *p) apr_pool_t *p, server_rec *s)
{ {
apr_status_t rv; apr_status_t rv;
++wait_or_timeout_counter; ++wait_or_timeout_counter;
if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
wait_or_timeout_counter = 0; wait_or_timeout_counter = 0;
ap_run_monitor(p); ap_run_monitor(p, s);
} }
rv = apr_proc_wait_all_procs(ret, exitcode, status, APR_NOWAIT, p); rv = apr_proc_wait_all_procs(ret, exitcode, status, APR_NOWAIT, p);