about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-02 08:47:09 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-02 08:47:09 +0000
commit8348dcc8ed4f262eefffcd9a9000aede69ad531e (patch)
treeb02aeaab661c72902f6bb5a00b9f2bcf0f45e819
parent7da1e9116ab8acfbec5b0afaf9ad57391ae25479 (diff)
downloadglibc-8348dcc8ed4f262eefffcd9a9000aede69ad531e.tar.gz
glibc-8348dcc8ed4f262eefffcd9a9000aede69ad531e.tar.xz
glibc-8348dcc8ed4f262eefffcd9a9000aede69ad531e.zip
Update.
2003-09-02  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/i386/not-cancel.h: New file.
	* sysdeps/unix/sysv/linux/x86-64/not-cancel.h: New file.

	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Make sure the code
	in subsections has a symbol associated with it.

	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (PSEUDO): Also
	defined symbol for entry point to avoid cancellation.
	* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (PSEUDO): Likewise.
-rw-r--r--nptl/ChangeLog12
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h96
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h61
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/not-cancel.h1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h4
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscalls.list1
7 files changed, 143 insertions, 36 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index b27479fbe0..be125ea8bc 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,15 @@
+2003-09-02  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/not-cancel.h: New file.
+	* sysdeps/unix/sysv/linux/x86-64/not-cancel.h: New file.
+
+	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Make sure the code
+	in subsections has a symbol associated with it.
+
+	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (PSEUDO): Also
+	defined symbol for entry point to avoid cancellation.
+	* sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (PSEUDO): Likewise.
+
 2003-09-01  Jakub Jelinek  <jakub@redhat.com>
 
 	* Makefile (tests): Add tst-tls5.
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
index bd3fe4c012..cf88c54a59 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
@@ -114,13 +114,16 @@ extern int __lll_mutex_unlock_wait (int *__futex)
   (void) ({ int ignore1, ignore2;					      \
 	    __asm __volatile (LOCK_INSTR "xaddl %0, %2\n\t"		      \
 			      "testl %0, %0\n\t"			      \
-			      "jne 1f\n\t"				      \
-			      ".subsection 1\n"				      \
-			      "1:\tleal %2, %%ecx\n\t"			      \
+			      "jne _L_mutex_lock_%=\n\t"		      \
+			      ".subsection 1\n\t"			      \
+			      ".type _L_mutex_lock_%=,@function\n"	      \
+			      "_L_mutex_lock_%=:\n\t"			      \
+			      "leal %2, %%ecx\n\t"			      \
 			      "call __lll_mutex_lock_wait\n\t"		      \
-			      "jmp 2f\n\t"				      \
+			      "jmp 1f\n\t"				      \
+			      ".size _L_mutex_lock_%=,.-_L_mutex_lock_%=\n"   \
 			      ".previous\n"				      \
-			      "2:"					      \
+			      "1:"					      \
 			      : "=a" (ignore1), "=&c" (ignore2), "=m" (futex) \
 			      : "0" (1), "2" (futex)			      \
 			      : "memory"); })
@@ -132,13 +135,16 @@ extern int __lll_mutex_unlock_wait (int *__futex)
   (void) ({ int ignore1, ignore2;					      \
 	    __asm __volatile (LOCK_INSTR "xaddl %0, %2\n\t"		      \
 			      "testl %0, %0\n\t"			      \
-			      "jne 1f\n\t"				      \
-			      ".subsection 1\n"				      \
-			      "1:\tleal %2, %%ecx\n\t"			      \
+			      "jne _L_mutex_cond_lock_%=\n\t"		      \
+			      ".subsection 1\n\t"			      \
+			      ".type _L_mutex_cond_lock_%=,@function\n"	      \
+			      "_L_mutex_cond_lock_%=:\n\t"		      \
+			      "leal %2, %%ecx\n\t"			      \
 			      "call __lll_mutex_lock_wait\n\t"		      \
-			      "jmp 2f\n\t"				      \
+			      "jmp 1f\n\t"				      \
+			      ".size _L_mutex_cond_lock_%=,.-_L_mutex_cond_lock_%=\n"   \
 			      ".previous\n"				      \
-			      "2:"					      \
+			      "1:"					      \
 			      : "=a" (ignore1), "=&c" (ignore2), "=m" (futex) \
 			      : "0" (2), "2" (futex)			      \
 			      : "memory"); })
@@ -148,14 +154,17 @@ extern int __lll_mutex_unlock_wait (int *__futex)
   ({ int result, ignore1, ignore2;					      \
      __asm __volatile (LOCK_INSTR "xaddl %0, %3\n\t"			      \
 		       "testl %0, %0\n\t"				      \
-		       "jne 1f\n\t"					      \
-		       ".subsection 1\n"				      \
-		       "1:\tleal %3, %%ecx\n\t"				      \
+		       "jne _L_mutex_timedlock_%=\n\t"			      \
+		       ".subsection 1\n\t"				      \
+		       ".type _L_mutex_timedlock_%=,@function\n"	      \
+		       "_L_mutex_timedlock_%=:\n\t"			      \
+		       "leal %3, %%ecx\n\t"				      \
 		       "movl %6, %%edx\n\t"				      \
 		       "call __lll_mutex_timedlock_wait\n\t"		      \
-		       "jmp 2f\n\t"					      \
+		       "jmp 1f\n\t"					      \
+		       ".size _L_mutex_timedlock_%=,.-_L_mutex_timedlock_%=\n"\
 		       ".previous\n"					      \
-		       "2:"						      \
+		       "1:"						      \
 		       : "=a" (result), "=&c" (ignore1), "=&d" (ignore2),     \
 			 "=m" (futex)					      \
 		       : "0" (1), "3" (futex), "m" (timeout)		      \
@@ -166,13 +175,16 @@ extern int __lll_mutex_unlock_wait (int *__futex)
 #define lll_mutex_unlock(futex) \
   (void) ({ int ignore;							      \
             __asm __volatile (LOCK_INSTR "subl $1,%0\n\t"		      \
-			      "jne 1f\n\t"				      \
-			      ".subsection 1\n"				      \
-			      "1:\tleal %0, %%eax\n\t"			      \
+			      "jne _L_mutex_unlock_%=\n\t"		      \
+			      ".subsection 1\n\t"			      \
+			      ".type _L_mutex_unlock_%=,@function\n"	      \
+			      "_L_mutex_unlock_%=:\n\t"			      \
+			      "leal %0, %%eax\n\t"			      \
 			      "call __lll_mutex_unlock_wake\n\t"	      \
-			      "jmp 2f\n\t"				      \
+			      "jmp 1f\n\t"				      \
+			      ".size _L_mutex_unlock_%=,.-_L_mutex_unlock_%=\n" \
 			      ".previous\n"				      \
-			      "2:"					      \
+			      "1:"					      \
 			      : "=m" (futex), "=&a" (ignore)		      \
 			      : "0" (futex)				      \
 			      : "memory"); })
@@ -219,13 +231,16 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 # define lll_lock(futex) \
   (void) ({ int ignore1, ignore2;					      \
 	    __asm __volatile (LOCK_INSTR "xaddl %0, %2\n\t"		      \
-			      "jne 1f\n\t"				      \
-			      ".subsection 1\n"				      \
-			      "1:\tleal %2, %%ecx\n\t"			      \
+			      "jne _L_lock_%=\n\t"			      \
+			      ".subsection 1\n\t"			      \
+			      ".type _L_lock_%=,@function\n"		      \
+			      "_L_lock_%=:\n\t"				      \
+			      "leal %2, %%ecx\n\t"			      \
 			      "call __lll_lock_wait\n\t"		      \
-			      "jmp 2f\n\t"				      \
+			      "jmp 1f\n\t"				      \
+			      ".size _L_lock_%=,.-_L_lock_%=\n"		      \
 			      ".previous\n"				      \
-			      "2:"					      \
+			      "1:"					      \
 			      : "=a" (ignore1), "=&c" (ignore2), "=m" (futex) \
 			      : "0" (-1), "2" (futex)			      \
 			      : "memory"); })
@@ -234,13 +249,16 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 # define lll_unlock(futex) \
   (void) ({ int ignore;							      \
             __asm __volatile (LOCK_INSTR "addl $1,%0\n\t"		      \
-			      "jng 1f\n\t"				      \
-			      ".subsection 1\n"				      \
-			      "1:\tleal %0, %%eax\n\t"			      \
+			      "jng _L_unlock_%=\n\t"			      \
+			      ".subsection 1\n\t"			      \
+			      ".type _L_unlock_%=,@function\n"		      \
+			      "_L_unlock_%=:\n\t"			      \
+			      "leal %0, %%eax\n\t"			      \
 			      "call __lll_unlock_wake\n\t"		      \
-			      "jmp 2f\n\t"				      \
+			      "jmp 1f\n\t"				      \
+			      ".size _L_unlock_%=,.-_L_unlock_%=\n"	      \
 			      ".previous\n"				      \
-			      "2:"					      \
+			      "1:"					      \
 			      : "=m" (futex), "=&a" (ignore)		      \
 			      : "0" (futex)				      \
 			      : "memory"); })
@@ -270,11 +288,14 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 			      "je,pt 0f\n\t"				      \
 			      "lock\n"					      \
 			      "0:\txaddl %0, %2\n\t"			      \
-			      "jne 1f\n\t"				      \
-			      ".subsection 1\n"				      \
-			      "1:\tleal %2, %%ecx\n\t"			      \
+			      "jne _L_lock_%=\n\t"			      \
+			      ".subsection 1\n\t"			      \
+			      ".type _L_lock_%=,@function\n"		      \
+			      "_L_lock_%=:\n\t"				      \
+			      "leal %2, %%ecx\n\t"			      \
 			      "call __lll_lock_wait\n\t"		      \
 			      "jmp 2f\n\t"				      \
+			      ".size _L_lock_%=,.-_L_lock_%=\n"	      \
 			      ".previous\n"				      \
 			      "2:"					      \
 			      : "=a" (ignore1), "=&c" (ignore2), "=m" (futex) \
@@ -289,11 +310,14 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
 			      "je,pt 0f\n\t"				      \
 			      "lock\n"					      \
 			      "0:\taddl $1,%0\n\t"			      \
-			      "jng 1f\n\t"				      \
-			      ".subsection 1\n"				      \
-			      "1:\tleal %0, %%eax\n\t"			      \
+			      "jng _L_unlock_%=\n\t"			      \
+			      ".subsection 1\n\t"			      \
+			      ".type _L_unlock_%=,@function\n"		      \
+			      "_L_unlock_%=:\n\t"			      \
+			      "leal %0, %%eax\n\t"			      \
 			      "call __lll_unlock_wake\n\t"		      \
 			      "jmp 2f\n\t"				      \
+			      ".size _L_unlock_%=,.-_L_unlock_%=\n"	      \
 			      ".previous\n"				      \
 			      "2:"					      \
 			      : "=m" (futex), "=&a" (ignore)		      \
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h b/nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h
new file mode 100644
index 0000000000..77ea727969
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/i386/not-cancel.h
@@ -0,0 +1,61 @@
+/* Uncancelable versions of cancelable interfaces.  Linux version.
+   Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+/* Uncancelable open.  */
+extern int __open_nocancel (const char *, int, ...);
+#define open_not_cancel(name, flags, mode) \
+   __open_nocancel (name, flags, mode)
+#define open_not_cancel_2(name, flags) \
+   __open_nocancel (name, flags)
+
+/* Uncancelable close.  */
+extern int __close_nocancel (int);
+#define close_not_cancel(fd) \
+  __close_nocancel (fd)
+#define close_not_cancel_no_status(fd) \
+  (void) ({ INTERNAL_SYSCALL_DECL (err);				      \
+	    INTERNAL_SYSCALL (close, err, 1, (fd)); })
+
+/* Uncancelable read.  */
+extern int __read_nocancel (int, void *, size_t);
+#define read_not_cancel(fd, buf, n) \
+  __read_nocancel (fd, buf, n)
+
+/* Uncancelable write.  */
+extern int __write_nocancel (int, const void *, size_t);
+#define write_not_cancel(fd, buf, n) \
+  __write_nocancel (fd, buf, n)
+
+/* Uncancelable writev.  */
+#define writev_not_cancel_no_status(fd, iov, n) \
+  (void) ({ INTERNAL_SYSCALL_DECL (err);				      \
+	    INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); })
+
+/* Uncancelable waitpid.  */
+#ifdef __NR_waitpid
+extern pid_t __waitpid_nocancel (pid_t, int *, int);
+# define waitpid_not_cancel(pid, stat_loc, options) \
+  __waitpid_nocancel (pid, stat_loc, options)
+#else
+# define waitpid_not_cancel(pid, stat_loc, options) \
+  INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
index e932359327..8eb6ede89d 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
@@ -32,10 +32,14 @@
   L(name##START):							      \
     cmpl $0, %gs:MULTIPLE_THREADS_OFFSET;				      \
     jne L(pseudo_cancel);						      \
+  .type __##syscall_name##_nocancel,@function;				      \
+  .globl __##syscall_name##_nocancel;					      \
+  __##syscall_name##_nocancel:						      \
     DO_CALL (syscall_name, args);					      \
     cmpl $-4095, %eax;							      \
     jae SYSCALL_ERROR_LABEL;						      \
     ret;								      \
+  .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	      \
   L(pseudo_cancel):							      \
     CENABLE								      \
     SAVE_OLDTYPE_##args							      \
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/not-cancel.h b/nptl/sysdeps/unix/sysv/linux/x86_64/not-cancel.h
new file mode 100644
index 0000000000..c402e382d4
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/not-cancel.h
@@ -0,0 +1 @@
+#include "../i386/test-cancel.h"
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
index 8081d72468..f8d726ddd8 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
@@ -31,10 +31,14 @@
   ENTRY (name)								      \
     SINGLE_THREAD_P;							      \
     jne L(pseudo_cancel);						      \
+  .type __##syscall_name##_nocancel,@function;				      \
+  .globl __##syscall_name##_nocancel;					      \
+  __##syscall_name##_nocancel:						      \
     DO_CALL (syscall_name, args);					      \
     cmpq $-4095, %rax;							      \
     jae SYSCALL_ERROR_LABEL;						      \
     ret;								      \
+  .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	      \
   L(pseudo_cancel):							      \
     /* Save registers that might get destroyed.  */			      \
     SAVESTK_##args							      \
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 2a8c1d88d8..d637f3172a 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -5,3 +5,4 @@ vm86		-	vm86		i:p	__vm86		vm86
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
 time		-	time		Ei:p	time
+waitpid		-	waitpid		Ci:ipi	__waitpid	waitpid	__libc_waitpid