]> granicus.if.org Git - apache/commitdiff
* modules/arch/unix/mod_systemd.c (systemd_pre_mpm, systemd_monitor):
authorJoe Orton <jorton@apache.org>
Tue, 11 Sep 2018 12:57:36 +0000 (12:57 +0000)
committerJoe Orton <jorton@apache.org>
Tue, 11 Sep 2018 12:57:36 +0000 (12:57 +0000)
  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

modules/arch/unix/mod_systemd.c

index 1c84e9767c0f18523c0a4e94dfaa0a331b86d7c9..3101ce980a923c17e2ada26f70dba193c2b20c7e 100644 (file)
@@ -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);
         }
     }