summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2018-09-11 14:57:36 +0200
committerJoe Orton <jorton@apache.org>2018-09-11 14:57:36 +0200
commit9b9ecda02d70b09a9360ee653f5ee1e3946c3a72 (patch)
treed1f182bb60ecfe7119cf7ef8c0489755bd7a933e
parent* modules/arch/unix/mod_systemd.c (systemd_post_config): Fix systemd (diff)
downloadapache2-9b9ecda02d70b09a9360ee653f5ee1e3946c3a72.tar.xz
apache2-9b9ecda02d70b09a9360ee653f5ee1e3946c3a72.zip
* modules/arch/unix/mod_systemd.c (systemd_pre_mpm, systemd_monitor):
Ignore sd_notify{,f} failure cases as currently recommended by the systemd API docs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1840555 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--modules/arch/unix/mod_systemd.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/modules/arch/unix/mod_systemd.c b/modules/arch/unix/mod_systemd.c
index 1c84e9767c..3101ce980a 100644
--- a/modules/arch/unix/mod_systemd.c
+++ b/modules/arch/unix/mod_systemd.c
@@ -66,17 +66,11 @@ static int systemd_post_config(apr_pool_t *p, apr_pool_t *plog,
static int systemd_pre_mpm(apr_pool_t *p, ap_scoreboard_e sb_type)
{
- int rv;
-
mainpid = getpid();
- rv = sd_notifyf(0, "READY=1\n"
- "STATUS=Processing requests...\n"
- "MAINPID=%" APR_PID_T_FMT, mainpid);
- if (rv < 0) {
- ap_log_perror(APLOG_MARK, APLOG_ERR, 0, p, APLOGNO(02395)
- "sd_notifyf returned an error %d", rv);
- }
+ sd_notifyf(0, "READY=1\n"
+ "STATUS=Processing requests...\n"
+ "MAINPID=%" APR_PID_T_FMT, mainpid);
return OK;
}
@@ -86,7 +80,6 @@ static int systemd_monitor(apr_pool_t *p, server_rec *s)
ap_sload_t sload;
apr_interval_time_t up_time;
char bps[5];
- int rv;
if (!ap_extended_status) {
/* Nothing useful to report with ExtendedStatus disabled. */
@@ -101,29 +94,20 @@ static int systemd_monitor(apr_pool_t *p, server_rec *s)
apr_strfsize((unsigned long)((float) (sload.bytes_served)
/ (float) up_time), bps);
- rv = sd_notifyf(0, "READY=1\n"
- "STATUS=Total requests: %lu; Idle/Busy workers %d/%d;"
- "Requests/sec: %.3g; Bytes served/sec: %sB/sec\n",
- sload.access_count, sload.idle, sload.busy,
- ((float) sload.access_count) / (float) up_time, bps);
-
- if (rv < 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(02396)
- "sd_notifyf returned an error %d", rv);
- }
+ sd_notifyf(0, "READY=1\n"
+ "STATUS=Total requests: %lu; Idle/Busy workers %d/%d;"
+ "Requests/sec: %.3g; Bytes served/sec: %sB/sec\n",
+ sload.access_count, sload.idle, sload.busy,
+ ((float) sload.access_count) / (float) up_time, bps);
/* Shutdown httpd when nothing is sent for shutdown_timer seconds. */
if (sload.bytes_served == bytes_served) {
/* mpm_common.c: INTERVAL_OF_WRITABLE_PROBES is 10 */
shutdown_counter += 10;
if (shutdown_timer > 0 && shutdown_counter >= shutdown_timer) {
- rv = sd_notifyf(0, "READY=1\n"
- "STATUS=Stopped as result of IdleShutdown "
- "timeout.");
- if (rv < 0) {
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(02804)
- "sd_notifyf returned an error %d", rv);
- }
+ sd_notifyf(0, "READY=1\n"
+ "STATUS=Stopped as result of IdleShutdown "
+ "timeout.");
kill(mainpid, AP_SIG_GRACEFUL);
}
}