* tst-tls2.c (do_test): Add TEMP_FAILURE_RETRY around sem_wait call.
	* tst-signal3.c (do_test): Likewise.
	* tst-sem5.c (do_test): Likewise.
	* tst-kill6.c (do_test): Likewise.
	* tst-tls3.c (do_test): Likewise.  Include <errno.h>.

	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Use add/sub instead
	of inc/dec.
	* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/pthread_once.S: Likewise
	* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
	Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
	Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
This commit is contained in:
Ulrich Drepper 2003-03-08 10:30:42 +00:00
parent d130a34156
commit ccf1d5737a
23 changed files with 116 additions and 85 deletions

View File

@ -1,5 +1,32 @@
2003-03-08 Ulrich Drepper <drepper@redhat.com>
* tst-tls2.c (do_test): Add TEMP_FAILURE_RETRY around sem_wait call.
* tst-signal3.c (do_test): Likewise.
* tst-sem5.c (do_test): Likewise.
* tst-kill6.c (do_test): Likewise.
* tst-tls3.c (do_test): Likewise. Include <errno.h>.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Use add/sub instead
of inc/dec.
* sysdeps/unix/sysv/linux/i386/lowlevelsem.h: Likewise.
* sysdeps/unix/sysv/linux/i386/pthread_once.S: Likewise
* sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/lowlevelmutex.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
* allocatestack.c (allocate_stack): If mprotect() fails free the
TLS memory.

View File

@ -77,7 +77,7 @@ lll_unlock_wake_cb:
movl 20(%esp), %ebx
LOCK
incl (%ebx)
addl $1, (%ebx)
jng 1f
popl %edx
@ -140,7 +140,7 @@ __lll_timedwait_tid:
subl %eax, %edx
jns 5f
addl $1000000000, %edx
decl %ecx
subl $1, %ecx
5: testl %ecx, %ecx
js 6f /* Time is already up. */

View File

@ -107,7 +107,7 @@ __lll_mutex_timedlock_wait:
subl %eax, %edx
jns 4f
addl $1000000000, %edx
decl %ecx
subl $1, %ecx
4: testl %ecx, %ecx
js 5f /* Time is already up. */
@ -159,9 +159,9 @@ __lll_mutex_unlock_wake:
pushl %ecx
pushl %edx
movl $FUTEX_WAKE, %ecx
movl %eax, %ebx
movl $0, (%ebx)
movl $0, (%eax)
movl $FUTEX_WAKE, %ecx
movl $1, %edx /* Wake one thread. */
movl $SYS_futex, %eax
ENTER_KERNEL

View File

@ -53,7 +53,7 @@ pthread_barrier_wait:
/* One less waiter. If this was the last one needed wake
everybody. */
2: decl LEFT(%ebx)
2: subl $1, LEFT(%ebx)
je 3f
/* There are more threads to come. */
@ -67,7 +67,7 @@ pthread_barrier_wait:
/* Release the mutex. */
LOCK
incl MUTEX(%ebx)
addl $1, MUTEX(%ebx)
jng 6f
/* Wait for the remaining threads. The call will return immediately
@ -98,9 +98,9 @@ pthread_barrier_wait:
3: movl INIT_COUNT(%ebx), %eax
movl %eax, LEFT(%ebx)
#if CURR_EVENT == 0
incl (%ebx)
addl $1, (%ebx)
#else
incl CURR_EVENT(%ebx)
addl $1, CURR_EVENT(%ebx)
#endif
/* Wake up all waiters. The count is a signed number in the kernel
@ -114,7 +114,7 @@ pthread_barrier_wait:
waking the waiting threads since otherwise a new thread might
arrive and gets waken up, too. */
LOCK
incl MUTEX(%ebx)
addl $1, MUTEX(%ebx)
jng 4f
5: orl $-1, %eax /* == PTHREAD_BARRIER_SERIAL_THREAD */

View File

@ -71,7 +71,7 @@ __pthread_cond_broadcast:
/* Unlock. */
LOCK
decl cond_lock-wakeup_seq(%ebx)
subl $1, cond_lock-wakeup_seq(%ebx)
jne 7f
/* Wake up all threads. */
@ -87,7 +87,7 @@ __pthread_cond_broadcast:
.align 16
/* Unlock. */
4: LOCK
decl cond_lock-wakeup_seq(%ebx)
subl $1, cond_lock-wakeup_seq(%ebx)
jne 5f
6: xorl %eax, %eax

View File

@ -76,7 +76,7 @@ __pthread_cond_signal:
/* Unlock. */
4: LOCK
decl cond_lock-wakeup_seq(%ebx)
subl $1, cond_lock-wakeup_seq(%ebx)
jne 5f
6: xorl %eax, %eax

View File

@ -102,9 +102,9 @@ __pthread_cond_timedwait:
/* Unlock. */
8: LOCK
#if cond_lock == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl cond_lock(%ebx)
subl $1, cond_lock(%ebx)
#endif
jne 3f
@ -129,7 +129,7 @@ __pthread_cond_timedwait:
subl %eax, %edx
jns 12f
addl $1000000000, %edx
decl %ecx
subl $1, %ecx
12: testl %ecx, %ecx
js 13f
@ -190,9 +190,9 @@ __pthread_cond_timedwait:
LOCK
#if cond_lock == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl cond_lock(%ebx)
subl $1, cond_lock(%ebx)
#endif
jne 10f
@ -259,9 +259,9 @@ __pthread_cond_timedwait:
16: movl %eax, (%esp)
LOCK
#if cond_lock == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl cond_lock(%ebx)
subl $1, cond_lock(%ebx)
#endif
jne 17f

View File

@ -71,9 +71,9 @@ __condvar_cleanup:
LOCK
#if cond_lock == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl cond_lock(%ebx)
subl $1, cond_lock(%ebx)
#endif
je 2f
#if cond_lock == 0
@ -159,9 +159,9 @@ __pthread_cond_wait:
/* Unlock. */
8: LOCK
#if cond_lock == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl cond_lock(%ebx)
subl $1, cond_lock(%ebx)
#endif
jne 3f
@ -211,9 +211,9 @@ __pthread_cond_wait:
LOCK
#if cond_lock == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl cond_lock(%ebx)
subl $1, cond_lock(%ebx)
#endif
jne 10f
@ -277,9 +277,9 @@ __pthread_cond_wait:
12: movl %eax, (%esp)
LOCK
#if cond_lock == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl cond_lock(%ebx)
subl $1, cond_lock(%ebx)
#endif
jne 13f

View File

@ -66,16 +66,16 @@ __pthread_rwlock_rdlock:
cmpl $0, FLAGS(%ebx)
je 5f
3: incl READERS_QUEUED(%ebx)
3: addl $1, READERS_QUEUED(%ebx)
je 4f
movl READERS_WAKEUP(%ebx), %edx
LOCK
#if MUTEX == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl MUTEX(%ebx)
subl $1, MUTEX(%ebx)
#endif
jne 10f
@ -97,17 +97,17 @@ __pthread_rwlock_rdlock:
testl %eax, %eax
jne 12f
13: decl READERS_QUEUED(%ebx)
13: subl $1, READERS_QUEUED(%ebx)
jmp 2b
5: xorl %ecx, %ecx
incl NR_READERS(%ebx)
addl $1, NR_READERS(%ebx)
je 8f
9: LOCK
#if MUTEX == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl MUTEX(%ebx)
subl $1, MUTEX(%ebx)
#endif
jne 6f
7:
@ -142,12 +142,12 @@ __pthread_rwlock_rdlock:
jmp 7b
/* Overflow. */
8: decl NR_READERS(%ebx)
8: subl $1, NR_READERS(%ebx)
movl $EAGAIN, %ecx
jmp 9b
/* Overflow. */
4: decl READERS_QUEUED(%ebx)
4: subl $1, READERS_QUEUED(%ebx)
movl $EAGAIN, %ecx
jmp 9b

View File

@ -76,16 +76,16 @@ pthread_rwlock_timedrdlock:
3: cmpl $1000000000, 4(%edi)
jae 19f
incl READERS_QUEUED(%ebp)
addl $1, READERS_QUEUED(%ebp)
je 4f
movl READERS_WAKEUP(%ebp), %esi
LOCK
#if MUTEX == 0
decl (%ebp)
subl $1, (%ebp)
#else
decl MUTEX(%ebp)
subl $1, MUTEX(%ebp)
#endif
jne 10f
@ -105,7 +105,7 @@ pthread_rwlock_timedrdlock:
subl %eax, %edx
jns 15f
addl $1000000000, %edx
decl %ecx
subl $1, %ecx
15: testl %ecx, %ecx
js 16f /* Time is already up. */
@ -132,7 +132,7 @@ pthread_rwlock_timedrdlock:
testl %eax, %eax
jne 12f
13: decl READERS_QUEUED(%ebp)
13: subl $1, READERS_QUEUED(%ebp)
cmpl $-ETIMEDOUT, %edx
jne 2b
@ -141,13 +141,13 @@ pthread_rwlock_timedrdlock:
5: xorl %ecx, %ecx
incl NR_READERS(%ebp)
addl $1, NR_READERS(%ebp)
je 8f
9: LOCK
#if MUTEX == 0
decl (%ebp)
subl $1, (%ebp)
#else
decl MUTEX(%ebp)
subl $1, MUTEX(%ebp)
#endif
jne 6f
@ -184,12 +184,12 @@ pthread_rwlock_timedrdlock:
jmp 7b
/* Overflow. */
8: decl NR_READERS(%ebp)
8: subl $1, NR_READERS(%ebp)
movl $EAGAIN, %ecx
jmp 9b
/* Overflow. */
4: decl READERS_QUEUED(%ebp)
4: subl $1, READERS_QUEUED(%ebp)
movl $EAGAIN, %ecx
jmp 9b

View File

@ -74,16 +74,16 @@ pthread_rwlock_timedwrlock:
3: cmpl $1000000000, 4(%edi)
jae 19f
incl WRITERS_QUEUED(%ebp)
addl $1, WRITERS_QUEUED(%ebp)
je 4f
movl WRITERS_WAKEUP(%ebp), %esi
LOCK
#if MUTEX == 0
decl (%ebp)
subl $1, (%ebp)
#else
decl MUTEX(%ebp)
subl $1, MUTEX(%ebp)
#endif
jne 10f
@ -103,7 +103,7 @@ pthread_rwlock_timedwrlock:
subl %eax, %edx
jns 15f
addl $1000000000, %edx
decl %ecx
subl $1, %ecx
15: testl %ecx, %ecx
js 16f /* Time is already up. */
@ -130,7 +130,7 @@ pthread_rwlock_timedwrlock:
testl %eax, %eax
jne 12f
13: decl WRITERS_QUEUED(%ebp)
13: subl $1, WRITERS_QUEUED(%ebp)
cmpl $-ETIMEDOUT, %edx
jne 2b
@ -143,9 +143,9 @@ pthread_rwlock_timedwrlock:
movl %eax, WRITER(%ebp)
9: LOCK
#if MUTEX == 0
decl (%ebp)
subl $1, (%ebp)
#else
decl MUTEX(%ebp)
subl $1, MUTEX(%ebp)
#endif
jne 6f
@ -182,7 +182,7 @@ pthread_rwlock_timedwrlock:
jmp 7b
/* Overflow. */
4: decl WRITERS_QUEUED(%ebp)
4: subl $1, WRITERS_QUEUED(%ebp)
movl $EAGAIN, %ecx
jmp 9b

View File

@ -56,7 +56,7 @@ __pthread_rwlock_unlock:
2: cmpl $0, WRITER(%edi)
jne 5f
decl NR_READERS(%edi)
subl $1, NR_READERS(%edi)
jnz 6f
5: movl $0, WRITER(%edi)
@ -74,12 +74,12 @@ __pthread_rwlock_unlock:
movl $0x7fffffff, %edx
leal READERS_WAKEUP(%edi), %ebx
0: incl (%ebx)
0: addl $1, (%ebx)
LOCK
#if MUTEX == 0
decl (%edi)
subl $1, (%edi)
#else
decl MUTEX(%edi)
subl $1, MUTEX(%edi)
#endif
jne 7f
@ -94,9 +94,9 @@ __pthread_rwlock_unlock:
.align 16
6: LOCK
#if MUTEX == 0
decl (%edi)
subl $1, (%edi)
#else
decl MUTEX(%edi)
subl $1, MUTEX(%edi)
#endif
jne 3f

View File

@ -64,16 +64,16 @@ __pthread_rwlock_wrlock:
cmp $0, NR_READERS(%ebx)
je 5f
3: incl WRITERS_QUEUED(%ebx)
3: addl $1, WRITERS_QUEUED(%ebx)
je 4f
movl WRITERS_WAKEUP(%ebx), %edx
LOCK
#if MUTEX == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl MUTEX(%ebx)
subl $1, MUTEX(%ebx)
#endif
jne 10f
@ -95,7 +95,7 @@ __pthread_rwlock_wrlock:
testl %eax, %eax
jne 12f
13: decl WRITERS_QUEUED(%ebx)
13: subl $1, WRITERS_QUEUED(%ebx)
jmp 2b
5: xorl %ecx, %ecx
@ -103,9 +103,9 @@ __pthread_rwlock_wrlock:
movl %eax, WRITER(%ebx)
9: LOCK
#if MUTEX == 0
decl (%ebx)
subl $1, (%ebx)
#else
decl MUTEX(%ebx)
subl $1, MUTEX(%ebx)
#endif
jne 6f
7:
@ -138,7 +138,7 @@ __pthread_rwlock_wrlock:
call __lll_mutex_unlock_wake
jmp 7b
4: decl WRITERS_QUEUED(%ebx)
4: subl $1, WRITERS_QUEUED(%ebx)
movl $EAGAIN, %ecx
jmp 9b

View File

@ -48,7 +48,7 @@ __new_sem_post:
movl $SYS_futex, %eax
movl $FUTEX_WAKE, %ecx
incl %edx
addl $1, %edx
ENTER_KERNEL
testl %eax, %eax

View File

@ -85,7 +85,7 @@ sem_timedwait:
subl %eax, %edx
jns 5f
addl $1000000000, %edx
decl %ecx
subl $1, %ecx
5: testl %ecx, %ecx
movl $ETIMEDOUT, %eax
js 6f /* Time is already up. */

View File

@ -99,7 +99,7 @@ extern int __lll_mutex_unlock_wait (int *__futex)
#define lll_mutex_unlock(futex) \
(void) ({ int ignore; \
__asm __volatile (LOCK_INSTR "decl %0\n\t" \
__asm __volatile (LOCK_INSTR "subl $1,%0\n\t" \
"jne 1f\n\t" \
".subsection 1\n" \
"1:\tleal %0, %%eax\n\t" \
@ -167,7 +167,7 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
# define lll_unlock(futex) \
(void) ({ int ignore; \
__asm __volatile (LOCK_INSTR "incl %0\n\t" \
__asm __volatile (LOCK_INSTR "addl $1,%0\n\t" \
"jng 1f\n\t" \
".subsection 1\n" \
"1:\tleal %0, %%eax\n\t" \
@ -225,7 +225,7 @@ extern int __libc_locking_needed attribute_hidden;
__asm __volatile ("cmpl $0, %%gs:%P3\n\t" \
"je,pt 0f\n\t" \
"lock\n" \
"0:\tincl %0\n\t" \
"0:\taddl $1,%0\n\t" \
"jng 1f\n\t" \
".subsection 1\n" \
"1:\tleal %0, %%eax\n\t" \

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -46,8 +46,8 @@
#define lll_sem_wait(sem) \
({ int result, ignore1, ignore2; \
__asm __volatile ("1:\tincl 8(%4)\n\t" \
LOCK "incl (%4)\n\t" \
__asm __volatile ("1:\taddl $1,8(%4)\n\t" \
LOCK "addl $1,(%4)\n\t" \
"jng 2f\n" \
".subsection 1\n" \
"2:\tmovl %4, %%eax\n\t" \
@ -70,7 +70,7 @@
"call __lll_lock_wait\n\t" \
"jmp 5f\n\t" \
".previous\n" \
"5:\tdecl 8(%4)\n\t" \
"5:\tsubl $1,8(%4)\n\t" \
"xorl %0, %0\n\t" \
"cmpl $0, 4(%4)\n\t" \
"jne,pt 6f\n\t" \

View File

@ -119,7 +119,7 @@ __pthread_once:
/* Sucessful run of the initializer. Signal that we are done. */
LOCK
incl (%ebx)
addl $1, (%ebx)
/* Wake up all other threads. */
movl $0x7fffffff, %edx

View File

@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
@ -112,7 +113,7 @@ do_test (void)
exit (1);
}
if (sem_wait (&sem) != 0)
if (TEMP_FAILURE_RETRY (sem_wait (&sem)) != 0)
{
puts ("sem_wait failed");
exit (1);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -38,7 +38,7 @@ do_test (void)
return 1;
}
if (sem_wait (&s) == -1)
if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1)
{
puts ("sem_wait failed");
return 1;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
@ -156,7 +157,7 @@ do_test (void)
for (i = 0; i < ROUNDS; ++i)
{
if (sem_wait (&sem) != 0)
if (TEMP_FAILURE_RETRY (sem_wait (&sem)) != 0)
{
printf ("sem_wait round %d failed: %m\n", i);
exit (1);

View File

@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <semaphore.h>
@ -159,7 +160,7 @@ do_test (void)
exit (1);
}
if (sem_wait (&s) != 0)
if (TEMP_FAILURE_RETRY (sem_wait (&s)) != 0)
{
puts ("sem_wait failed");
exit (1);

View File

@ -18,6 +18,7 @@
02111-1307 USA. */
#include <dlfcn.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <semaphore.h>
@ -145,7 +146,7 @@ do_test (void)
exit (1);
}
if (sem_wait (&s) != 0)
if (TEMP_FAILURE_RETRY (sem_wait (&s)) != 0)
{
puts ("sem_wait failed");
exit (1);