diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-12-30 17:22:26 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-02 19:45:47 -0500 |
commit | ccd06097c79218f7d5ea4c21721bbcbc7c467dca (patch) | |
tree | 168bee7d15161c2c1cba3926447162b84c761898 /src/core/manager.c | |
parent | ab9001a1e3dc6e60d0cdf53363dc5d18dcc382fd (diff) |
Use format patterns for usec_t, pid_t, nsec_t, usec_t
It is nicer to predefine patterns using configure time check instead of
using casts everywhere.
Since we do not need to use any flags, include "%" in the format instead
of excluding it like PRI* macros.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r-- | src/core/manager.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index ea8887a92e..22a3e3ef5d 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1334,7 +1334,7 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t if (!u) { u = manager_get_unit_by_pid(m, ucred->pid); if (!u) { - log_warning("Cannot find unit for notify message of PID %lu.", (unsigned long) ucred->pid); + log_warning("Cannot find unit for notify message of PID "PID_FMT".", ucred->pid); continue; } } @@ -1382,7 +1382,7 @@ static int manager_dispatch_sigchld(Manager *m) { _cleanup_free_ char *name = NULL; get_process_comm(si.si_pid, &name); - log_debug("Got SIGCHLD for process %lu (%s)", (unsigned long) si.si_pid, strna(name)); + log_debug("Got SIGCHLD for process "PID_FMT" (%s)", si.si_pid, strna(name)); } /* And now figure out the unit this belongs to */ @@ -1470,9 +1470,9 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t 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).", + "Received SIG%s from PID "PID_FMT" (%s).", signal_to_string(sfsi.ssi_signo), - (unsigned long) sfsi.ssi_pid, strna(p)); + sfsi.ssi_pid, strna(p)); } else log_full(sfsi.ssi_signo == SIGCHLD || (sfsi.ssi_signo == SIGTERM && m->running_as == SYSTEMD_USER) @@ -1974,9 +1974,9 @@ int manager_open_serialization(Manager *m, FILE **_f) { assert(_f); if (m->running_as == SYSTEMD_SYSTEM) - asprintf(&path, "/run/systemd/dump-%lu-XXXXXX", (unsigned long) getpid()); + asprintf(&path, "/run/systemd/dump-"PID_FMT"-XXXXXX", getpid()); else - asprintf(&path, "/tmp/systemd-dump-%lu-XXXXXX", (unsigned long) getpid()); + asprintf(&path, "/tmp/systemd-dump-"PID_FMT"-XXXXXX", getpid()); if (!path) return -ENOMEM; @@ -2454,9 +2454,9 @@ void manager_check_finished(Manager *m) { if (!log_on_console()) log_struct(LOG_INFO, MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED), - "KERNEL_USEC=%llu", (unsigned long long) kernel_usec, - "INITRD_USEC=%llu", (unsigned long long) initrd_usec, - "USERSPACE_USEC=%llu", (unsigned long long) userspace_usec, + "KERNEL_USEC="USEC_FMT, kernel_usec, + "INITRD_USEC="USEC_FMT, initrd_usec, + "USERSPACE_USEC="USEC_FMT, userspace_usec, "MESSAGE=Startup finished in %s (kernel) + %s (initrd) + %s (userspace) = %s.", format_timespan(kernel, sizeof(kernel), kernel_usec, USEC_PER_MSEC), format_timespan(initrd, sizeof(initrd), initrd_usec, USEC_PER_MSEC), @@ -2470,8 +2470,8 @@ void manager_check_finished(Manager *m) { if (!log_on_console()) log_struct(LOG_INFO, MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED), - "KERNEL_USEC=%llu", (unsigned long long) kernel_usec, - "USERSPACE_USEC=%llu", (unsigned long long) userspace_usec, + "KERNEL_USEC="USEC_FMT, kernel_usec, + "USERSPACE_USEC="USEC_FMT, userspace_usec, "MESSAGE=Startup finished in %s (kernel) + %s (userspace) = %s.", format_timespan(kernel, sizeof(kernel), kernel_usec, USEC_PER_MSEC), format_timespan(userspace, sizeof(userspace), userspace_usec, USEC_PER_MSEC), @@ -2485,7 +2485,7 @@ void manager_check_finished(Manager *m) { if (!log_on_console()) log_struct(LOG_INFO, MESSAGE_ID(SD_MESSAGE_STARTUP_FINISHED), - "USERSPACE_USEC=%llu", (unsigned long long) userspace_usec, + "USERSPACE_USEC="USEC_FMT, userspace_usec, "MESSAGE=Startup finished in %s.", format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC), NULL); |