From b0a5cb0bb967c5b40adbbfa09bb1ceb5f8e72f57 Mon Sep 17 00:00:00 2001 From: Nick Kew Date: Tue, 7 Jun 2005 19:13:37 +0000 Subject: [PATCH] Add monitor hook (discussed under "watchdog" thread). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@188846 13f79535-47bb-0310-9956-ffa450edef68 --- include/mpm_common.h | 2 ++ server/mpm_common.c | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/mpm_common.h b/include/mpm_common.h index 1fdac30671..a36b926ff5 100644 --- a/include/mpm_common.h +++ b/include/mpm_common.h @@ -296,6 +296,8 @@ extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy, const char *arg); #endif +AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p)) + #ifdef __cplusplus } #endif diff --git a/server/mpm_common.c b/server/mpm_common.c index 2d502b47a6..e6bf91ffbe 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -59,6 +59,21 @@ #include #endif +APR_HOOK_STRUCT( +#if AP_ENABLE_EXCEPTION_HOOK + APR_HOOK_LINK(fatal_exception) +#endif + APR_HOOK_LINK(monitor) +) + +#if AP_ENABLE_EXCEPTION_HOOK +AP_IMPLEMENT_HOOK_RUN_ALL(int, fatal_exception, + (ap_exception_info_t *ei), (ei), OK, DECLINED) +#endif +AP_IMPLEMENT_HOOK_RUN_ALL(int, monitor, + (apr_pool_t *p), (p), OK, DECLINED) + + #ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES typedef enum {DO_NOTHING, SEND_SIGTERM, SEND_SIGKILL, GIVEUP} action_t; @@ -275,6 +290,7 @@ void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, ++wait_or_timeout_counter; if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { wait_or_timeout_counter = 0; + ap_run_monitor(p); } rv = apr_proc_wait_all_procs(ret, exitcode, status, APR_NOWAIT, p); @@ -1028,13 +1044,6 @@ const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy, return NULL; } -APR_HOOK_STRUCT( - APR_HOOK_LINK(fatal_exception) -) - -AP_IMPLEMENT_HOOK_RUN_ALL(int, fatal_exception, - (ap_exception_info_t *ei), (ei), OK, DECLINED) - static void run_fatal_exception_hook(int sig) { ap_exception_info_t ei = {0}; -- 2.40.0