This is the mail archive of the libc-alpha@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] |
Hi! As shown by the added test case, in 9554ebf2d4da22591e974d3cf2ed09a2b8dbdbd8 there has another error mode been introduced: ``2nd sem_timedwait modified nwaiters''. 2012-01-24 Thomas Schwinge <thomas@codesourcery.com> * nptl/tst-sem13.c (do_test): Add another test case. * nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S (sem_timedwait): Fix updating nwaiters. Index: nptl/tst-sem13.c =================================================================== --- nptl/tst-sem13.c (revision 356686) +++ nptl/tst-sem13.c (working copy) @@ -30,15 +30,34 @@ do_test (void) } if (errno != EINVAL) { - puts ("sem_timedwait did not fail with EINVAL"); + perror ("sem_timedwait did not fail with EINVAL"); return 1; } if (u.ns.nwaiters != 0) { - puts ("nwaiters modified"); + printf ("sem_timedwait modified nwaiters: %ld\n", u.ns.nwaiters); return 1; } + ts.tv_sec = /* Invalid. */ -2; + ts.tv_nsec = 0; + errno = 0; + if (sem_timedwait (&u.s, &ts) >= 0) + { + puts ("2nd sem_timedwait did not fail"); + return 1; + } + if (errno != ETIMEDOUT) + { + perror ("2nd sem_timedwait did not fail with ETIMEDOUT"); + return 1; + } + if (u.ns.nwaiters != 0) + { + printf ("2nd sem_timedwait modified nwaiters: %ld\n", u.ns.nwaiters); + return 1; + } + return 0; } Index: nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S =================================================================== --- nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S (revision 356686) +++ nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S (working copy) @@ -65,7 +65,7 @@ sem_timedwait: /* Check for invalid nanosecond field. */ cmpl $1000000000, 4(%edi) movl $EINVAL, %esi - jae 6f + jae .Lerrno_exit LOCK incl NWAITERS(%ecx) @@ -147,6 +147,10 @@ sem_timedwait: .Lafter_ret: 3: negl %esi 6: + movl 28(%esp), %ebx /* Load semaphore address. */ + LOCK + decl NWAITERS(%ebx) +.Lerrno_exit: #ifdef PIC call __i686.get_pc_thunk.bx #else @@ -168,7 +172,6 @@ sem_timedwait: movl %esi, (%eax) #endif - movl 28(%esp), %ebx /* Load semaphore address. */ orl $-1, %eax jmp 10b .size sem_timedwait,.-sem_timedwait GrÃÃe, Thomas
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |