summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2017-01-22 10:24:51 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2017-01-28 10:31:19 +0100
commitbddde5860ffb8a78587854cc8e3e914bd69269ca (patch)
treed37c90a9ca983fb8be614844343ba2941927f88a
parent30adfbeb8843c28869cc6ee33d7c556721cb241a (diff)
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 <jcmvbkbc@gmail.com> Reviewed-by: Vineet Gupta <Vineet.Gupta1@synopsys.com> Acked-by: Matthew Fortune <Matthew.Fortune@imgtec.com> Acked-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
-rw-r--r--libc/sysdeps/linux/arc/clone.S13
-rw-r--r--libc/sysdeps/linux/arc/vfork.S13
-rw-r--r--libc/sysdeps/linux/arm/clone.S18
-rw-r--r--libc/sysdeps/linux/arm/vfork.S13
-rw-r--r--libc/sysdeps/linux/common/bits/kernel-features.h7
-rw-r--r--libc/sysdeps/linux/i386/Makefile.arch7
-rw-r--r--libc/sysdeps/linux/i386/clone.S8
-rw-r--r--libc/sysdeps/linux/i386/vfork.S8
-rw-r--r--libc/sysdeps/linux/ia64/clone2.S19
-rw-r--r--libc/sysdeps/linux/metag/clone.S21
-rw-r--r--libc/sysdeps/linux/metag/vfork.S12
-rw-r--r--libc/sysdeps/linux/mips/Makefile.arch4
-rw-r--r--libc/sysdeps/linux/mips/clone.S28
-rw-r--r--libc/sysdeps/linux/mips/vfork.S12
-rw-r--r--libc/sysdeps/linux/nds32/clone.S24
-rw-r--r--libc/sysdeps/linux/nds32/vfork.S14
-rw-r--r--libc/sysdeps/linux/nios2/clone.S8
-rw-r--r--libc/sysdeps/linux/nios2/vfork.S17
-rw-r--r--libc/sysdeps/linux/powerpc/Makefile.arch4
-rw-r--r--libc/sysdeps/linux/powerpc/clone.S30
-rw-r--r--libc/sysdeps/linux/sh/Makefile.arch7
-rw-r--r--libc/sysdeps/linux/sh/clone.S36
-rw-r--r--libc/sysdeps/linux/sparc/Makefile.arch8
-rw-r--r--libc/sysdeps/linux/sparc/clone.S17
-rw-r--r--libc/sysdeps/linux/sparc/vfork.S2
-rw-r--r--libc/sysdeps/linux/x86_64/Makefile.arch6
-rw-r--r--libc/sysdeps/linux/x86_64/clone.S13
-rw-r--r--libc/sysdeps/linux/x86_64/vfork.S8
-rw-r--r--libc/sysdeps/linux/xtensa/Makefile.arch4
-rw-r--r--libc/sysdeps/linux/xtensa/clone.S19
-rw-r--r--libc/sysdeps/linux/xtensa/vfork.S25
-rw-r--r--libpthread/nptl/allocatestack.c20
-rw-r--r--libpthread/nptl/descr.h3
-rw-r--r--libpthread/nptl/init.c28
-rw-r--r--libpthread/nptl/pthreadP.h19
-rw-r--r--libpthread/nptl/pthread_cancel.c6
-rw-r--r--libpthread/nptl/sysdeps/alpha/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/arc/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/arm/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/i386/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/metag/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/mips/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/nds32/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/nios2/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/pthread/createthread.c5
-rw-r--r--libpthread/nptl/sysdeps/sh/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/sparc/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/alpha/clone.S2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/alpha/vfork.S45
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arc/clone.S10
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arc/vfork.S11
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch8
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/clone.S3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/arm/vfork.S38
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/fork.c12
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c30
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/clone.S2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/vfork.S37
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/metag/clone.S9
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/metag/vfork.S55
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/clone.S4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/vfork.S5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch7
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/clone.S2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/vfork.S42
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nds32/clone.S4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nds32/vfork.S43
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nios2/clone.S3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nios2/vfork.S38
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/nptl-signals.h84
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.S9
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S57
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c12
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/raise.c51
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S70
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S48
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch6
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S42
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/clone.S3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S59
-rw-r--r--libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym1
-rw-r--r--libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym1
99 files changed, 150 insertions, 1261 deletions
diff --git a/libc/sysdeps/linux/arc/clone.S b/libc/sysdeps/linux/arc/clone.S
index 3942b88f7..c2ce906c9 100644
--- a/libc/sysdeps/linux/arc/clone.S
+++ b/libc/sysdeps/linux/arc/clone.S
@@ -61,20 +61,9 @@ ENTRY(clone)
; Setup TP register (since kernel doesn't do that)
and.f 0, r12, CLONE_SETTLS
bz .Lnext_clone_quirk
- SET_TP r9
+ mov r25, r9
.Lnext_clone_quirk:
-#ifdef RESET_PID
- bbit1 r12, 16, .Lgo_thread ; CLONE_THREAD = (1 << 16)
-
- mov r8, __NR_getpid
- ARC_TRAP_INSN ; r0 has PID
- THREAD_SELF r1 ; Get to struct pthread (just before TCB)
- st r0, [r1, PTHREAD_PID]
- st r0, [r1, PTHREAD_TID]
-
-.Lgo_thread:
-#endif
#endif
; child jumps off to @fn with @arg as argument, and returns here
jl.d [r10]
diff --git a/libc/sysdeps/linux/arc/vfork.S b/libc/sysdeps/linux/arc/vfork.S
index 573a29f26..11959b66b 100644
--- a/libc/sysdeps/linux/arc/vfork.S
+++ b/libc/sysdeps/linux/arc/vfork.S
@@ -16,25 +16,12 @@
#define CLONE_FLAGS_FOR_VFORK (CLONE_VM|CLONE_VFORK|SIGCHLD)
ENTRY(__vfork)
-#ifdef SAVE_PID
- THREAD_SELF r1 ; Get to struct pthread (just before TCB)
- ld r2, [r1, PTHREAD_PID]
- neg.f r3, r2
- bset.z r3, r3, 31
- st r3, [r1, PTHREAD_PID]
-#endif
mov r0, CLONE_FLAGS_FOR_VFORK
mov_s r1, sp
mov r8, __NR_clone
ARC_TRAP_INSN
cmp r0, 0
-#ifdef RESTORE_PID
- bz 1f ; child continues
- THREAD_SELF r1 ; Get to struct pthread (just before TCB)
- st r2, [r1, PTHREAD_PID]
-1:
-#endif
jge [blink] ; pid >=0 return, else detour via tailcall to errno
b __syscall_error
diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index 0b293ecb7..b156e932b 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -110,9 +110,6 @@ __clone:
@ do the system call
@ get flags
mov r0, r2
-#ifdef RESET_PID
- mov ip, r2
-#endif
@ new sp is already in r1
push {r4, r7}
cfi_adjust_cfa_offset (8)
@@ -138,21 +135,6 @@ PSEUDO_END (__clone)
1:
.fnstart
.cantunwind
-#ifdef RESET_PID
- tst ip, #CLONE_THREAD
- bne 3f
- GET_TLS (lr)
- mov r1, r0
- tst ip, #CLONE_VM
- ldr r7, =SYS_ify(getpid)
- ite ne
- movne r0, #-1
- swieq 0x0
- NEGOFF_ADJ_BASE (r1, TID_OFFSET)
- str r0, NEGOFF_OFF1 (r1, TID_OFFSET)
- str r0, NEGOFF_OFF2 (r1, PID_OFFSET, TID_OFFSET)
-3:
-#endif
@ pick the function arg and call address off the stack and execute
ldr r0, [sp, #4]
mov lr, pc
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S
index 221a90c40..455b2f8d9 100644
--- a/libc/sysdeps/linux/arm/vfork.S
+++ b/libc/sysdeps/linux/arm/vfork.S
@@ -13,15 +13,6 @@
#include <bits/errno.h>
#include <sys/syscall.h>
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
-
-
#ifdef __NR_fork
.text
.global __vfork
@@ -33,9 +24,7 @@
.thumb_func
__vfork:
#ifdef __NR_vfork
- SAVE_PID
DO_CALL (vfork)
- RESTORE_PID
ldr r1, =0xfffff000
cmp r0, r1
bcs 1f
@@ -69,9 +58,7 @@ __error:
__vfork:
#ifdef __NR_vfork
- SAVE_PID
DO_CALL (vfork)
- RESTORE_PID
cmn r0, #4096
IT(t, cc)
BXC(cc, lr)
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index 0b3632063..e0195e405 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -375,13 +375,6 @@
# define __ASSUME_AT_SECURE 1
#endif
-/* Starting with the 2.5.75 kernel the kernel fills in the correct value
- in the si_pid field passed as part of the siginfo_t struct to signal
- handlers. */
-#if __LINUX_KERNEL_VERSION >= 132427
-# define __ASSUME_CORRECT_SI_PID 1
-#endif
-
/* The utimes syscall has been available for some architectures
forever. For x86 it was introduced after 2.5.75, for x86-64,
ppc, and ppc64 it was introduced in 2.6.0-test3. */
diff --git a/libc/sysdeps/linux/i386/Makefile.arch b/libc/sysdeps/linux/i386/Makefile.arch
index e1739e193..6c9eed897 100644
--- a/libc/sysdeps/linux/i386/Makefile.arch
+++ b/libc/sysdeps/linux/i386/Makefile.arch
@@ -6,11 +6,8 @@
#
CSRC-y := brk.c __syscall_error.c sigaction.c
-
-SSRC-y := \
- __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
- sync_file_range.S syscall.S mmap.S mmap64.S
+SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
+ sync_file_range.S syscall.S mmap.S mmap64.S vfork.S clone.S
SSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.S
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += vfork.S clone.S
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.S setcontext.S getcontext.S swapcontext.S
diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S
index 632cf59df..68e87b567 100644
--- a/libc/sysdeps/linux/i386/clone.S
+++ b/libc/sysdeps/linux/i386/clone.S
@@ -78,10 +78,6 @@ clone:
movl %eax,8(%ecx)
/* Don't leak any information. */
movl $0,4(%ecx)
-#ifndef RESET_PID
- movl $0,(%ecx)
-#endif
-
/* Do the system call */
pushl %ebx
@@ -92,10 +88,6 @@ clone:
movl FLAGS+12(%esp),%ebx
movl CTID+12(%esp),%edi
movl $__NR_clone,%eax
-#ifdef RESET_PID
- /* Remember the flag value. */
- movl %ebx, (%ecx)
-#endif
int $0x80
popl %edi
popl %esi
diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S
index d85726f19..6c4102e0a 100644
--- a/libc/sysdeps/linux/i386/vfork.S
+++ b/libc/sysdeps/linux/i386/vfork.S
@@ -19,18 +19,10 @@
__vfork:
popl %ecx
-#ifdef SAVE_PID
- SAVE_PID
-#endif
-
movl $__NR_vfork,%eax
int $0x80
pushl %ecx
-#ifdef RESTORE_PID
- RESTORE_PID
-#endif
-
cmpl $-4095,%eax
jae __syscall_error
ret