diff options
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/ChangeLog | 10 | ||||
-rw-r--r-- | nptl/Makefile | 2 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S | 5 | ||||
-rw-r--r-- | nptl/tst-sem13.c | 46 |
4 files changed, 60 insertions, 3 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 181af50038..7e22d35cbe 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,13 @@ +2009-11-27 Andreas Schwab <schwab@redhat.com> + + * sysdeps/unix/sysv/linux/x86_64/cancellation.S: Reload + THREAD_SELF->cancelhandling after returning from futex call. + +2009-11-24 Ulrich Drepper <drepper@redhat.com> + + * tst-sem13.c: New file. + * Makefile (tests): Add tst-sem13. + 2009-11-22 Roland McGrath <roland@redhat.com> * sysdeps/unix/sysv/linux/i386/dl-sysdep.h: # include "i686/dl-sysdep.h" diff --git a/nptl/Makefile b/nptl/Makefile index e8180021ec..34940b59d6 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -216,7 +216,7 @@ tests = tst-typesizes \ tst-once1 tst-once2 tst-once3 tst-once4 \ tst-key1 tst-key2 tst-key3 tst-key4 \ tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \ - tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 \ + tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 \ tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \ tst-align tst-align2 tst-align3 \ tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \ diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S index 0d48ec6fcd..680696200a 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S @@ -96,8 +96,8 @@ ENTRY(__pthread_disable_asynccancel) cmpxchgl %r11d, %fs:CANCELHANDLING jnz 2b -3: movl %r11d, %eax - andl $(TCB_CANCELING_BITMASK|TCB_CANCELED_BITMASK), %eax + movl %r11d, %eax +3: andl $(TCB_CANCELING_BITMASK|TCB_CANCELED_BITMASK), %eax cmpl $TCB_CANCELING_BITMASK, %eax je 4f 1: ret @@ -111,5 +111,6 @@ ENTRY(__pthread_disable_asynccancel) addq $CANCELHANDLING, %rdi LOAD_PRIVATE_FUTEX_WAIT (%esi) syscall + movl %fs:CANCELHANDLING, %eax jmp 3b END(__pthread_disable_asynccancel) diff --git a/nptl/tst-sem13.c b/nptl/tst-sem13.c new file mode 100644 index 0000000000..8756b2262f --- /dev/null +++ b/nptl/tst-sem13.c @@ -0,0 +1,46 @@ +#include <errno.h> +#include <semaphore.h> +#include <stdio.h> +#include <unistd.h> +#include <pthread.h> +#include <internaltypes.h> + + +static int +do_test (void) +{ + union + { + sem_t s; + struct new_sem ns; + } u; + + if (sem_init (&u.s, 0, 0) != 0) + { + puts ("sem_init failed"); + return 1; + } + + struct timespec ts = { 0, 1000000001 }; /* Invalid. */ + errno = 0; + if (sem_timedwait (&u.s, &ts) >= 0) + { + puts ("sem_timedwait did not fail"); + return 1; + } + if (errno != EINVAL) + { + puts ("sem_timedwait did not fail with EINVAL"); + return 1; + } + if (u.ns.nwaiters != 0) + { + puts ("nwaiters modified"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |