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

Martijn Sipkema
2004-10-07T22:46:23Z

From: "David S. Miller" <davem@davemloft.net>
> On Thu, 07 Oct 2004 15:49:17 -0600
> Chris Friesen <cfriesen@nortelnetworks.com> wrote:
>
> > In this case, select() returns with the socket readable, we call recvmsg() and
> > discover the message is corrupt. At this point we throw away the corrupt
> > message, so we now have no data waiting to be received. We return EAGAIN, and
> > userspace goes merrily on its way, handling anything else in its loop, then
> > going back to select().
>
> Incorrect. When the user specifies blocking on the file descriptor
> we must give it what it asked for. -EAGAIN on a blocking file descriptor
> is always a bug, in all situations, that's what this code used to do and we
> fixed it because it's a bug.

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.

--ms