*timeout = MIN(x, y);
- log_info("job_get_timeout %s %d/%"PRIu64" %d/%"PRIu64" -> 1/%"PRIu64,
- j->unit->id, r, x, q, y, *timeout);
-
return 1;
}
return -errno;
}
- if (sfsi.ssi_pid > 0) {
- _cleanup_free_ char *p = NULL;
-
- get_process_comm(sfsi.ssi_pid, &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 "PID_FMT" (%s).",
- signal_to_string(sfsi.ssi_signo),
- sfsi.ssi_pid, strna(p));
- } else
- 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));
+ log_received_signal(sfsi.ssi_signo == SIGCHLD ||
+ (sfsi.ssi_signo == SIGTERM && m->running_as == SYSTEMD_USER)
+ ? LOG_DEBUG : LOG_INFO,
+ &sfsi);
switch (sfsi.ssi_signo) {
assert(s);
- log_info("Received SIG%s", signal_to_string(si->ssi_signo));
+ log_received_signal(LOG_INFO, si);
sd_event_exit(s->event, 0);
return 0;
};
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));
+
+}
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <syslog.h>
#include <stdbool.h>
#include <stdarg.h>
+#include <syslog.h>
+#include <sys/signalfd.h>
#include <errno.h>
#include "macro.h"
LogTarget log_target_from_string(const char *s) _pure_;
#define MESSAGE_ID(x) "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(x)
+
+void log_received_signal(int level, const struct signalfd_siginfo *si);