|
From: Jon S. <jsa...@ma...> - 2003-08-22 20:15:08
|
First of all, Valgrind totally rocks - it has saved me a tremendous amount
of time since I've started using it to track down bug and memory leaks.
Think I've found a teensy bug though. The Valgrind-wrapped recv() and
send() called don't seem to honor MSG_DONTWAIT. The culprit seems to be:
int VGR_(recv)(int s, void *buf, size_t len, int flags)
{
__my_pthread_testcancel();
VGR_(wait_for_fd_to_be_readable_or_erring)(s);
__my_pthread_testcancel();
return __libc_recv(s, buf, len, flags);
}
If MSG_DONTWAIT isn't provided, then Valgrind shouldn't wait for the FD to
be readable or erring. This seems to fix things:
int VGR_(recv)(int s, void *buf, size_t len, int flags)
{
if (!(flags & MSG_DONTWAIT)) {
__my_pthread_testcancel();
VGR_(wait_for_fd_to_be_readable_or_erring)(s);
__my_pthread_testcancel();
}
return __libc_recv(s, buf, len, flags);
}
Similar fix in recvfrom and recvmsg. If this seems reasonable, I'll be
happy to whip up a diff if you'd like.
- Jon
--
----------------------------------------------------------------------
Jon Salz <jsalz@jsalz dot net> "In theory, there is no difference
http://jsalz.net/ between theory and practice.
In practice, there is."
- Yogi Berra
|