Messages in this thread | | | Date | Sun, 19 Jun 2011 23:32:25 +0100 | From | Alan Cox <> | Subject | Re: Does Linux select() violate POSIX? |
| |
> And I got my answer, which is yes, Linux select() violates POSIX, and > that decision is deliberate. > > But again, thank you so much for your valuable contribution to the discussion.
It's worth noting that the POSIX semantics are actually unimplementable for some network protocols anyway particularly on send. TCP is a fine example. A remote TCP isn't *supposed* to shrink its window but they can do, and that that point the space select() saw for a send is closed down again by the remote host.
All sorts of similar issues appear all over the place. There are also interesting API corner cases such as the behaviour of
listen() select connection made select returns remote closes connection accept behaviour is not determinate
(and in general POSIX doens't address sockets well)
So for portable code always mix select and poll with non blocking I/O. It doesn't matter what the specs say, the real world says drive defensively 8)
Alan
| |