Re: Does Linux select() violate POSIX?

From: Alan Cox
Date: Sun Jun 19 2011 - 18:31:07 EST

> 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

connection made
select returns
remote closes connection
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

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at