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/fork.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'libpthread/nptl/sysdeps/unix/sysv/linux/fork.c') diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c index af4041031..49806dab9 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c @@ -135,12 +135,6 @@ fork (void) pid_t ppid = THREAD_GETMEM (THREAD_SELF, tid); #endif - /* We need to prevent the getpid() code to update the PID field so - that, if a signal arrives in the child very early and the signal - handler uses getpid(), the value returned is correct. */ - pid_t parentpid = THREAD_GETMEM (THREAD_SELF, pid); - THREAD_SETMEM (THREAD_SELF, pid, -parentpid); - #ifdef ARCH_FORK pid = ARCH_FORK (); #else @@ -158,9 +152,6 @@ fork (void) if (__fork_generation_pointer != NULL) *__fork_generation_pointer += 4; - /* Adjust the PID field for the new process. */ - THREAD_SETMEM (self, pid, THREAD_GETMEM (self, tid)); - #if HP_TIMING_AVAIL /* The CPU clock of the thread and process have to be set to zero. */ hp_timing_t now; @@ -206,9 +197,6 @@ fork (void) { assert (THREAD_GETMEM (THREAD_SELF, tid) == ppid); - /* Restore the PID value. */ - THREAD_SETMEM (THREAD_SELF, pid, parentpid); - /* We execute this even if the 'fork' call failed. */ __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE(_stdio_openlist_add_lock); -- cgit v1.2.3