diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-07-20 16:19:18 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-07-20 20:27:24 +0200 |
commit | df0ff127758809a45105893772de76082d12a26d (patch) | |
tree | 9deb3a960cf26b54beae6a0b60d376c6ba8efe9a /src/basic/process-util.c | |
parent | 5c30a6d2b805ae9b5dd0ad003b9ee86b8965bc47 (diff) | |
download | systemd-df0ff127758809a45105893772de76082d12a26d.tar.gz |
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.
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r-- | src/basic/process-util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 98adee6d9f..ce6a59c8a4 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -814,7 +814,7 @@ bool is_main_thread(void) { static thread_local int cached = 0; if (_unlikely_(cached == 0)) - cached = getpid() == gettid() ? 1 : -1; + cached = getpid_cached() == gettid() ? 1 : -1; return cached > 0; } @@ -878,7 +878,7 @@ const char* personality_to_string(unsigned long p) { void valgrind_summary_hack(void) { #ifdef HAVE_VALGRIND_VALGRIND_H - if (getpid() == 1 && RUNNING_ON_VALGRIND) { + if (getpid_cached() == 1 && RUNNING_ON_VALGRIND) { pid_t pid; pid = raw_clone(SIGCHLD); if (pid < 0) |