[patch] generic version of pthread_cond_timedwait
Sebastien Decugis
sebastien.decugis@ext.bull.net
Thu Jun 17 16:39:00 GMT 2004
Hi all,
I found a small error while looking at the code of routine:
nptl/sysdeps/pthread/pthread_cond_timedwait.c
At line 53, the function will reject values which are bigger than a
billion, but will accept negative values for the nanosecond member.
It appears that the too big values are not a problem, as they will be
filtered by the loop on line 129 (after the operation rt = abstime - tv)
On the other hand, a negative tv.tv_nsec value will result in a possibly
invalid ( > 10^9 ) rt.tv_nsec value passed to the kernel. With the
current code the kernel accepts such a value but I think one should not
rely on this.
I also looked at the i486 version of the function, and in this case no
check is done at all. Do you consider there is no use for returning an
error when an user has made a bug? Or is it a miss?
Best regards,
Sebastien.
PS: I attached a patch but I don't know the correct formatting -- and I
don't expect this patch to be applyed as is anyway.
-------------------------------
Sebastien DECUGIS
NPTL Test & Trace Project
http://nptl.bullopensource.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pctw-generic.patch
Type: text/x-patch
Size: 501 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20040617/e6ef5482/attachment.bin>
More information about the Libc-alpha
mailing list