From bddde5860ffb8a78587854cc8e3e914bd69269ca Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 22 Jan 2017 10:24:51 +0100 Subject: remove PID caching Follow GNU C Library from c579f48edba88380635ab98cb612030e3ed8691e and remove the PID caching. These simplifies the architecture specific assembly code. The run of the test suite found no regressions, it even solves some of the test failures for x86/x86_64/sparc. Reviewed-by: Max Filippov Reviewed-by: Vineet Gupta Acked-by: Matthew Fortune Acked-by: Alexey Brodkin --- libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c | 30 ------------------------ 1 file changed, 30 deletions(-) (limited to 'libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c') diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c index 24abccc93..03b1031a4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c @@ -25,41 +25,11 @@ # define __NR_getpid __NR_getxpid #endif -#ifndef NOT_IN_libc -static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval); - -static inline __attribute__((always_inline)) pid_t -really_getpid (pid_t oldval) -{ - if (__builtin_expect (oldval == 0, 1)) - { - pid_t selftid = THREAD_GETMEM (THREAD_SELF, tid); - if (__builtin_expect (selftid != 0, 1)) - return selftid; - } - - INTERNAL_SYSCALL_DECL (err); - pid_t result = INTERNAL_SYSCALL (getpid, err, 0); - - /* We do not set the PID field in the TID here since we might be - called from a signal handler while the thread executes fork. */ - if (oldval == 0) - THREAD_SETMEM (THREAD_SELF, tid, result); - return result; -} -#endif - static pid_t __getpid (void) { -#ifdef NOT_IN_libc INTERNAL_SYSCALL_DECL (err); pid_t result = INTERNAL_SYSCALL (getpid, err, 0); -#else - pid_t result = THREAD_GETMEM (THREAD_SELF, pid); - if (__builtin_expect (result <= 0, 0)) - result = really_getpid (result); -#endif return result; } weak_alias(__getpid, getpid) -- cgit v1.2.3