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
diff --git a/libc/sysdeps/linux/ia64/clone2.S b/libc/sysdeps/linux/ia64/clone2.S
index c077f722a..692ee3600 100644
--- a/libc/sysdeps/linux/ia64/clone2.S
+++ b/libc/sysdeps/linux/ia64/clone2.S
@@ -16,11 +16,8 @@
<http://www.gnu.org/licenses/>. */
#include "sysdep.h"
-
-#include "sysdep.h"
#include <asm/errno.h>
-
/* int __clone2(int (*fn) (void *arg), void *child_stack_base, */
/* size_t child_stack_size, int flags, void *arg, */
/* pid_t *parent_tid, void *tls, pid_t *child_tid) */
@@ -68,22 +65,6 @@ ENTRY(__clone2)
(CHILD) mov loc0=gp
(PARENT) ret
;;
-#ifdef RESET_PID
- tbit.nz p6,p0=in3,16 /* CLONE_THREAD */
- tbit.z p7,p10=in3,8 /* CLONE_VM */
-(p6) br.cond.dptk 1f
- ;;
- mov r15=SYS_ify (getpid)
-(p10) addl r8=-1,r0
-(p7) break __BREAK_SYSCALL
- ;;
- add r9=PID,r13
- add r10=TID,r13
- ;;
- st4 [r9]=r8
- st4 [r10]=r8
- ;;
-#endif
1: ld8 out1=[in0],8 /* Retrieve code pointer. */
mov out0=in4 /* Pass proper argument to fn */
;;
diff --git a/libc/sysdeps/linux/metag/clone.S b/libc/sysdeps/linux/metag/clone.S
index d9d836338..4687cbc0f 100644
--- a/libc/sysdeps/linux/metag/clone.S
+++ b/libc/sysdeps/linux/metag/clone.S
@@ -52,27 +52,6 @@ __clone:
! BRKPNT
! We are the child
-#ifdef RESET_PID
- SETL [A0StP++], D0FrT, D1RtP
- MOVT D0FrT, #HI(CLONE_THREAD)
- ADD D0FrT, D0FrT, #LO(CLONE_THREAD)
- ANDS D0FrT, D0FrT, D1Ar1
- BNZ 3f
- MOVT D0FrT, #HI(CLONE_VM)
- ADD D0FrT, D0FrT, #LO(CLONE_VM)
- ANDS D0FrT, D0FrT, D1Ar1
- BZ 1f
- MOV D1Ar1, #-1
- BA 2f
-1: MOV D1Re0, #__NR_getpid
- SWITCH #0x440001
- MOV D1Ar1, D0Re0
-2: CALLR D1RtP, __CLONE_METAG_LOAD_TP
- SUB D0Re0, D0Re0, #TLS_PRE_TCB_SIZE
- SETD [D0Re0 + #PID], D1Ar1
- SETD [D0Re0 + #TID], D1Ar1
-3: GETL D0FrT, D1RtP, [--A0StP]
-#endif
! Rearrange the function arg and call address from registers
MOV D0Ar2, D0FrT
MOV D1Ar1, D0Ar6
diff --git a/libc/sysdeps/linux/metag/vfork.S b/libc/sysdeps/linux/metag/vfork.S
index 8573dedd3..5e2fc8808 100644
--- a/libc/sysdeps/linux/metag/vfork.S
+++ b/libc/sysdeps/linux/metag/vfork.S
@@ -8,14 +8,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_vfork
#define __VFORK_NR __NR_vfork
#else
@@ -33,8 +25,6 @@
.type ___vfork, @function
___vfork:
- SAVE_PID
-
MOV D1Ar1, #0x4111 /* CLONE_VM | CLONE_VFORK | SIGCHLD */
MOV D0Ar2, #0
MOV D1Ar3, #0
@@ -44,8 +34,6 @@ ___vfork:
MOV D1Re0, #__NR_clone
SWITCH #0x440001
- RESTORE_PID
-
MOVT D1Re0, #HI(-4096)
ADD D1Re0, D1Re0, #LO(-4096)
CMP D1Re0, D0Re0
diff --git a/libc/sysdeps/linux/mips/Makefile.arch b/libc/sysdeps/linux/mips/Makefile.arch
index 10deedc3e..5e54b07a6 100644
--- a/libc/sysdeps/linux/mips/Makefile.arch
+++ b/libc/sysdeps/linux/mips/Makefile.arch
@@ -9,11 +9,11 @@ CSRC-y := \
__longjmp.c brk.c setjmp_aux.c \
pread_write.c sigaction.c _test_and_set.c
-SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S syscall_error.S
+SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S syscall.S pipe.S syscall_error.S \
+ vfork.S clone.S
CSRC-$(UCLIBC_LINUX_SPECIFIC) += cacheflush.c sysmips.c
CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise.c posix_fadvise64.c
-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/mips/clone.S b/libc/sysdeps/linux/mips/clone.S
index 1b5a8f472..326d1d34a 100644
--- a/libc/sysdeps/linux/mips/clone.S
+++ b/libc/sysdeps/linux/mips/clone.S
@@ -24,9 +24,6 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef RESET_PID
-#include <tls.h>
-#endif
#define CLONE_VM 0x00000100
#define CLONE_THREAD 0x00010000
@@ -61,9 +58,6 @@ NESTED(clone,4*SZREG,sp)
PTR_SUBU a1,32 /* Reserve argument save space. */
PTR_S a0,0(a1) /* Save function pointer. */
PTR_S a3,PTRSIZE(a1) /* Save argument pointer. */
-#ifdef RESET_PID
- LONG_S a2,(PTRSIZE*2)(a1) /* Save clone flags. */
-#endif
move a0,a2
@@ -122,14 +116,6 @@ L(thread_start):
SAVE_GP (GPOFF)
/* The stackframe has been created on entry of clone(). */
-#ifdef RESET_PID
- /* Check and see if we need to reset the PID. */
- LONG_L a0,(PTRSIZE*2)(sp)
- and a1,a0,CLONE_THREAD
- beqz a1,L(restore_pid)
-L(donepid):
-#endif
-
/* Restore the arg for user's function. */
PTR_L t9,0(sp) /* Function pointer. */
PTR_L a0,PTRSIZE(sp) /* Argument pointer. */
@@ -146,20 +132,6 @@ L(donepid):
jal _exit
#endif
-#ifdef RESET_PID
-L(restore_pid):
- and a1,a0,CLONE_VM
- li v0,-1
- bnez a1,L(gotpid)
- li v0,__NR_getpid
- syscall
-L(gotpid):
- READ_THREAD_POINTER(v1)
- INT_S v0,PID_OFFSET(v1)
- INT_S v0,TID_OFFSET(v1)
- b L(donepid)
-#endif
-
END(__thread_start)
weak_alias(clone, __clone)
diff --git a/libc/sysdeps/linux/mips/vfork.S b/libc/sysdeps/linux/mips/vfork.S
index 494c34fd0..f504c2bb0 100644
--- a/libc/sysdeps/linux/mips/vfork.S
+++ b/libc/sysdeps/linux/mips/vfork.S
@@ -21,14 +21,6 @@
#include <sys/asm.h>
#include <sysdep.h>
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
-
#ifdef __NR_fork
/* int vfork() */
@@ -50,8 +42,6 @@ NESTED(__vfork,FRAMESZ,sp)
PTR_ADDU sp, FRAMESZ
- SAVE_PID
-
li a0, 0x4112 /* CLONE_VM | CLONE_VFORK | SIGCHLD */
move a1, sp
@@ -59,8 +49,6 @@ NESTED(__vfork,FRAMESZ,sp)
li v0,__NR_clone
syscall
- RESTORE_PID
-
bnez a3,L(error)
/* Successful return from the parent or child. */
diff --git a/libc/sysdeps/linux/nds32/clone.S b/libc/sysdeps/linux/nds32/clone.S
index 1ed77fb2e..0e6e432de 100644
--- a/libc/sysdeps/linux/nds32/clone.S
+++ b/libc/sysdeps/linux/nds32/clone.S
@@ -28,10 +28,6 @@
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
-
#define CLONE_VM 0x00000100
#define CLONE_THREAD 0x00010000
@@ -131,27 +127,7 @@ ENTRY(__clone)
cfi_restore(fp)
#endif /* PIC */
ret
-
-#ifdef RESET_PID
4:
- cfi_undefined(lp)
- movi $r0, CLONE_THREAD ! Skip when CLONE_THREAD is set.
- and $r0, $r5, $r0
- bnez $r0, 8f
- movi $r0, CLONE_VM ! Value = -1 when CLONE_VM is set.
- and $r0, $r5, $r0
- beqz $r0, 6f
- movi $r0, -1
- j 7f
-6:
- __do_syscall(getpid) ! __do_syscall(gettid) ! __do_syscall(getpid)
-7:
- swi $r0, [$r25 + PID_OFFSET]
- swi $r0, [$r25 + TID_OFFSET]
-8:
-#else
-4:
-#endif
/* Only in child's stack. */
pop $r1 ! fn
pop $r0 ! arg
diff --git a/libc/sysdeps/linux/nds32/vfork.S b/libc/sysdeps/linux/nds32/vfork.S
index ac3fa30fd..ab32135fc 100644
--- a/libc/sysdeps/linux/nds32/vfork.S
+++ b/libc/sysdeps/linux/nds32/vfork.S
@@ -25,32 +25,18 @@
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifndef SAVE_PID
-#define SAVE_PID
-#endif
-
-#ifndef RESTORE_PID
-#define RESTORE_PID
-#endif
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
-
ENTRY (__vfork)
#ifdef PIC
.pic
#endif
#ifdef __NR_vfork
-# ifdef SAVE_PID
- SAVE_PID
-# endif
syscall __NR_vfork
-# ifdef RESTORE_PID
- RESTORE_PID
-# endif
bltz $r0, 2f
1:
ret
diff --git a/libc/sysdeps/linux/nios2/clone.S b/libc/sysdeps/linux/nios2/clone.S
index 0626d8aa2..04f06348c 100644
--- a/libc/sysdeps/linux/nios2/clone.S
+++ b/libc/sysdeps/linux/nios2/clone.S
@@ -24,10 +24,6 @@
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <tcb-offsets.h>
-#endif
-
#define CLONE_VM 0x00000100
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
@@ -64,10 +60,6 @@ thread_start:
andi r2, r4, CLONE_VM
bne r2, zero, 2f
DO_CALL (getpid, 0)
-#ifdef RESET_PID
- stw r2, PID_OFFSET(r23)
- stw r2, TID_OFFSET(r23)
-#endif
2:
ldw r5, 4(sp) /* Function pointer. */
ldw r4, 0(sp) /* Argument pointer. */
diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S
index 99e4a73e1..2bef2a982 100644
--- a/libc/sysdeps/linux/nios2/vfork.S
+++ b/libc/sysdeps/linux/nios2/vfork.S
@@ -18,21 +18,7 @@
#include <sysdep.h>
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <tcb-offsets.h>
-#endif
-
ENTRY(__vfork)
-
-#ifdef RESET_PID
- ldw r6, PID_OFFSET(r23)
- sub r7, zero, r6
- bne r7, zero, 2f
- movhi r7, %hi(0x80000000)
-2:
- stw r7, PID_OFFSET(r23)
-#endif
-
movi r4, 0x4111 /* (CLONE_VM | CLONE_VFORK | SIGCHLD) */
mov r5, zero
@@ -42,9 +28,6 @@ ENTRY(__vfork)
trap
beq r2, zero, 1f
-#ifdef RESET_PID
- stw r6, PID_OFFSET(r23)
-#endif
1:
ret
diff --git a/libc/sysdeps/linux/powerpc/Makefile.arch b/libc/sysdeps/linux/powerpc/Makefile.arch
index f0144e7b9..9dc27c4a5 100644
--- a/libc/sysdeps/linux/powerpc/Makefile.arch
+++ b/libc/sysdeps/linux/powerpc/Makefile.arch
@@ -10,9 +10,7 @@ CSRC-$(if $(UCLIBC_HAS_LONG_DOUBLE_MATH),,y) += copysignl.c
SSRC-y := \
__longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
- __uClibc_syscall.S syscall.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S vfork.S
+ __uClibc_syscall.S syscall.S clone.S vfork.S
ifeq ($(CONFIG_E500),y)
ARCH_HEADERS := fenv.h
diff --git a/libc/sysdeps/linux/powerpc/clone.S b/libc/sysdeps/linux/powerpc/clone.S
index 8efbbda1a..45319d00d 100644
--- a/libc/sysdeps/linux/powerpc/clone.S
+++ b/libc/sysdeps/linux/powerpc/clone.S
@@ -47,14 +47,10 @@ __clone:
/* Set up stack frame for parent. */
stwu r1,-32(r1)
cfi_adjust_cfa_offset (32)
-#ifdef RESET_PID
- stmw r28,16(r1)
-#else
-# ifndef __ASSUME_FIXED_CLONE_SYSCALL
+#ifndef __ASSUME_FIXED_CLONE_SYSCALL
stmw r29,16(r1)
-# else
+#else
stmw r30,16(r1)
-# endif
#endif
/* Set up stack frame for child. */
@@ -67,9 +63,6 @@ __clone:
#ifndef __ASSUME_FIXED_CLONE_SYSCALL
mr r29,r4 /* Stack pointer in r29. */
#endif
-#ifdef RESET_PID
- mr r28,r5
-#endif
mr r31,r6 /* Argument in r31. */
/* 'flags' argument is first parameter to clone syscall. (The other
@@ -101,17 +94,6 @@ __clone:
mr r1,r29
#endif
-#ifdef RESET_PID
- andis. r0,r28,CLONE_THREAD>>16
- bne+ r0,.Loldpid
- andi. r0,r28,CLONE_VM
- li r3,-1
- bne- r0,.Lnomoregetpid
-.Lnomoregetpid:
- stw r3,TID(r2)
- stw r3,PID(r2)
-.Loldpid:
-#endif
/* Call procedure. */
mtctr r30
mr r3,r31
@@ -121,14 +103,10 @@ __clone:
.Lparent:
/* Parent. Restore registers & return. */
-#ifdef RESET_PID
- lmw r28,16(r1)
-#else
-# ifndef __ASSUME_FIXED_CLONE_SYSCALL
+#ifndef __ASSUME_FIXED_CLONE_SYSCALL
lmw r29,16(r1)
-# else
+#else
lmw r30,16(r1)
-# endif
#endif
addi r1,r1,32
bnslr+
diff --git a/libc/sysdeps/linux/sh/Makefile.arch b/libc/sysdeps/linux/sh/Makefile.arch
index 99a77213b..6103381fd 100644
--- a/libc/sysdeps/linux/sh/Makefile.arch
+++ b/libc/sysdeps/linux/sh/Makefile.arch
@@ -6,10 +6,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC-y := \
- pipe.c __init_brk.c brk.c sbrk.c pread_write.c
-
-SSRC-y := setjmp.S __longjmp.S ___fpscr_values.S
+CSRC-y := pipe.c __init_brk.c brk.c sbrk.c pread_write.c
+SSRC-y := setjmp.S __longjmp.S ___fpscr_values.S clone.S vfork.S
CSRC-$(UCLIBC_LINUX_SPECIFIC) += cacheflush.c
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S vfork.S
diff --git a/libc/sysdeps/linux/sh/clone.S b/libc/sysdeps/linux/sh/clone.S
index 3ed6b25de..334f83f1a 100644
--- a/libc/sysdeps/linux/sh/clone.S
+++ b/libc/sysdeps/linux/sh/clone.S
@@ -23,9 +23,7 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
+
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
pid_t *ptid, void *tls, pid_t *ctid); */
@@ -85,29 +83,7 @@ ENTRY(__clone)
2:
/* terminate the stack frame */
mov #0, r14
-#ifdef RESET_PID
- mov r4, r0
- shlr16 r0
- tst #1, r0 // CLONE_THREAD = (1 << 16)
- bf/s 4f
- mov r4, r0
- /* new pid */
- shlr8 r0
- tst #1, r0 // CLONE_VM = (1 << 8)
- bf/s 3f
- mov #-1, r0
- mov #+SYS_ify(getpid), r3
- trapa #0x15
-3:
- stc gbr, r1
- mov.w .Lpidoff, r2
- add r1, r2
- mov.l r0, @r2
- mov.w .Ltidoff, r2
- add r1, r2
- mov.l r0, @r2
-4:
-#endif
+
/* thread starts */
mov.l @r15, r1
jsr @r1
@@ -138,12 +114,6 @@ ENTRY(__clone)
.long _GLOBAL_OFFSET_TABLE_
.L3:
.long PLTJMP(C_SYMBOL_NAME(_exit))
-#ifdef RESET_PID
-.Lpidoff:
- .word PID - TLS_PRE_TCB_SIZE
-.Ltidoff:
- .word TID - TLS_PRE_TCB_SIZE
-#endif
-PSEUDO_END (__clone)
+PSEUDO_END (__clone)
weak_alias (__clone, clone)
diff --git a/libc/sysdeps/linux/sparc/Makefile.arch b/libc/sysdeps/linux/sparc/Makefile.arch
index 92ea7d93f..be393b832 100644
--- a/libc/sysdeps/linux/sparc/Makefile.arch
+++ b/libc/sysdeps/linux/sparc/Makefile.arch
@@ -6,12 +6,8 @@
#
CSRC-y := brk.c __syscall_error.c sigaction.c
-
-SSRC-y := \
- __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
- syscall.S urem.S udiv.S umul.S sdiv.S rem.S pipe.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.S vfork.S clone.S
+SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
+ syscall.S urem.S udiv.S umul.S sdiv.S rem.S pipe.S fork.S vfork.S clone.S
CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S
diff --git a/libc/sysdeps/linux/sparc/clone.S b/libc/sysdeps/linux/sparc/clone.S
index 1d0e3e6e1..3ee88da78 100644
--- a/libc/sysdeps/linux/sparc/clone.S
+++ b/libc/sysdeps/linux/sparc/clone.S
@@ -22,9 +22,6 @@
#include <asm/errno.h>
#include <asm/unistd.h>
-#ifdef RESET_PID
-#include <tcb-offsets.h>
-#endif
#include <sysdep.h>
#define CLONE_VM 0x00000100
@@ -83,20 +80,6 @@ END(__clone)
.type __thread_start,@function
__thread_start:
-#ifdef RESET_PID
- sethi %hi(CLONE_THREAD), %l0
- andcc %g4, %l0, %g0
- bne 1f
- andcc %g4, CLONE_VM, %g0
- bne,a 2f
- mov -1,%o0
- set __NR_getpid,%g1
- ta 0x10
-2:
- st %o0,[%g7 + PID]
- st %o0,[%g7 + TID]
-1:
-#endif
mov %g0, %fp /* terminate backtrace */
call %g2
mov %g3,%o0
diff --git a/libc/sysdeps/linux/sparc/vfork.S b/libc/sysdeps/linux/sparc/vfork.S
index e5a3c303d..5b05e6476 100644
--- a/libc/sysdeps/linux/sparc/vfork.S
+++ b/libc/sysdeps/linux/sparc/vfork.S
@@ -16,8 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Code taken from glibc2.2.2/sysdeps/unix/sysv/linux/sparc/vfork.S */
-
#include <sys/syscall.h>
#ifndef __NR_vfork
diff --git a/libc/sysdeps/linux/x86_64/Makefile.arch b/libc/sysdeps/linux/x86_64/Makefile.arch
index 2bc838f0e..d84e43daa 100644
--- a/libc/sysdeps/linux/x86_64/Makefile.arch
+++ b/libc/sysdeps/linux/x86_64/Makefile.arch
@@ -6,11 +6,9 @@
#
CSRC-y := brk.c __syscall_error.c sigaction.c
+SSRC-y := __longjmp.S setjmp.S syscall.S bsd-setjmp.S bsd-_setjmp.S \
+ vfork.S clone.S
-SSRC-y := \
- __longjmp.S setjmp.S syscall.S bsd-setjmp.S bsd-_setjmp.S
-
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += vfork.S clone.S
ARCH_OBJ_FILTEROUT-$(UCLIBC_LINUX_SPECIFIC) := sched_getcpu.c
ifeq ($(UCLIBC_LINUX_SPECIFIC),y)
SSRC-$(UCLIBC_HAS_TLS) += sched_getcpu.S
diff --git a/libc/sysdeps/linux/x86_64/clone.S b/libc/sysdeps/linux/x86_64/clone.S
index 374504140..3dda8da02 100644
--- a/libc/sysdeps/linux/x86_64/clone.S
+++ b/libc/sysdeps/linux/x86_64/clone.S
@@ -89,19 +89,6 @@ clone:
the outermost frame obviously. */
xorl %ebp, %ebp
-#ifdef RESET_PID
- testq $CLONE_THREAD, %rdi
- jne 1f
- testq $CLONE_VM, %rdi
- movl $-1, %eax
- jne 2f
- movl $__NR_getpid, %eax
- syscall
-2: movl %eax, %fs:PID
- movl %eax, %fs:TID
-1:
-#endif
-
/* Set up arguments for the function call. */
popq %rax /* Function to call. */
popq %rdi /* Argument. */
diff --git a/libc/sysdeps/linux/x86_64/vfork.S b/libc/sysdeps/linux/x86_64/vfork.S
index a8a2f6e4b..8e096bc3e 100644
--- a/libc/sysdeps/linux/x86_64/vfork.S
+++ b/libc/sysdeps/linux/x86_64/vfork.S
@@ -38,10 +38,6 @@ __vfork:
is preserved by the syscall and that we're allowed to destroy. */
popq %rdi
-#ifdef SAVE_PID
- SAVE_PID
-#endif
-
/* Stuff the syscall number in RAX and enter into the kernel. */
movl $__NR_vfork, %eax
syscall
@@ -49,10 +45,6 @@ __vfork:
/* Push back the return PC. */
pushq %rdi
-#ifdef RESTORE_PID
- RESTORE_PID
-#endif
-
cmpl $-4095, %eax
jae __syscall_error /* Branch forward if it failed. */
diff --git a/libc/sysdeps/linux/xtensa/Makefile.arch b/libc/sysdeps/linux/xtensa/Makefile.arch
index b9b6b87d5..23cd08ee5 100644
--- a/libc/sysdeps/linux/xtensa/Makefile.arch
+++ b/libc/sysdeps/linux/xtensa/Makefile.arch
@@ -6,9 +6,7 @@
#
CSRC-y := brk.c sigaction.c __syscall_error.c
-
SSRC-y := bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S \
- sigrestorer.S syscall.S mmap.S windowspill.S __longjmp.S vfork.S
+ sigrestorer.S syscall.S mmap.S windowspill.S __longjmp.S vfork.S
CSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += fork.c
-SSRC-$(if $(UCLIBC_HAS_THREADS_NATIVE),,y) += clone.S
diff --git a/libc/sysdeps/linux/xtensa/clone.S b/libc/sysdeps/linux/xtensa/clone.S
index efdfcdd5e..913ec5a5f 100644
--- a/libc/sysdeps/linux/xtensa/clone.S
+++ b/libc/sysdeps/linux/xtensa/clone.S
@@ -21,9 +21,6 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
-#ifdef RESET_PID
-#include <tls.h>
-#endif
#define __ASSEMBLY__
#include <linux/sched.h>
@@ -76,21 +73,6 @@ ENTRY (__clone)
# error invalid values for CLONE_THREAD or CLONE_VM
#endif
-#ifdef RESET_PID
- bbsi.l a6, 16, .Lskip_restore_pid /* CLONE_THREAD = 0x00010000 */
- movi a2, -1
- bbsi a6, 8, .Lgotpid /* CLONE_VM = 0x00000100 */
- movi a2, SYS_ify(getpid)
- syscall
-.Lgotpid:
- rur a3, threadptr
- movi a0, TLS_PRE_TCB_SIZE
- sub a3, a3, a0
- s32i a2, a3, PID
- s32i a2, a3, TID
-.Lskip_restore_pid:
-#endif
-
/* start child thread */
movi a0, 0 /* terminate the stack frame */
@@ -115,5 +97,4 @@ ENTRY (__clone)
#endif
PSEUDO_END (__clone)
-
weak_alias (__clone, clone)
diff --git a/libc/sysdeps/linux/xtensa/vfork.S b/libc/sysdeps/linux/xtensa/vfork.S
index 8058fb057..140ab775e 100644
--- a/libc/sysdeps/linux/xtensa/vfork.S
+++ b/libc/sysdeps/linux/xtensa/vfork.S
@@ -34,16 +34,6 @@
*/
-#ifndef SAVE_PID
-#define SAVE_PID(a,b,c,d)
-#endif
-#ifndef RESTORE_PID
-#define RESTORE_PID(a,b,c)
-#endif
-#ifndef RESTORE_PID12
-#define RESTORE_PID12(a,b,c)
-#endif
-
/*
pid_t vfork(void);
Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0)
@@ -73,8 +63,6 @@ HIDDEN_ENTRY (__vfork)
.L4: mov a12, a2
mov a13, a3
- SAVE_PID(a5,a15,a2,a3)
-
/* use syscall 'clone' and set new stack pointer to the same address */
movi a2, SYS_ify(clone)
@@ -83,8 +71,6 @@ HIDDEN_ENTRY (__vfork)
syscall
- RESTORE_PID(a5,a15,a2)
-
movi a5, -4096
mov a6, a2
@@ -102,16 +88,12 @@ HIDDEN_ENTRY (__vfork)
mov a13, a3
mov a14, a6
- SAVE_PID(a9,a15,a2,a3)
-
movi a2, SYS_ify(clone)
movi a3, 0
movi a6, CLONE_VM | CLONE_VFORK | SIGCHLD
syscall
- RESTORE_PID(a9,a15,a2)
-
movi a9, -4096
mov a10, a2
@@ -131,16 +113,12 @@ HIDDEN_ENTRY (__vfork)
mov a13, a3
mov a14, a6
- SAVE_PID (a2,a3,a2,a6)
-
movi a2, SYS_ify(clone)
movi a3, 0
movi a6, CLONE_VM | CLONE_VFORK | SIGCHLD
syscall
- RESTORE_PID12(a3,a6,a15)
-
mov a3, a13
movi a13, -4096
@@ -168,7 +146,6 @@ HIDDEN_ENTRY (__vfork)
.Lpseudo_end:
retw
#elif defined(__XTENSA_CALL0_ABI__)
- SAVE_PID(a5, a8, a3, a4)
/* Use syscall 'clone'. Set new stack pointer to the same address. */
movi a2, SYS_ify (clone)
@@ -176,8 +153,6 @@ HIDDEN_ENTRY (__vfork)
movi a6, CLONE_VM | CLONE_VFORK | SIGCHLD
syscall
- RESTORE_PID(a5, a8, a2)
-
movi a3, -4096
bgeu a2, a3, 1f
ret
diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c
index 39ec8577e..ccf34d6f6 100644
--- a/libpthread/nptl/allocatestack.c
+++ b/libpthread/nptl/allocatestack.c
@@ -418,9 +418,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
THREAD_SYSINFO(pd) = THREAD_SELF_SYSINFO;
#endif
- /* The process ID is also the same as that of the caller. */
- pd->pid = THREAD_GETMEM (THREAD_SELF, pid);
-
/* Allocate the DTV for this thread. */
if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL)
{
@@ -556,9 +553,6 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
THREAD_SYSINFO(pd) = THREAD_SELF_SYSINFO;
#endif
- /* The process ID is also the same as that of the caller. */
- pd->pid = THREAD_GETMEM (THREAD_SELF, pid);
-
/* Allocate the DTV for this thread. */
if (_dl_allocate_tls (TLS_TPADJ (pd)) == NULL)
{
@@ -833,9 +827,6 @@ __reclaim_stacks (void)
/* This marks the stack as free. */
curp->tid = 0;
- /* The PID field must be initialized for the new process. */
- curp->pid = self->pid;
-
/* Account for the size of the stack. */
stack_cache_actsize += curp->stackblock_size;
@@ -862,13 +853,6 @@ __reclaim_stacks (void)
}
}
- /* Reset the PIDs in any cached stacks. */
- list_for_each (runp, &stack_cache)
- {
- struct pthread *curp = list_entry (runp, struct pthread, list);
- curp->pid = self->pid;
- }
-
/* Add the stack of all running threads to the cache. */
list_splice (&stack_used, &stack_cache);
@@ -995,9 +979,9 @@ setxid_signal_thread (struct xid_command *cmdp, struct pthread *t)
return 0;
int val;
+ pid_t pid = getpid ();
INTERNAL_SYSCALL_DECL (err);
- val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
- t->tid, SIGSETXID);
+ val = INTERNAL_SYSCALL (tgkill, err, 3, pid, t->tid, SIGSETXID);
/* If this failed, it must have had not started yet or else exited. */
if (!INTERNAL_SYSCALL_ERROR_P (val, err))
diff --git a/libpthread/nptl/descr.h b/libpthread/nptl/descr.h
index 3fda681b8..06fdbee4b 100644
--- a/libpthread/nptl/descr.h
+++ b/libpthread/nptl/descr.h
@@ -152,9 +152,6 @@ struct pthread
therefore stack) used' flag. */
pid_t tid;
- /* Process ID - thread group ID in kernel speak. */
- pid_t pid;
-
/* List of robust mutexes the thread is holding. */
#ifdef __PTHREAD_MUTEX_HAVE_PREV
void *robust_prev;
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index 0e1c60cda..09220c220 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -64,24 +64,13 @@ static const char nptl_version[] __attribute_used__ = VERSION;
static void
sigcancel_handler (int sig, siginfo_t *si, void *ctx)
{
-#ifdef __ASSUME_CORRECT_SI_PID
- /* Determine the process ID. It might be negative if the thread is
- in the middle of a fork() call. */
- pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
- if (__builtin_expect (pid < 0, 0))
- pid = -pid;
-#endif
/* Safety check. It would be possible to call this function for
other signals and send a signal from another process. This is not
correct and might even be a security problem. Try to catch as
many incorrect invocations as possible. */
if (sig != SIGCANCEL
-#ifdef __ASSUME_CORRECT_SI_PID
- /* Kernels before 2.5.75 stored the thread ID and not the process
- ID in si_pid so we skip this test. */
- || si->si_pid != pid
-#endif
+ || si->si_pid != getpid()
|| si->si_code != SI_TKILL)
return;
@@ -125,24 +114,13 @@ struct xid_command *__xidcmd attribute_hidden;
static void
sighandler_setxid (int sig, siginfo_t *si, void *ctx)
{
-#ifdef __ASSUME_CORRECT_SI_PID
- /* Determine the process ID. It might be negative if the thread is
- in the middle of a fork() call. */
- pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
- if (__builtin_expect (pid < 0, 0))
- pid = -pid;
-#endif
/* Safety check. It would be possible to call this function for
other signals and send a signal from another process. This is not
correct and might even be a security problem. Try to catch as
many incorrect invocations as possible. */
if (sig != SIGSETXID
-#ifdef __ASSUME_CORRECT_SI_PID
- /* Kernels before 2.5.75 stored the thread ID and not the process
- ID in si_pid so we skip this test. */
- || si->si_pid != pid
-#endif
+ || si->si_pid != getpid()
|| si->si_code != SI_TKILL)
return;
@@ -191,7 +169,7 @@ __pthread_initialize_minimal_internal (void)
/* Minimal initialization of the thread descriptor. */
struct pthread *pd = THREAD_SELF;
INTERNAL_SYSCALL_DECL (err);
- pd->pid = pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid);
+ pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid);
THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]);
THREAD_SETMEM (pd, user_stack, true);
if (LLL_LOCK_INITIALIZER != 0)
diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h
index 013b91dd4..4707f6548 100644
--- a/libpthread/nptl/pthreadP.h
+++ b/libpthread/nptl/pthreadP.h
@@ -30,6 +30,8 @@
#include <internaltypes.h>
#include <atomic.h>
#include <bits/kernel-features.h>
+#include <errno.h>
+#include <nptl-signals.h>
/* Atomic operations on TLS memory. */
@@ -310,23 +312,6 @@ __do_cancel (void)
# define LIBC_CANCEL_HANDLED() /* Nothing. */
#endif
-/* The signal used for asynchronous cancellation. */
-#define SIGCANCEL __SIGRTMIN
-
-
-/* Signal needed for the kernel-supported POSIX timer implementation.
- We can reuse the cancellation signal since we can distinguish
- cancellation from timer expirations. */
-#define SIGTIMER SIGCANCEL
-
-
-/* Signal used to implement the setuid et.al. functions. */
-#define SIGSETXID (__SIGRTMIN + 1)
-
-/* Used to communicate with signal handler. */
-extern struct xid_command *__xidcmd attribute_hidden;
-
-
/* Internal prototypes. */
/* Thread list handling. */
diff --git a/libpthread/nptl/pthread_cancel.c b/libpthread/nptl/pthread_cancel.c
index ee9a3202f..d3fd140e8 100644
--- a/libpthread/nptl/pthread_cancel.c
+++ b/libpthread/nptl/pthread_cancel.c
@@ -21,6 +21,7 @@
#include "pthreadP.h"
#include "atomic.h"
#include <sysdep.h>
+#include <unistd.h>
#include <bits/kernel-features.h>
@@ -74,10 +75,9 @@ pthread_cancel (
the thread is executing fork, it would have to happen in
a signal handler. But this is no allowed, pthread_cancel
is not guaranteed to be async-safe. */
+ pid_t pid = getpid ();
int val;
- val = INTERNAL_SYSCALL (tgkill, err, 3,
- THREAD_GETMEM (THREAD_SELF, pid), pd->tid,
- SIGCANCEL);
+ val = INTERNAL_SYSCALL (tgkill, err, 3, pid, pd->tid, SIGCANCEL);
if (INTERNAL_SYSCALL_ERROR_P (val, err))
result = INTERNAL_SYSCALL_ERRNO (val, err);
diff --git a/libpthread/nptl/sysdeps/alpha/tcb-offsets.sym b/libpthread/nptl/sysdeps/alpha/tcb-offsets.sym
index c21a79104..1005621b3 100644
--- a/libpthread/nptl/sysdeps/alpha/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/alpha/tcb-offsets.sym
@@ -10,5 +10,4 @@
#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - sizeof(struct pthread))
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
-PID_OFFSET thread_offsetof (pid)
TID_OFFSET thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/arc/tcb-offsets.sym b/libpthread/nptl/sysdeps/arc/tcb-offsets.sym
index cbf0ae42c..519a62954 100644
--- a/libpthread/nptl/sysdeps/arc/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/arc/tcb-offsets.sym
@@ -2,7 +2,6 @@
#include <tls.h>
PTHREAD_TID offsetof (struct pthread, tid)
-PTHREAD_PID offsetof (struct pthread, pid)
MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads)
TLS_PRE_TCB_SIZE sizeof (struct pthread)
TLS_TCB_SIZE sizeof(tcbhead_t)
diff --git a/libpthread/nptl/sysdeps/arm/tcb-offsets.sym b/libpthread/nptl/sysdeps/arm/tcb-offsets.sym
index 92cc441d3..bf9c0a1c1 100644
--- a/libpthread/nptl/sysdeps/arm/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/arm/tcb-offsets.sym
@@ -7,5 +7,4 @@
#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - sizeof(struct pthread))
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
-PID_OFFSET thread_offsetof (pid)
TID_OFFSET thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/i386/tcb-offsets.sym b/libpthread/nptl/sysdeps/i386/tcb-offsets.sym
index 69f9deb36..990ac7a57 100644
--- a/libpthread/nptl/sysdeps/i386/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/i386/tcb-offsets.sym
@@ -3,7 +3,6 @@
RESULT offsetof (struct pthread, result)
TID offsetof (struct pthread, tid)
-PID offsetof (struct pthread, pid)
CANCELHANDLING offsetof (struct pthread, cancelhandling)
CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf)
MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
diff --git a/libpthread/nptl/sysdeps/metag/tcb-offsets.sym b/libpthread/nptl/sysdeps/metag/tcb-offsets.sym
index 753b72b2d..852b5cc26 100644
--- a/libpthread/nptl/sysdeps/metag/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/metag/tcb-offsets.sym
@@ -3,7 +3,6 @@
RESULT offsetof (struct pthread, result)
TID offsetof (struct pthread, tid)
-PID offsetof (struct pthread, pid)
CANCELHANDLING offsetof (struct pthread, cancelhandling)
CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf)
MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads)
diff --git a/libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym b/libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym
index 18afbee29..614f0dfed 100644
--- a/libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/microblaze/tcb-offsets.sym
@@ -7,5 +7,4 @@
#define thread_offsetof(mem) (long)(offsetof (struct pthread, mem) - sizeof (struct pthread))
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
-PID_OFFSET thread_offsetof (pid)
TID_OFFSET thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/mips/tcb-offsets.sym b/libpthread/nptl/sysdeps/mips/tcb-offsets.sym
index e0e71dc43..9ea25b94a 100644
--- a/libpthread/nptl/sysdeps/mips/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/mips/tcb-offsets.sym
@@ -7,5 +7,4 @@
#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
-PID_OFFSET thread_offsetof (pid)
TID_OFFSET thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/nds32/tcb-offsets.sym b/libpthread/nptl/sysdeps/nds32/tcb-offsets.sym
index 3b9e10186..6701626e1 100644
--- a/libpthread/nptl/sysdeps/nds32/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/nds32/tcb-offsets.sym
@@ -7,6 +7,5 @@
#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
-PID_OFFSET thread_offsetof (pid)
TID_OFFSET thread_offsetof (tid)
diff --git a/libpthread/nptl/sysdeps/nios2/tcb-offsets.sym b/libpthread/nptl/sysdeps/nios2/tcb-offsets.sym
index d9ae95258..3cd8d984a 100644
--- a/libpthread/nptl/sysdeps/nios2/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/nios2/tcb-offsets.sym
@@ -9,6 +9,5 @@
# define thread_offsetof(mem) ((ptrdiff_t) THREAD_SELF + offsetof (struct pthread, mem))
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
-PID_OFFSET thread_offsetof (pid)
TID_OFFSET thread_offsetof (tid)
POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
diff --git a/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym b/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym
index 8ac133dfd..0bd16fb3a 100644
--- a/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/powerpc/tcb-offsets.sym
@@ -12,7 +12,6 @@
#if TLS_MULTIPLE_THREADS_IN_TCB
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
#endif
-PID thread_offsetof (pid)
TID thread_offsetof (tid)
POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
#ifndef __ASSUME_PRIVATE_FUTEX
diff --git a/libpthread/nptl/sysdeps/pthread/createthread.c b/libpthread/nptl/sysdeps/pthread/createthread.c
index ebfee16f9..550bf2cfe 100644
--- a/libpthread/nptl/sysdeps/pthread/createthread.c
+++ b/libpthread/nptl/sysdeps/pthread/createthread.c
@@ -91,6 +91,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
if (__builtin_expect (stopped != 0, 0))
{
INTERNAL_SYSCALL_DECL (err);
+ pid_t pid = getpid ();
int res = 0;
/* Set the affinity mask if necessary. */
@@ -105,9 +106,7 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr,
send it the cancellation signal. */
INTERNAL_SYSCALL_DECL (err2);
err_out:
- (void) INTERNAL_SYSCALL (tgkill, err2, 3,
- THREAD_GETMEM (THREAD_SELF, pid),
- pd->tid, SIGCANCEL);
+ (void) INTERNAL_SYSCALL (tgkill, err2, 3, pid, pd->tid, SIGCANCEL);
return (INTERNAL_SYSCALL_ERROR_P (res, err)
? INTERNAL_SYSCALL_ERRNO (res, err)
diff --git a/libpthread/nptl/sysdeps/sh/tcb-offsets.sym b/libpthread/nptl/sysdeps/sh/tcb-offsets.sym
index 753b72b2d..852b5cc26 100644
--- a/libpthread/nptl/sysdeps/sh/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/sh/tcb-offsets.sym
@@ -3,7 +3,6 @@
RESULT offsetof (struct pthread, result)
TID offsetof (struct pthread, tid)
-PID offsetof (struct pthread, pid)
CANCELHANDLING offsetof (struct pthread, cancelhandling)
CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf)
MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads)
diff --git a/libpthread/nptl/sysdeps/sparc/tcb-offsets.sym b/libpthread/nptl/sysdeps/sparc/tcb-offsets.sym
index 923af8a5b..f75d02065 100644
--- a/libpthread/nptl/sysdeps/sparc/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/sparc/tcb-offsets.sym
@@ -3,5 +3,4 @@
MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
POINTER_GUARD offsetof (tcbhead_t, pointer_guard)
-PID offsetof (struct pthread, pid)
TID offsetof (struct pthread, tid)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
deleted file mode 100644
index eea1cbeed..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/alpha/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/vfork.S
deleted file mode 100644
index 664cac494..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/vfork.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <tcb-offsets.h>
-
-#undef PSEUDO_PREPARE_ARGS
-#define PSEUDO_PREPARE_ARGS \
- /* Load the current cached pid value across the vfork. */ \
- rduniq; \
- ldl a2, PID_OFFSET(v0); \
- mov v0, a1; \
- /* If the cached value is initialized (nonzero), then write \
- back its negation, or INT_MIN, to indicate that the pid \
- value is uninitialized in the the child, and in the window \
- between here and the point at which we restore the value. */ \
- ldah t0, -0x8000; \
- negl a2, t1; \
- cmovne a2, t1, t0; \
- stl t0, PID_OFFSET(v0);
-
-PSEUDO (__vfork, vfork, 0)
-
- /* If we're back in the parent, restore the saved pid. */
- beq v0, 1f
- stl a2, PID_OFFSET(a1)
-1: ret
-
-PSEUDO_END (__vfork)
-libc_hidden_def (__vfork)
-weak_alias (__vfork, vfork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch
index fa5d530d4..64f3a4f7b 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/Makefile.arch
@@ -9,6 +9,3 @@ libpthread_linux_arch_SSRC =
libpthread_linux_arch_CSRC = pthread_once.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/clone.S
deleted file mode 100644
index 5fd1de3c2..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/clone.S
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
- *
- * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
- */
-
-#define RESET_PID
-#include <tls.h>
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/arc/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/arc/vfork.S
deleted file mode 100644
index d29e05a8a..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arc/vfork.S
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
- *
- * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
- */
-
-#define SAVE_PID
-#define RESTORE_PID
-#include <tls.h>
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/arc/vfork.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
index 49d0684ee..55afe20af 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
@@ -9,11 +9,3 @@ libpthread_linux_arch_SSRC =
libpthread_linux_arch_CSRC = pthread_once.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
-
-# We always compile it in arm mode because of SAVE_PID macro
-# This macro should be alternatively implemented in THUMB
-# assembly.
-ASFLAGS-vfork.S = -marm
-CFLAGS-OMIT-vfork.S = -mthumb
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/clone.S
deleted file mode 100644
index 23227eb24..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/clone.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#define RESET_PID
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/arm/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/vfork.S
deleted file mode 100644
index b9e8cf846..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/vfork.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <tcb-offsets.h>
-
-/* Save the PID value. */
-#define SAVE_PID \
- str lr, [sp, #-4]!; /* Save LR. */ \
- mov r0, #0xffff0fff; /* Point to the high page. */ \
- mov lr, pc; /* Save our return address. */ \
- sub pc, r0, #31; /* Jump to the TLS entry. */ \
- ldr lr, [sp], #4; /* Restore LR. */ \
- mov r2, r0; /* Save the TLS addr in r2. */ \
- ldr r3, [r2, #PID_OFFSET]; /* Load the saved PID. */ \
- rsbs r0, r3, #0; /* Negate it. */ \
- moveq r0, #0x80000000; /* Use 0x80000000 if it was 0. */ \
- str r0, [r2, #PID_OFFSET] /* Store the temporary PID. */
-
-/* Restore the old PID value in the parent. */
-#define RESTORE_PID \
- cmp r0, #0; /* If we are the parent... */ \
- strne r3, [r2, #PID_OFFSET] /* ... restore the saved PID. */
-
-#include "../../../../../../../libc/sysdeps/linux/arm/vfork.S"
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);
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)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
index be07d9c85..ee38a6988 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/Makefile.arch
@@ -5,11 +5,9 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_linux_arch_SSRC = clone.S pthread_spin_unlock.S pthread_once.S
+libpthread_linux_arch_SSRC = pthread_spin_unlock.S pthread_once.S
libpthread_linux_arch_CSRC = pthread_spin_init.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/clone.S
deleted file mode 100644
index 9c7c46467..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <libc/sysdeps/linux/i386/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
deleted file mode 100644
index 074f0f046..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1999,2002,2004,2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <tcb-offsets.h>
-
-/* Save the PID value. */
-#define SAVE_PID \
- movl %gs:PID, %edx; \
- movl %edx, %eax; \
- negl %eax; \
- jne 1f; \
- movl $0x80000000, %eax; \
-1: movl %eax, %gs:PID
-
-/* Restore the old PID value in the parent. */
-#define RESTORE_PID \
- testl %eax, %eax; \
- je 1f; \
- movl %edx, %gs:PID; \
-1:
-
-
-#include <libc/sysdeps/linux/i386/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch
index 0f4d8d327..4c85f0abc 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/Makefile.arch
@@ -9,8 +9,5 @@ libpthread_linux_arch_SSRC =
libpthread_linux_arch_CSRC = pthread_once.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
CFLAGS += $(SSP_ALL_CFLAGS)
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/clone.S
deleted file mode 100644
index f5c5c7c5d..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/clone.S
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * Copyright (C) 2013 Imagination Technologies Ltd.
- *
- * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
- */
-
-#define RESET_PID
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/metag/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/metag/vfork.S
deleted file mode 100644
index 7b369b1b4..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/metag/vfork.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; see the file COPYING.LIB. If
- not, see <http://www.gnu.org/licenses/>.  */
-
-#include <tcb-offsets.h>
-#include <asm/unistd.h>
-
-#ifdef __PIC__
-#define __VFORK_METAG_LOAD_TP ___metag_load_tp@PLT
-#else
-#define __VFORK_METAG_LOAD_TP ___metag_load_tp
-#endif
-
-/* Save the PID value. */
-#define SAVE_PID \
- SETL [A0StP++], D0FrT, D1RtP; \
- CALLR D1RtP, __VFORK_METAG_LOAD_TP; \
- SUB D0Re0, D0Re0, #TLS_PRE_TCB_SIZE; \
- GETD D0FrT, [D0Re0 + #PID]; \
- NEGS D0FrT, D0FrT; \
- BNZ 1f; \
- MOVT D0FrT, #0x8000; \
-1: SETD [D0Re0 + #PID], D0FrT; \
- GETL D0FrT, D1RtP, [--A0StP];
-
-#define RESTORE_PID \
- CMP D0Re0, #0; \
- BEQ 1f; \
- MSETL [A0StP++], D0Re0, D0FrT; \
- CALLR D1RtP, __VFORK_METAG_LOAD_TP; \
- SUB D0Re0, D0Re0, #TLS_PRE_TCB_SIZE; \
- GETD D0FrT, [D0Re0 + #PID]; \
- NEG D0FrT, D0FrT; \
- MOVT D1Re0, #0x8000; \
- CMP D0FrT, D1Re0; \
- XOREQ D0FrT, D0FrT, D0FrT; \
- SETD [D0Re0 + #PID], D0FrT; \
- GETL D0FrT, D1RtP, [--A0StP]; \
- GETL D0Re0, D1Re0, [--A0StP]; \
-1:
-
-#include <../../../../../../../libc/sysdeps/linux/metag/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch
index 77707a085..44a005306 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/Makefile.arch
@@ -5,4 +5,3 @@ libpthread_linux_arch_SSRC =
libpthread_linux_arch_CSRC = pthread_once.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/clone.S
deleted file mode 100644
index faa78d936..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/clone.S
+++ /dev/null
@@ -1,4 +0,0 @@
-#define RESET_PID
-#include <tls.h>
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/microblaze/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/vfork.S
deleted file mode 100644
index 433671717..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/microblaze/vfork.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#define SAVE_PID
-#define RESTORE_PID
-#include <tls.h>
-#include <tcb-offsets.h>
-#include <libc/sysdeps/linux/microblaze/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
index 565efd4a3..402c5ffaf 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
@@ -5,13 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_linux_arch_SSRC = clone.S
libpthread_linux_arch_CSRC = pthread_once.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-ifneq ($(CONFIG_MIPS_O32_ABI),y)
-libc_linux_arch_SSRC-OMIT = waitpid.S
-endif
-ASFLAGS += -DUSE___THREAD
+ASFLAGS += -DUSE___THREAD
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/clone.S
deleted file mode 100644
index 858877f07..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <libc/sysdeps/linux/mips/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S
deleted file mode 100644
index add405523..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <../../../../../../../libc/sysdeps/linux/mips/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/vfork.S
deleted file mode 100644
index a23d99cfa..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/vfork.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <features.h>
-#include <tls.h>
-
-/* Save the PID value. */
-#define SAVE_PID \
- READ_THREAD_POINTER(v1); /* Get the thread pointer. */ \
- lw a2, PID_OFFSET(v1); /* Load the saved PID. */ \
- subu a2, $0, a2; /* Negate it. */ \
- bnez a2, 1f; /* If it was zero... */ \
- lui a2, 0x8000; /* use 0x80000000 instead. */ \
-1: sw a2, PID_OFFSET(v1); /* Store the temporary PID. */
-
-/* Restore the old PID value in the parent. */
-#define RESTORE_PID \
- beqz v0, 1f; /* If we are the parent... */ \
- READ_THREAD_POINTER(v1); /* Get the thread pointer. */ \
- lw a2, PID_OFFSET(v1); /* Load the saved PID. */ \
- subu a2, $0, a2; /* Re-negate it. */ \
- lui a0, 0x8000; /* Load 0x80000000... */ \
- bne a2, a0, 2f; /* ... compare against it... */ \
- li a2, 0; /* ... use 0 instead. */ \
-2: sw a2, PID_OFFSET(v1); /* Restore the PID. */ \
-1:
-
-#include <../../../../../../../libc/sysdeps/linux/mips/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch
index 3b8935ce5..94aa25ffb 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/Makefile.arch
@@ -5,8 +5,5 @@ libpthread_linux_arch_SSRC =
libpthread_linux_arch_CSRC = pthread_once.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
CFLAGS += $(SSP_ALL_CFLAGS)
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/clone.S
deleted file mode 100644
index 94b39fcf9..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/clone.S
+++ /dev/null
@@ -1,4 +0,0 @@
-/* We want an #include_next, but we are the main source file.
- So, #include ourselves and in that incarnation we can use #include_next. */
-# define RESET_PID
-# include <libc/sysdeps/linux/nds32/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/vfork.S
deleted file mode 100644
index f11f76ae1..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nds32/vfork.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016-2017 Andes Technology, Inc.
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-/* Copyright (C) 2013 Free Software Foundation, Inc.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <tls.h>
-
-/* Save the PID value. */
-#define SAVE_PID \
- lwi $r1, [$r25 + PID_OFFSET];/* Get the thread pointer. */ \
- subri $r1, $r1, 0x0; /* Negate it. */ \
- bnez $r1, 1f; /* If it was zero... */ \
- sethi $r1, 0x80000; /* use 0x80000000 instead. */ \
-1: swi $r1, [$r25 + PID_OFFSET];/* Store the temporary PID. */
-
-/* Restore the old PID value in the parent. */
-#define RESTORE_PID \
- beqz $r0, 1f; /* If we are the parent... */ \
- lwi $r1, [$r25 + PID_OFFSET];/* Get the thread pointer. */ \
- subri $r1, $r1, 0x0; /* Re-negate it. */ \
- sethi $r2, 0x80000; /* Load 0x80000000... */ \
- bne $r1, $r2, 2f; /* ... compare against it... */ \
- movi $r1, 0; /* ... use 0 instead. */ \
-2: swi $r1, [$r25 + PID_OFFSET];/* Restore the PID. */ \
-1:
-
-#include <../../../../../../../libc/sysdeps/linux/nds32/vfork.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch
index 26f51fb67..1295c34af 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/Makefile.arch
@@ -5,5 +5,3 @@ libpthread_linux_arch_SSRC =
libpthread_linux_arch_CSRC = pthread_once.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/clone.S
deleted file mode 100644
index 544974f9f..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/clone.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#define RESET_PID
-#include <tcb-offsets.h>
-#include "../../../../../../../libc/sysdeps/linux/nios2/clone.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/vfork.S
deleted file mode 100644
index 6ee414c20..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/nios2/vfork.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <tcb-offsets.h>
-
-/* Save the PID value. */
-#define SAVE_PID \
- str lr, [sp, #-4]!; /* Save LR. */ \
- mov r0, #0xffff0fff; /* Point to the high page. */ \
- mov lr, pc; /* Save our return address. */ \
- sub pc, r0, #31; /* Jump to the TLS entry. */ \
- ldr lr, [sp], #4; /* Restore LR. */ \
- mov r2, r0; /* Save the TLS addr in r2. */ \
- ldr r3, [r2, #PID_OFFSET]; /* Load the saved PID. */ \
- rsbs r0, r3, #0; /* Negate it. */ \
- moveq r0, #0x80000000; /* Use 0x80000000 if it was 0. */ \
- str r0, [r2, #PID_OFFSET] /* Store the temporary PID. */
-
-/* Restore the old PID value in the parent. */
-#define RESTORE_PID \
- cmp r0, #0; /* If we are the parent... */ \
- strne r3, [r2, #PID_OFFSET] /* ... restore the saved PID. */
-
-#include "../../../../../../../libc/sysdeps/linux/nios2/vfork.S"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/nptl-signals.h b/libpthread/nptl/sysdeps/unix/sysv/linux/nptl-signals.h
new file mode 100644
index 000000000..43aa1a939
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/nptl-signals.h
@@ -0,0 +1,84 @@
+/* Special use of signals in NPTL internals. Linux version.
+ Copyright (C) 2014-2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <signal.h>
+
+/* The signal used for asynchronous cancelation. */
+#define SIGCANCEL __SIGRTMIN
+
+
+/* Signal needed for the kernel-supported POSIX timer implementation.
+ We can reuse the cancellation signal since we can distinguish
+ cancellation from timer expirations. */
+#define SIGTIMER SIGCANCEL
+
+
+/* Signal used to implement the setuid et.al. functions. */
+#define SIGSETXID (__SIGRTMIN + 1)
+
+
+/* Return is sig is used internally. */
+static inline int
+__nptl_is_internal_signal (int sig)
+{
+ return (sig == SIGCANCEL) || (sig == SIGTIMER) || (sig == SIGSETXID);
+}
+
+/* Remove internal glibc signal from the mask. */
+static inline void
+__nptl_clear_internal_signals (sigset_t *set)
+{
+ __sigdelset (set, SIGCANCEL);
+ __sigdelset (set, SIGTIMER);
+ __sigdelset (set, SIGSETXID);
+}
+
+#define SIGALL_SET \
+ ((__sigset_t) { .__val = {[0 ... _SIGSET_NWORDS-1 ] = -1 } })
+
+/* Block all signals, including internal glibc ones. */
+static inline int
+__libc_signal_block_all (sigset_t *set)
+{
+ INTERNAL_SYSCALL_DECL (err);
+ return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &SIGALL_SET,
+ set, _NSIG / 8);
+}
+
+/* Block all application signals (excluding internal glibc ones). */
+static inline int
+__libc_signal_block_app (sigset_t *set)
+{
+ sigset_t allset = SIGALL_SET;
+ __nptl_clear_internal_signals (&allset);
+ INTERNAL_SYSCALL_DECL (err);
+ return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &allset, set,
+ _NSIG / 8);
+}
+
+/* Restore current process signal mask. */
+static inline int
+__libc_signal_restore_set (const sigset_t *set)
+{
+ INTERNAL_SYSCALL_DECL (err);
+ return INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, set, NULL,
+ _NSIG / 8);
+}
+
+/* Used to communicate with signal handler. */
+extern struct xid_command *__xidcmd attribute_hidden;
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
index 2abb1d22a..689e029df 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/Makefile.arch
@@ -9,7 +9,5 @@ libpthread_linux_arch_SSRC =
libpthread_linux_arch_CSRC = pthread_once.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.S
deleted file mode 100644
index 675a997e9..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.S
+++ /dev/null
@@ -1,9 +0,0 @@
-/* We want an #include_next, but we are the main source file.
- So, #include ourselves and in that incarnation we can use #include_next. */
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <clone.S>
-#else
-# define RESET_PID
-# include_next <clone.S>
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S
deleted file mode 100644
index 28c59fd2e..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/vfork.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#define _ERRNO_H 1
-#include <bits/errno.h>
-#include <bits/kernel-features.h>
-#include <tcb-offsets.h>
-
-/* Clone the calling process, but without copying the whole address space.
- The calling process is suspended until the new process exits or is
- replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
- and the process ID of the new process to the old process. */
-
-ENTRY (__vfork)
- lwz 0,PID(2)
- cmpwi 0,0,0
- neg 0,0
- bne- 0,1f
- lis 0,0x8000
-1: stw 0,PID(2)
-
- DO_CALL (SYS_ify (vfork))
-
- cmpwi 1,3,0
- beqlr- 1
-
- lwz 0,PID(2)
- /* Cannot use clrlwi. here, because cr0 needs to be preserved
- until PSEUDO_RET. */
- clrlwi 4,0,1
- cmpwi 1,4,0
- beq- 1,1f
- neg 4,0
-1: stw 4,PID(2)
-
- PSEUDO_RET
-
-PSEUDO_END (__vfork)
-libc_hidden_def (__vfork)
-weak_alias (__vfork, vfork)
-libc_hidden_weak(vfork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
index e27ab5104..1cce9bfc9 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -57,9 +57,10 @@ __pthread_kill (
function would have to be called while the thread is executing
fork, it would have to happen in a signal handler. But this is
no allowed, pthread_kill is not guaranteed to be async-safe. */
+
+ pid_t pid = getpid ();
int val;
- val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
- tid, signo);
+ val = INTERNAL_SYSCALL (tgkill, err, 3, pid, tid, signo);
return (INTERNAL_SYSCALL_ERROR_P (val, err)
? INTERNAL_SYSCALL_ERRNO (val, err) : 0);
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
index 2b7fa1471..0bd3b7983 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_sigqueue.c
@@ -53,26 +53,22 @@ pthread_sigqueue (
if (signo == SIGCANCEL || signo == SIGTIMER || signo == SIGSETXID)
return EINVAL;
+ pid_t pid = getpid ();
+
/* Set up the siginfo_t structure. */
siginfo_t info;
memset (&info, '\0', sizeof (siginfo_t));
info.si_signo = signo;
info.si_code = SI_QUEUE;
- info.si_pid = THREAD_GETMEM (THREAD_SELF, pid);
+ info.si_pid = pid;
info.si_uid = getuid ();
info.si_value = value;
/* We have a special syscall to do the work. */
INTERNAL_SYSCALL_DECL (err);
- /* One comment: The PID field in the TCB can temporarily be changed
- (in fork). But this must not affect this code here. Since this
- function would have to be called while the thread is executing
- fork, it would have to happen in a signal handler. But this is
- no allowed, pthread_sigqueue is not guaranteed to be async-safe. */
int val = INTERNAL_SYSCALL (rt_tgsigqueueinfo, err, 4,
- THREAD_GETMEM (THREAD_SELF, pid),
- tid, signo, &info);
+ pid, tid, signo, &info);
return (INTERNAL_SYSCALL_ERROR_P (val, err)
? INTERNAL_SYSCALL_ERRNO (val, err) : 0);
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
index 6b159384f..f74cd0be3 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
@@ -20,37 +20,32 @@
#include <limits.h>
#include <signal.h>
#include <sysdep.h>
-#include <pthreadP.h>
-
+#include <nptl-signals.h>
int
raise (int sig)
{
- struct pthread *pd = THREAD_SELF;
- pid_t pid = THREAD_GETMEM (pd, pid);
- pid_t selftid = THREAD_GETMEM (pd, tid);
- if (selftid == 0)
- {
- /* This system call is not supposed to fail. */
-#ifdef INTERNAL_SYSCALL
- INTERNAL_SYSCALL_DECL (err);
- selftid = INTERNAL_SYSCALL (gettid, err, 0);
-#else
- selftid = INLINE_SYSCALL (gettid, 0);
-#endif
- THREAD_SETMEM (pd, tid, selftid);
-
- /* 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. */
- pid = selftid;
- }
- else
- /* raise is an async-safe function. It could be called while the
- fork/vfork function temporarily invalidated the PID field. Adjust for
- that. */
- if (__builtin_expect (pid <= 0, 0))
- pid = (pid & INT_MAX) == 0 ? selftid : -pid;
-
- return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
+ /* rt_sigprocmask may fail if:
+
+ 1. sigsetsize != sizeof (sigset_t) (EINVAL)
+ 2. a failure in copy from/to user space (EFAULT)
+ 3. an invalid 'how' operation (EINVAL)
+
+ The first case is already handle in glibc syscall call by using the arch
+ defined _NSIG. Second case is handled by using a stack allocated mask.
+ The last one should be handled by the block/unblock functions. */
+
+ sigset_t set;
+ __libc_signal_block_app (&set);
+
+ INTERNAL_SYSCALL_DECL (err);
+ pid_t pid = INTERNAL_SYSCALL (getpid, err, 0);
+ pid_t tid = INTERNAL_SYSCALL (gettid, err, 0);
+
+ int ret = INLINE_SYSCALL (tgkill, 3, pid, tid, sig);
+
+ __libc_signal_restore_set (&set);
+
+ return ret;
}
libc_hidden_def (raise)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
index c07498f94..e3b2f7c4e 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/Makefile.arch
@@ -13,7 +13,5 @@ libpthread_linux_arch_SSRC = pthread_once.S pthread_rwlock_wrlock.S \
sem_post.S sem_timedwait.S sem_trywait.S sem_wait.S
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S
deleted file mode 100644
index 918d57926..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <libc/sysdeps/linux/sh/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S
deleted file mode 100644
index 5ea1bc120..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/vfork.S
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#define _ERRNO_H 1
-#include <bits/errno.h>
-#include <tcb-offsets.h>
-
-/* Clone the calling process, but without copying the whole address space.
- The calling process is suspended until the new process exits or is
- replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
- and the process ID of the new process to the old process. */
-
-ENTRY (__vfork)
- /* Save the PID value. */
- stc gbr, r2
- mov.w .L2, r0
- mov.l @(r0,r2), r4
- neg r4, r1
- tst r1, r1
- bf 1f
- mov #1, r1
- rotr r1
-1:
- mov.l r1, @(r0,r2)
-
- mov.w .L1, r3
- trapa #0x10
- mov r0, r1
-
- /* Restore the old PID value in the parent. */
- tst r0, r0
- bt.s 2f
- stc gbr, r2
- mov.w .L2, r0
- mov.l r4, @(r0,r2)
- mov r1, r0
-2:
- mov #-12, r2
- shad r2, r1
- not r1, r1 // r1=0 means r0 = -1 to -4095
- tst r1, r1 // i.e. error in linux
- bf .Lpseudo_end
- SYSCALL_ERROR_HANDLER
-.Lpseudo_end:
- rts
- nop
-.L1:
- .word __NR_vfork
-.L2:
- .word PID - TLS_PRE_TCB_SIZE
- .align 2
-PSEUDO_END (__vfork)
-hidden_def (vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
index f93ad4d8d..5253f1c2f 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/Makefile.arch
@@ -5,12 +5,9 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_linux_arch_SSRC = clone.S
libpthread_linux_arch_CSRC = pthread_once.c lowlevellock.c \
pthread_barrier_init.c pthread_barrier_wait.c pthread_barrier_destroy.c
libc_linux_arch_CSRC = fork.c libc-lowlevellock.c
-libc_linux_arch_SSRC = clone.S vfork.S
ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S
deleted file mode 100644
index a6142aafe..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/clone.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define RESET_PID
-#include <libc/sysdeps/linux/sparc/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S
deleted file mode 100644
index 71f0662a2..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sparc/vfork.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <tcb-offsets.h>
-
- .text
- .globl __syscall_error
-ENTRY(__vfork)
- ld [%g7 + PID], %o5
- cmp %o5, 0
- bne 1f
- sub %g0, %o5, %o4
- sethi %hi(0x80000000), %o4
-1: st %o4, [%g7 + PID]
-
- LOADSYSCALL(vfork)
- ta 0x10
- bcc 2f
- mov %o7, %g1
- st %o5, [%g7 + PID]
- call __syscall_error
- mov %g1, %o7
-2: sub %o1, 1, %o1
- andcc %o0, %o1, %o0
- bne,a 1f
- st %o5, [%g7 + PID]
-1: retl
- nop
-END(__vfork)
-
-libc_hidden_def (vfork)
-weak_alias (__vfork, vfork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
index b48f4cb0b..f3883dbe0 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/Makefile.arch
@@ -5,7 +5,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_linux_arch_SSRC = clone.S pthread_once.S \
+libpthread_linux_arch_SSRC = pthread_once.S \
lowlevellock.S pthread_barrier_wait.S pthread_cond_signal.S pthread_cond_broadcast.S \
sem_post.S sem_timedwait.S lowlevelrobustlock.S \
sem_trywait.S sem_wait.S pthread_rwlock_rdlock.S pthread_rwlock_wrlock.S \
@@ -14,9 +14,7 @@ libpthread_linux_arch_SSRC = clone.S pthread_once.S \
libpthread_linux_arch_CSRC = pthread_spin_init.c
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S libc-cancellation.S libc-lowlevellock.S
-libc_linux_arch_SSRC-OMIT = waitpid.S
+libc_linux_arch_SSRC = libc-cancellation.S libc-lowlevellock.S
librt_linux_arch_SSRC = librt-cancellation.S
ASFLAGS += -DUSE___THREAD
-
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
deleted file mode 100644
index efbaee3d1..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <tcb-offsets.h>
-#define RESET_PID
-#include <libc/sysdeps/linux/x86_64/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
deleted file mode 100644
index f3280b8cc..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-/* We want an #include_next, but we are the main source file.
- So, #include ourselves and in that incarnation we can use #include_next. */
-#ifndef INCLUDED_SELF
-# define INCLUDED_SELF
-# include <vfork.S>
-#else
-
-# include <tcb-offsets.h>
-
-# define SAVE_PID \
- movl %fs:PID, %esi; \
- movl $0x80000000, %ecx; \
- movl %esi, %edx; \
- negl %edx; \
- cmove %ecx, %edx; \
- movl %edx, %fs:PID
-
-# define RESTORE_PID \
- testq %rax, %rax; \
- je 1f; \
- movl %esi, %fs:PID; \
-1:
-
-# include_next <vfork.S>
-#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch
index 7014c3f04..6f1734871 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/Makefile.arch
@@ -2,13 +2,10 @@
# Licensed under the LGPL v2.1, see the file COPYING and LICENSE.
libc_linux_arch_CSRC = fork.c
-libc_linux_arch_SSRC = clone.S vfork.S
libpthread_linux_arch_CSRC = pthread_once.c
libpthread_linux_arch_SSRC =
CFLAGS-OMIT-fork.c = -DNOT_IN_libc -DIS_IN_libpthread
-ASFLAGS-clone.S = -D_LIBC_REENTRANT
-ASFLAGS-vfork.S = -D_LIBC_REENTRANT
ASFLAGS-syscall.S = -D_LIBC_REENTRANT
ASFLAGS-mmap.S = -D_LIBC_REENTRANT
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/clone.S b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/clone.S
deleted file mode 100644
index 539b9ef38..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/clone.S
+++ /dev/null
@@ -1,3 +0,0 @@
-#define RESET_PID
-#include <tcb-offsets.h>
-#include <libc/sysdeps/linux/xtensa/clone.S>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S
deleted file mode 100644
index 46eb76dd6..000000000
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/xtensa/vfork.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <tls.h>
-
-/*
- Save the PID value, save 0x80000000 if PID was 0.
- Registers a2 and a3 are available; ar should return the PID and as threadptr
- */
-
-#define SAVE_PID(pid,tp,ar,as) \
- rur tp, threadptr; \
- movi ar, TLS_PRE_TCB_SIZE; \
- sub tp, tp, ar; \
- l32i pid, tp, PID; \
- neg ar, pid; \
- movi as, 0x80000000; \
- moveqz ar, as, ar; \
- s32i ar, tp, PID; \
-
-/*
- Restore the PID value, restore to 0 if saved value was 0x80000000
- Return value from the syscall is in a2.
- */
-#define RESTORE_PID(pid,tp,res) \
- beqz res, 1f; \
- s32i pid, tp, PID; \
-1:
-
-/*
- Special version for call12, where we don't have enough registers
- available to preserve the original PID.
- */
-#define RESTORE_PID12(ar, as, at) \
- rur as, threadptr; \
- movi ar, TLS_PRE_TCB_SIZE; \
- sub as, as, ar; \
- l32i ar, as, PID; \
- movi at, 0x80000000; \
- sub at, at, ar; \
- neg ar, ar; \
- moveqz ar, at, at; \
- s32i ar, as, PID;
-
-#include <libc/sysdeps/linux/xtensa/vfork.S>
diff --git a/libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym b/libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym
index cf863752e..d908521be 100644
--- a/libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/x86_64/tcb-offsets.sym
@@ -3,7 +3,6 @@
RESULT offsetof (struct pthread, result)
TID offsetof (struct pthread, tid)
-PID offsetof (struct pthread, pid)
CANCELHANDLING offsetof (struct pthread, cancelhandling)
CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf)
CLEANUP offsetof (struct pthread, cleanup)
diff --git a/libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym b/libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym
index 4c8687647..54eae20b1 100644
--- a/libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym
+++ b/libpthread/nptl/sysdeps/xtensa/tcb-offsets.sym
@@ -3,5 +3,4 @@
TLS_PRE_TCB_SIZE sizeof (struct pthread)
MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads)
-PID offsetof (struct pthread, pid)
TID offsetof (struct pthread, tid)