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.
This commit is contained in:
Lennart Poettering
2017-07-20 20:27:24 +02:00
parent 5c30a6d2b8
commit df0ff12775
53 changed files with 161 additions and 151 deletions
+2 -2
View File
@@ -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)