* [PATCH] Fix pthread_rwlock_timedrdlock on x86_64
@ 2004-07-04 12:26 Jakub Jelinek
2004-07-04 23:12 ` Ulrich Drepper
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-07-04 12:26 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Glibc hackers
Hi!
struct timespec's tv_nsec is long int, but we were comparing only low 32
bits on x86-64. pthread_rwlock_timedwrlock was ok.
2004-07-04 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S
(pthread_rwlock_timedrdlock): Use cmpq instead of cmpl to check
for valid tv_nsec.
* tst-rwlock14.c (do_test): Test for invalid tv_nsec equal to
1 billion and 64-bit tv_nsec which is valid when truncated to 32
bits.
--- libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S.jj 2003-09-22 06:40:52.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S 2004-07-04 14:18:29.730168123 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -71,7 +71,7 @@ pthread_rwlock_timedrdlock:
je 5f
/* Check the value of the timeout parameter. */
-3: cmpl $1000000000, 8(%r13)
+3: cmpq $1000000000, 8(%r13)
jae 19f
incl READERS_QUEUED(%r12)
--- libc/nptl/tst-rwlock14.c.jj 2004-06-27 21:28:46.000000000 +0200
+++ libc/nptl/tst-rwlock14.c 2004-07-04 14:13:50.027351034 +0200
@@ -104,7 +104,7 @@ do_test (void)
result = 1;
}
- ts.tv_nsec = 2000000000;
+ ts.tv_nsec = 1000000000;
e = pthread_rwlock_timedrdlock (&r, &ts);
if (e == 0)
@@ -130,6 +130,34 @@ do_test (void)
result = 1;
}
+ ts.tv_nsec = 0x100001000LL;
+ if (ts.tv_nsec != 0x100001000LL)
+ ts.tv_nsec = 2000000000;
+
+ e = pthread_rwlock_timedrdlock (&r, &ts);
+ if (e == 0)
+ {
+ puts ("third rwlock_timedrdlock did not fail");
+ result = 1;
+ }
+ else if (e != EINVAL)
+ {
+ puts ("third rwlock_timedrdlock did not return EINVAL");
+ result = 1;
+ }
+
+ e = pthread_rwlock_timedrdlock (&r, &ts);
+ if (e == 0)
+ {
+ puts ("third rwlock_timedrdlock did not fail");
+ result = 1;
+ }
+ else if (e != EINVAL)
+ {
+ puts ("third rwlock_timedrdlock did not return EINVAL");
+ result = 1;
+ }
+
if (result == 0)
puts ("no bugs");
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix pthread_rwlock_timedrdlock on x86_64
2004-07-04 12:26 [PATCH] Fix pthread_rwlock_timedrdlock on x86_64 Jakub Jelinek
@ 2004-07-04 23:12 ` Ulrich Drepper
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-07-04 23:12 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
Applied.
--
⧠Ulrich Drepper ⧠Red Hat, Inc. ⧠444 Castro St ⧠Mountain View, CA â
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-07-04 23:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-04 12:26 [PATCH] Fix pthread_rwlock_timedrdlock on x86_64 Jakub Jelinek
2004-07-04 23:12 ` Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).