teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 0e09a7e4c14e6b1d31a9a56b80d02b52c9583ab1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 27 Dec 2013 22:12:38 -0500
Subject: [PATCH] core/manager: print info about interesting signals

Information about signals which are not routinely received by systemd
are printed at info level. This should make it easier to see what is
happening in the system.
---
 src/core/manager.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/core/manager.c b/src/core/manager.c
index a34a3c6..69ad4b5 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1435,16 +1435,22 @@ static int manager_process_signal_fd(Manager *m) {
                 }
 
                 if (sfsi.ssi_pid > 0) {
-                        char *p = NULL;
+                        _cleanup_free_ char *p = NULL;
 
                         get_process_comm(sfsi.ssi_pid, &p);
 
-                        log_debug("Received SIG%s from PID %lu (%s).",
-                                  signal_to_string(sfsi.ssi_signo),
-                                  (unsigned long) sfsi.ssi_pid, strna(p));
-                        free(p);
+                        log_full(sfsi.ssi_signo == SIGCHLD ||
+                                 (sfsi.ssi_signo == SIGTERM && m->running_as == SYSTEMD_USER)
+                                 ? LOG_DEBUG : LOG_INFO,
+                                 "Received SIG%s from PID %lu (%s).",
+                                 signal_to_string(sfsi.ssi_signo),
+                                 (unsigned long) sfsi.ssi_pid, strna(p));
                 } else
-                        log_debug("Received SIG%s.", signal_to_string(sfsi.ssi_signo));
+                        log_full(sfsi.ssi_signo == SIGCHLD ||
+                                 (sfsi.ssi_signo == SIGTERM && m->running_as == SYSTEMD_USER)
+                                 ? LOG_DEBUG : LOG_INFO,
+                                 "Received SIG%s.",
+                                 signal_to_string(sfsi.ssi_signo));
 
                 switch (sfsi.ssi_signo) {