summaryrefslogtreecommitdiff
path: root/src/shared/log.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-02-09 20:08:55 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-02-11 19:14:47 -0500
commit4daf54a851e4fb7ed1a13c3117bba12528fd2c7f (patch)
treedd9db902bc6e5500bd2b5784714b4052265f0cf4 /src/shared/log.c
parentc480d2f8bc63565e40bd969054ebd97e9e2deca6 (diff)
journald: log provenience of signals
Diffstat (limited to 'src/shared/log.c')
-rw-r--r--src/shared/log.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index 2a075ffeba..ee20921f78 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -973,3 +973,20 @@ static const char *const log_target_table[] = {
};
DEFINE_STRING_TABLE_LOOKUP(log_target, LogTarget);
+
+void log_received_signal(int level, const struct signalfd_siginfo *si) {
+ if (si->ssi_pid > 0) {
+ _cleanup_free_ char *p = NULL;
+
+ get_process_comm(si->ssi_pid, &p);
+
+ log_full(level,
+ "Received SIG%s from PID "PID_FMT" (%s).",
+ signal_to_string(si->ssi_signo),
+ si->ssi_pid, strna(p));
+ } else
+ log_full(level,
+ "Received SIG%s.",
+ signal_to_string(si->ssi_signo));
+
+}