* 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.
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.
movl 20(%esp), %ebx
LOCK
- incl (%ebx)
+ addl $1, (%ebx)
jng 1f
popl %edx
subl %eax, %edx
jns 5f
addl $1000000000, %edx
- decl %ecx
+ subl $1, %ecx
5: testl %ecx, %ecx
js 6f /* Time is already up. */
subl %eax, %edx
jns 4f
addl $1000000000, %edx
- decl %ecx
+ subl $1, %ecx
4: testl %ecx, %ecx
js 5f /* Time is already up. */
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
/* 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. */
/* Release the mutex. */
LOCK
- incl MUTEX(%ebx)
+ addl $1, MUTEX(%ebx)
jng 6f
/* Wait for the remaining threads. The call will return immediately
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
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 */
/* Unlock. */
LOCK
- decl cond_lock-wakeup_seq(%ebx)
+ subl $1, cond_lock-wakeup_seq(%ebx)
jne 7f
/* Wake up all threads. */
.align 16
/* Unlock. */
4: LOCK
- decl cond_lock-wakeup_seq(%ebx)
+ subl $1, cond_lock-wakeup_seq(%ebx)
jne 5f
6: xorl %eax, %eax
/* Unlock. */
4: LOCK
- decl cond_lock-wakeup_seq(%ebx)
+ subl $1, cond_lock-wakeup_seq(%ebx)
jne 5f
6: xorl %eax, %eax
/* 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
subl %eax, %edx
jns 12f
addl $1000000000, %edx
- decl %ecx
+ subl $1, %ecx
12: testl %ecx, %ecx
js 13f
LOCK
#if cond_lock == 0
- decl (%ebx)
+ subl $1, (%ebx)
#else
- decl cond_lock(%ebx)
+ subl $1, cond_lock(%ebx)
#endif
jne 10f
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
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
/* 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
LOCK
#if cond_lock == 0
- decl (%ebx)
+ subl $1, (%ebx)
#else
- decl cond_lock(%ebx)
+ subl $1, cond_lock(%ebx)
#endif
jne 10f
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
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
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:
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
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
subl %eax, %edx
jns 15f
addl $1000000000, %edx
- decl %ecx
+ subl $1, %ecx
15: testl %ecx, %ecx
js 16f /* Time is already up. */
testl %eax, %eax
jne 12f
-13: decl READERS_QUEUED(%ebp)
+13: subl $1, READERS_QUEUED(%ebp)
cmpl $-ETIMEDOUT, %edx
jne 2b
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
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
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
subl %eax, %edx
jns 15f
addl $1000000000, %edx
- decl %ecx
+ subl $1, %ecx
15: testl %ecx, %ecx
js 16f /* Time is already up. */
testl %eax, %eax
jne 12f
-13: decl WRITERS_QUEUED(%ebp)
+13: subl $1, WRITERS_QUEUED(%ebp)
cmpl $-ETIMEDOUT, %edx
jne 2b
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
jmp 7b
/* Overflow. */
-4: decl WRITERS_QUEUED(%ebp)
+4: subl $1, WRITERS_QUEUED(%ebp)
movl $EAGAIN, %ecx
jmp 9b
2: cmpl $0, WRITER(%edi)
jne 5f
- decl NR_READERS(%edi)
+ subl $1, NR_READERS(%edi)
jnz 6f
5: movl $0, WRITER(%edi)
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
.align 16
6: LOCK
#if MUTEX == 0
- decl (%edi)
+ subl $1, (%edi)
#else
- decl MUTEX(%edi)
+ subl $1, MUTEX(%edi)
#endif
jne 3f
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
testl %eax, %eax
jne 12f
-13: decl WRITERS_QUEUED(%ebx)
+13: subl $1, WRITERS_QUEUED(%ebx)
jmp 2b
5: xorl %ecx, %ecx
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:
call __lll_mutex_unlock_wake
jmp 7b
-4: decl WRITERS_QUEUED(%ebx)
+4: subl $1, WRITERS_QUEUED(%ebx)
movl $EAGAIN, %ecx
jmp 9b
movl $SYS_futex, %eax
movl $FUTEX_WAKE, %ecx
- incl %edx
+ addl $1, %edx
ENTER_KERNEL
testl %eax, %eax
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. */
#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" \
# 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" \
__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" \
-/* 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.
#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" \
"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" \
/* Sucessful run of the initializer. Signal that we are done. */
LOCK
- incl (%ebx)
+ addl $1, (%ebx)
/* Wake up all other threads. */
movl $0x7fffffff, %edx
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>
exit (1);
}
- if (sem_wait (&sem) != 0)
+ if (TEMP_FAILURE_RETRY (sem_wait (&sem)) != 0)
{
puts ("sem_wait failed");
exit (1);
-/* 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.
return 1;
}
- if (sem_wait (&s) == -1)
+ if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1)
{
puts ("sem_wait failed");
return 1;
-/* 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.
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>
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);
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>
exit (1);
}
- if (sem_wait (&s) != 0)
+ if (TEMP_FAILURE_RETRY (sem_wait (&s)) != 0)
{
puts ("sem_wait failed");
exit (1);
02111-1307 USA. */
#include <dlfcn.h>
+#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <semaphore.h>
exit (1);
}
- if (sem_wait (&s) != 0)
+ if (TEMP_FAILURE_RETRY (sem_wait (&s)) != 0)
{
puts ("sem_wait failed");
exit (1);