| Invalid timeouts in i386 sem_timedwait.
|
| We adjusted nwaiters even though this isn't necessary.
+2012-03-08 Thomas Schwinge <thomas@codesourcery.com>
+
+ * tst-sem13.c (do_test): Add another test case.
+ * sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S (sem_timedwait):
+ Fix updating nwaiters.
+
2012-03-07 Joseph Myers <joseph@codesourcery.com>
[BZ #10545]
-/* Copyright (C) 2002-2005, 2007, 2009, 2011-2012 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
/* Check for invalid nanosecond field. */
cmpl $1000000000, 4(%edi)
movl $EINVAL, %esi
- jae 6f
+ jae .Lerrno_exit
LOCK
incl NWAITERS(%ecx)
.Lafter_ret:
3: negl %esi
6:
+ movl 28(%esp), %ebx /* Load semaphore address. */
+ LOCK
+ decl NWAITERS(%ebx)
+.Lerrno_exit:
#ifdef PIC
SETUP_PIC_REG(bx)
#else
movl %esi, %gs:(%edx)
#endif
- movl 28(%esp), %ebx /* Load semaphore address. */
orl $-1, %eax
jmp 10b
.size sem_timedwait,.-sem_timedwait
}
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;
}