This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch roland/nptl created. glibc-2.19-393-g0967a30


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, roland/nptl has been created
        at  0967a301512d5a22cf5594b998ea13d773556e18 (commit)

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0967a301512d5a22cf5594b998ea13d773556e18

commit 0967a301512d5a22cf5594b998ea13d773556e18
Author: Roland McGrath <roland@hack.frob.com>
Date:   Tue May 13 14:50:27 2014 -0700

    x86: Consolidate NPTL/non versions of vfork

diff --git a/ChangeLog b/ChangeLog
index 99a7139..983d788 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2014-05-13  Roland McGrath  <roland@hack.frob.com>
 
+	* sysdeps/unix/sysv/linux/i386/vfork.S: Include <tcb-offsets.h>.
+	(__vfork): Incorporate save/restore of PID from nptl/vfork.S here.
+	(__libc_vfork): New strong alias.
+	* nptl/sysdeps/unix/sysv/linux/i386/vfork.S: File removed.
+	* nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S: File removed.
+
+	* sysdeps/unix/sysv/linux/x86_64/vfork.S: Include <tcb-offsets.h>.
+	(__vfork): Incorporate save/restore of PID from nptl/vfork.S here.
+	(__libc_vfork): New strong alias.
+	* nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S: File removed.
+	* nptl/sysdeps/unix/sysv/linux/x86_64/pt-vfork.S: File removed.
+
 	* sysdeps/unix/sysv/linux/arm/vfork.S: Include <tcb-offsets.h>.
 	(__vfork): Incorporate save/restore of PID from nptl/vfork.S here.
 	(__libc_vfork): New strong alias.
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S b/nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S
deleted file mode 100644
index 0a3d63e..0000000
--- a/nptl/sysdeps/unix/sysv/linux/i386/pt-vfork.S
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 1999-2014 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   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 <kernel-features.h>
-#include <tcb-offsets.h>
-
-/* Save the PID value.  */
-#define SAVE_PID \
-	movl	%gs:PID, %edx; 						      \
-	movl	%edx, %eax;						      \
-	negl	%eax;							      \
-	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:
-
-/* 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)
-	/* Pop the return PC value into ECX.  */
-	popl	%ecx
-
-	SAVE_PID
-
-	/* Stuff the syscall number in EAX and enter into the kernel.  */
-	movl	$SYS_ify (vfork), %eax
-	int	$0x80
-
-	RESTORE_PID
-
-	/* Jump to the return PC.  Don't jump directly since this
-	   disturbs the branch target cache.  Instead push the return
-	   address back on the stack.  */
-	pushl	%ecx
-
-	cmpl	$-4095, %eax
-	jae	SYSCALL_ERROR_LABEL	/* Branch forward if it failed.  */
-	ret
-PSEUDO_END (__vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/vfork.S b/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
deleted file mode 100644
index 5e0e5e0..0000000
--- a/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1999-2014 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>
-
-/* 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_next <vfork.S>
-#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pt-vfork.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pt-vfork.S
deleted file mode 100644
index 77144ef..0000000
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pt-vfork.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2004-2014 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>
-
-#define SAVE_PID \
-	movl	%fs:PID, %esi;						      \
-	movl	%esi, %edx;						      \
-	negl	%edx;							      \
-	movl	%edx, %fs:PID
-
-#define RESTORE_PID \
-	testq	%rax, %rax;						      \
-	je	1f;							      \
-	movl	%esi, %fs:PID;						      \
-1:
-
-#include <../../../../../../sysdeps/unix/sysv/linux/x86_64/vfork.S>
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S b/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
deleted file mode 100644
index c6058af..0000000
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 2004-2014 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/sysdeps/unix/sysv/linux/i386/vfork.S b/sysdeps/unix/sysv/linux/i386/vfork.S
index d6e0ecf..2c3d4a3 100644
--- a/sysdeps/unix/sysv/linux/i386/vfork.S
+++ b/sysdeps/unix/sysv/linux/i386/vfork.S
@@ -20,6 +20,8 @@
 #define _ERRNO_H	1
 #include <bits/errno.h>
 #include <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
@@ -33,9 +35,16 @@ ENTRY (__vfork)
 	cfi_adjust_cfa_offset (-4)
 	cfi_register (%eip, %ecx)
 
-#ifdef SAVE_PID
-	SAVE_PID
-#endif
+	/* Save the TCB-cached PID away in %edx, and then negate the TCB
+           field.  But if it's zero, set it to 0x80000000 instead.  See
+           raise.c for the logic that relies on this value.  */
+	movl	%gs:PID, %edx
+	movl	%edx, %eax
+	negl	%eax
+	jne	1f
+	movl	$0x80000000, %eax
+1:	movl	%eax, %gs:PID
+
 
 	/* Stuff the syscall number in EAX and enter into the kernel.  */
 	movl	$SYS_ify (vfork), %eax
@@ -47,9 +56,13 @@ ENTRY (__vfork)
 	pushl	%ecx
 	cfi_adjust_cfa_offset (4)
 
-#ifdef RESTORE_PID
-	RESTORE_PID
-#endif
+	/* Restore the original value of the TCB cache of the PID, if we're
+	   the parent.  But in the child (syscall return value equals zero),
+	   leave things as they are.  */
+	testl	%eax, %eax
+	je	1f
+	movl	%edx, %gs:PID
+1:
 
 	cmpl	$-4095, %eax
 	/* Branch forward if it failed.  */
@@ -61,3 +74,4 @@ PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 
 weak_alias (__vfork, vfork)
+strong_alias (__vfork, __libc_vfork)
diff --git a/sysdeps/unix/sysv/linux/x86_64/vfork.S b/sysdeps/unix/sysv/linux/x86_64/vfork.S
index d3b450a..15ea281 100644
--- a/sysdeps/unix/sysv/linux/x86_64/vfork.S
+++ b/sysdeps/unix/sysv/linux/x86_64/vfork.S
@@ -18,6 +18,8 @@
 #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
@@ -32,9 +34,15 @@ ENTRY (__vfork)
 	cfi_adjust_cfa_offset(-8)
 	cfi_register(%rip, %rdi)
 
-#ifdef SAVE_PID
-	SAVE_PID
-#endif
+	/* Save the TCB-cached PID away in %esi, and then negate the TCB
+           field.  But if it's zero, set it to 0x80000000 instead.  See
+           raise.c for the logic that relies on this value.  */
+	movl	%fs:PID, %esi
+	movl	$0x80000000, %ecx
+	movl	%esi, %edx
+	negl	%edx
+	cmove	%ecx, %edx
+	movl	%edx, %fs:PID
 
 	/* Stuff the syscall number in RAX and enter into the kernel.  */
 	movl	$SYS_ify (vfork), %eax
@@ -44,9 +52,13 @@ ENTRY (__vfork)
 	pushq	%rdi
 	cfi_adjust_cfa_offset(8)
 
-#ifdef RESTORE_PID
-	RESTORE_PID
-#endif
+	/* Restore the original value of the TCB cache of the PID, if we're
+	   the parent.  But in the child (syscall return value equals zero),
+	   leave things as they are.  */
+	testq	%rax, %rax
+	je	1f
+	movl	%esi, %fs:PID
+1:
 
 	cmpl	$-4095, %eax
 	jae SYSCALL_ERROR_LABEL		/* Branch forward if it failed.  */
@@ -58,3 +70,4 @@ PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 
 weak_alias (__vfork, vfork)
+strong_alias (__vfork, __libc_vfork)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=108fc5cfa8ed853cee6b9582686bd036d0324273

commit 108fc5cfa8ed853cee6b9582686bd036d0324273
Author: Roland McGrath <roland@hack.frob.com>
Date:   Tue May 13 14:23:35 2014 -0700

    ARM: Consolidate NPTL/non versions of vfork

diff --git a/ChangeLog b/ChangeLog
index d09f2f4..99a7139 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2014-05-13  Roland McGrath  <roland@hack.frob.com>
 
+	* sysdeps/unix/sysv/linux/arm/vfork.S: Include <tcb-offsets.h>.
+	(__vfork): Incorporate save/restore of PID from nptl/vfork.S here.
+	(__libc_vfork): New strong alias.
+	* sysdeps/unix/sysv/linux/arm/nptl/vfork.S: File removed.
+	* sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S: File removed.
+	* nptl/pt-vfork.c: New file.
+	* nptl/Versions (libc: GLIBC_PRIVATE): Add __libc_vfork.
+	(libpthread: GLIBC_2.20): New version set (empty).
+
 	* sysdeps/unix/sysv/linux/arm/nptl/bits/pthreadtypes.h: Moved ...
 	* sysdeps/arm/nptl/bits/pthreadtypes.h: ... here.
 	* sysdeps/unix/sysv/linux/arm/nptl/bits/semaphore.h: Moved ...
diff --git a/nptl/Versions b/nptl/Versions
index bb11277..17a68ed 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -30,6 +30,7 @@ libc {
     __libc_alloca_cutoff;
     # Internal libc interface to libpthread
     __libc_dl_error_tsd;
+    __libc_vfork;
   }
 }
 
@@ -257,6 +258,9 @@ libpthread {
     pthread_setattr_default_np;
   }
 
+  GLIBC_2.20 {
+  }
+
   GLIBC_PRIVATE {
     __pthread_initialize_minimal;
     __pthread_clock_gettime; __pthread_clock_settime;
diff --git a/nptl/pt-vfork.c b/nptl/pt-vfork.c
new file mode 100644
index 0000000..6994f0f
--- /dev/null
+++ b/nptl/pt-vfork.c
@@ -0,0 +1,63 @@
+/* vfork ABI-compatibility entry points for libpthread.
+   Copyright (C) 2014 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 <unistd.h>
+#include <shlib-compat.h>
+
+/* libpthread used to have its own vfork implementation that differed
+   from libc's only in having a pointless micro-optimization.  There
+   is no longer any use to having a separate copy in libpthread, but
+   the historical ABI requires it.  For static linking, there is no
+   need to provide anything here--the libc version will be linked in.
+   For shared library ABI compatibility, there must be __vfork and
+   vfork symbols in libpthread.so; so we define them using IFUNC to
+   redirect to the libc function.  */
+
+#if (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) \
+     || SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20))
+
+extern __typeof (vfork) __libc_vfork;   /* Defined in libc.  */
+
+attribute_hidden __attribute__ ((used))
+__typeof (vfork) *
+vfork_ifunc (void)
+{
+  return &__libc_vfork;
+}
+
+#endif
+
+#ifdef HAVE_ASM_SET_DIRECTIVE
+# define DEFINE_VFORK(name) \
+  asm (".set " #name ", vfork_ifunc\n" \
+       ".globl " #name "\n" \
+       ".type " #name ", %gnu_indirect_function")
+#else
+# define DEFINE_VFORK(name) \
+  asm (#name " = vfork_ifunc\n" \
+       ".globl " #name "\n" \
+       ".type " #name ", %gnu_indirect_function")
+#endif
+
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20)
+DEFINE_VFORK (vfork);
+#endif
+
+#if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)
+DEFINE_VFORK (__vfork);
+#endif
diff --git a/sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S b/sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S
deleted file mode 100644
index 7eff08e..0000000
--- a/sysdeps/unix/sysv/linux/arm/nptl/pt-vfork.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2005-2014 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 \
-	GET_TLS (r2);							\
-	NEGOFF_ADJ_BASE2 (r2, r0, PID_OFFSET); /* Save the TLS addr in r2. */ \
-	ldr	r3, NEGOFF_OFF1 (r2, PID_OFFSET); /* Load the saved PID.  */  \
-	rsb	r0, r3, #0;		/* Negate it.  */		     \
-	str	r0, NEGOFF_OFF1 (r2, PID_OFFSET); /* Store the temp PID.  */
-
-/* Restore the old PID value in the parent.  */
-#define RESTORE_PID \
-	cmp	r0, #0;			/* If we are the parent... */	\
-	it	ne;							\
-	strne	r3, NEGOFF_OFF1 (r2, PID_OFFSET); /* restore the saved PID.  */
-
-#include "../vfork.S"
diff --git a/sysdeps/unix/sysv/linux/arm/nptl/vfork.S b/sysdeps/unix/sysv/linux/arm/nptl/vfork.S
deleted file mode 100644
index 2e942be..0000000
--- a/sysdeps/unix/sysv/linux/arm/nptl/vfork.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2005-2014 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 \
-	GET_TLS (r2);							\
-	NEGOFF_ADJ_BASE2 (r2, r0, PID_OFFSET); /* Save the TLS addr in r2.  */ \
-	ldr	r3, NEGOFF_OFF1 (r2, PID_OFFSET); /* Load the saved PID.  */   \
-	rsbs	r0, r3, #0;		/* Negate it.  */		      \
-	it	eq;							      \
-	moveq	r0, #0x80000000;	/* Use 0x80000000 if it was 0.  */    \
-	str	r0, NEGOFF_OFF1 (r2, PID_OFFSET); /* Store the temp PID.  */
-
-/* Restore the old PID value in the parent.  */
-#define RESTORE_PID \
-	cmp	r0, #0;		/* If we are the parent... */		\
-	it	ne;							\
-	strne	r3, NEGOFF_OFF1 (r2, PID_OFFSET); /* restore the saved PID.  */
-
-#include "../vfork.S"
diff --git a/sysdeps/unix/sysv/linux/arm/vfork.S b/sysdeps/unix/sysv/linux/arm/vfork.S
index 1ac6788..f267df7 100644
--- a/sysdeps/unix/sysv/linux/arm/vfork.S
+++ b/sysdeps/unix/sysv/linux/arm/vfork.S
@@ -19,6 +19,8 @@
 #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
@@ -26,9 +28,16 @@
    and the process ID of the new process to the old process.  */
 
 ENTRY (__vfork)
-#ifdef SAVE_PID
-	SAVE_PID
-#endif
+	/* Save the PID value.  */
+	GET_TLS (r2)
+	NEGOFF_ADJ_BASE2 (r2, r0, PID_OFFSET) /* Save the TLS addr in r2.  */
+	ldr	r3, NEGOFF_OFF1 (r2, PID_OFFSET) /* Load the saved PID.  */
+	rsbs	r0, r3, #0		/* Negate it, and test for zero.  */
+	/* Use 0x80000000 if it was 0.  See raise.c for how this is used.  */
+	it	eq
+	moveq	r0, #0x80000000
+	str	r0, NEGOFF_OFF1 (r2, PID_OFFSET) /* Store the temp PID.  */
+
 	/* The DO_CALL macro saves r7 on the stack, to enable generation
 	   of ARM unwind info.  Since the stack is initially shared between
 	   parent and child of vfork, that saved value could be corrupted.
@@ -46,10 +55,13 @@ ENTRY (__vfork)
 	add	sp, sp, #4
 	cfi_adjust_cfa_offset (-4)
 	mov	r7, ip
-	cfi_restore (r7);
-#ifdef RESTORE_PID
-	RESTORE_PID
-#endif
+	cfi_restore (r7)
+
+	/* Restore the old PID value in the parent.  */
+	cmp	r0, #0		/* If we are the parent... */
+	it	ne
+	strne	r3, NEGOFF_OFF1 (r2, PID_OFFSET) /* restore the saved PID.  */
+
 	cmn	a1, #4096
 	it	cc
 	RETINSTR(cc, lr)
@@ -59,3 +71,4 @@ PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 
 weak_alias (__vfork, vfork)
+strong_alias (__vfork, __libc_vfork)

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]