From df0ff127758809a45105893772de76082d12a26d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 20 Jul 2017 16:19:18 +0200 Subject: tree-wide: make use of getpid_cached() wherever we can This moves pretty much all uses of getpid() over to getpid_raw(). I didn't specifically check whether the optimization is worth it for each replacement, but in order to keep things simple and systematic I switched over everything at once. --- src/update-utmp/update-utmp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/update-utmp') diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c index ae9859ccad..f68d60a134 100644 --- a/src/update-utmp/update-utmp.c +++ b/src/update-utmp/update-utmp.c @@ -33,6 +33,7 @@ #include "format-util.h" #include "log.h" #include "macro.h" +#include "process-util.h" #include "special.h" #include "strv.h" #include "unit-name.h" @@ -258,7 +259,7 @@ int main(int argc, char *argv[]) { goto finish; } - log_debug("systemd-update-utmp running as pid "PID_FMT, getpid()); + log_debug("systemd-update-utmp running as pid "PID_FMT, getpid_cached()); if (streq(argv[1], "reboot")) r = on_reboot(&c); @@ -271,7 +272,7 @@ int main(int argc, char *argv[]) { r = -EINVAL; } - log_debug("systemd-update-utmp stopped as pid "PID_FMT, getpid()); + log_debug("systemd-update-utmp stopped as pid "PID_FMT, getpid_cached()); finish: #ifdef HAVE_AUDIT -- cgit v1.2.1