process-util: use raw_getpid() in getpid_cache() internally (#8115)
We have the raw_getpid() definition in place anyway, and it's certainly beneficial to expose the same semantics on pre glibc 2.24 and after it too, hence always bypass glibc for this, and always cache things on our side. Fixes: #8113
This commit is contained in:
committed by
Yu Watanabe
parent
3f602115b7
commit
996def17f9
@@ -1137,7 +1137,7 @@ pid_t getpid_cached(void) {
|
||||
case CACHED_PID_UNSET: { /* Not initialized yet, then do so now */
|
||||
pid_t new_pid;
|
||||
|
||||
new_pid = getpid();
|
||||
new_pid = raw_getpid();
|
||||
|
||||
if (__register_atfork(NULL, NULL, reset_cached_pid, __dso_handle) != 0) {
|
||||
/* OOM? Let's try again later */
|
||||
@@ -1150,7 +1150,7 @@ pid_t getpid_cached(void) {
|
||||
}
|
||||
|
||||
case CACHED_PID_BUSY: /* Somebody else is currently initializing */
|
||||
return getpid();
|
||||
return raw_getpid();
|
||||
|
||||
default: /* Properly initialized */
|
||||
return current_value;
|
||||
|
||||
Reference in New Issue
Block a user