Re: UDP recvmsg blocks after select(), 2.6 bug?

From: David S. Miller
Date: Thu Oct 07 2004 - 17:31:01 EST


On Fri, 8 Oct 2004 00:19:52 +0100
"Martijn Sipkema" <msipkema@xxxxxxxxxxxxxxxxxxx> wrote:

> So why not return EIO instead? It would be even better to have select()
> validate the data, but I think returning EIO is better than blocking and most
> likely POSIX compliant.

It's not EIO either, it's "queue empty" which means block.
-EIO is a hard error. You're trying to find some clever way
to say "try again", but:

1) -EAGAIN is illegal on blocking sockets
2) -EIO is a hard error and does not mean "try again"

Therefore we block, which is the correct thing to do in this
situation.

Applications which wish not to block should (SURPRISE SURPRISE)
use non-blocking sockets, otherwise blocking is ok for them.

I can't believe this thread has lasted this long. I think people
had cotton in their ears when I mentioned that every single 2.4.x
and 2.6.x existing system out there has this behavior, therefore
even if we changed the behavior some way today people still need
to handle this to work on all existing Linux systems.

Furthermore, returning -EAGAIN or any other kind of "try again"
_DOES_ break applications, that's why we changed it to block instead.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/