diff options
author | Joe Orton <jorton@apache.org> | 2017-07-18 10:14:42 +0200 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2017-07-18 10:14:42 +0200 |
commit | 52ecea1e1e3c24a57fbb9be0a5ab728180c62e09 (patch) | |
tree | cc7bbba35ea3bc9a03f8728cbc6603035ca8d901 /modules/arch | |
parent | mod-proxy documentation rebuild (diff) | |
download | apache2-52ecea1e1e3c24a57fbb9be0a5ab728180c62e09.tar.xz apache2-52ecea1e1e3c24a57fbb9be0a5ab728180c62e09.zip |
Fix overriding ExtendedStatus to "off" with mod_systemd loaded, and
give more feedback to systemd during a reload.
* modules/arch/unix/mod_systemd.c (systemd_pre_config): New
function; tell systemd the service is reloading here.
(systemd_pre_mpm): Don't set ap_extended_status here, do nothing
if ExtendedStatus is off.
(register_hooks): Register pre_config hook.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1802251 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/arch')
-rw-r--r-- | modules/arch/unix/mod_systemd.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/modules/arch/unix/mod_systemd.c b/modules/arch/unix/mod_systemd.c index 5381c986e7..72d04bddc3 100644 --- a/modules/arch/unix/mod_systemd.c +++ b/modules/arch/unix/mod_systemd.c @@ -39,11 +39,20 @@ static int shutdown_counter = 0; static unsigned long bytes_served; static pid_t mainpid; +static int systemd_pre_config(apr_pool_t *pconf, apr_pool_t *plog, + apr_pool_t *ptemp) +{ + sd_notify(0, + "RELOADING=1\n" + "STATUS=Reading configuration...\n"); + ap_extended_status = 1; + return OK; +} + static int systemd_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type) { int rv; - ap_extended_status = 1; mainpid = getpid(); rv = sd_notifyf(0, "READY=1\n" @@ -64,6 +73,11 @@ static int systemd_monitor(apr_pool_t *p, server_rec *s) char bps[5]; int rv; + if (!ap_extended_status) { + /* Nothing useful to report with ExtendedStatus disabled. */ + return DECLINED; + } + ap_get_sload(&sload); /* up_time in seconds */ up_time = (apr_uint32_t) apr_time_sec(apr_time_now() - @@ -109,6 +123,8 @@ static int systemd_monitor(apr_pool_t *p, server_rec *s) static void systemd_register_hooks(apr_pool_t *p) { + /* Enable ap_extended_status. */ + ap_hook_pre_config(systemd_pre_config, NULL, NULL, APR_HOOK_LAST); /* We know the PID in this hook ... */ ap_hook_pre_mpm(systemd_pre_mpm, NULL, NULL, APR_HOOK_LAST); /* Used to update httpd's status line using sd_notifyf */ |