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/execute.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/execute.c')
-rw-r--r-- | src/core/execute.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 7f93c0c3b1..39c0fed7ac 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1038,7 +1038,7 @@ static int build_environment( return -ENOMEM; if (n_fds > 0) { - if (asprintf(&x, "LISTEN_PID=%lu", (unsigned long) getpid()) < 0) + if (asprintf(&x, "LISTEN_PID="PID_FMT, getpid()) < 0) return -ENOMEM; our_env[n_env++] = x; @@ -1048,7 +1048,7 @@ static int build_environment( } if (watchdog_usec > 0) { - if (asprintf(&x, "WATCHDOG_PID=%lu", (unsigned long) getpid()) < 0) + if (asprintf(&x, "WATCHDOG_PID="PID_FMT, getpid()) < 0) return -ENOMEM; our_env[n_env++] = x; @@ -1636,8 +1636,8 @@ int exec_spawn(ExecCommand *command, log_struct_unit(LOG_DEBUG, unit_id, - "MESSAGE=Forked %s as %lu", - command->path, (unsigned long) pid, + "MESSAGE=Forked %s as "PID_FMT, + command->path, pid, NULL); /* We add the new process to the cgroup both in the child (so @@ -1979,7 +1979,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { } if (c->timer_slack_nsec != (nsec_t) -1) - fprintf(f, "%sTimerSlackNSec: %lu\n", prefix, (unsigned long)c->timer_slack_nsec); + fprintf(f, "%sTimerSlackNSec: "NSEC_FMT "\n", prefix, c->timer_slack_nsec); fprintf(f, "%sStandardInput: %s\n" @@ -2139,8 +2139,8 @@ void exec_status_dump(ExecStatus *s, FILE *f, const char *prefix) { return; fprintf(f, - "%sPID: %lu\n", - prefix, (unsigned long) s->pid); + "%sPID: "PID_FMT"\n", + prefix, s->pid); if (s->start_timestamp.realtime > 0) fprintf(f, |