On Wed, Feb 21, 2007 at 10:45:43PM -0800, David Miller ([EMAIL PROTECTED]) 
wrote:
> POLLHUP is a complete mess, because it means different things on
> different kinds of fds.  And exactly, because it is not maskable,
> this makes it totally useless for sockets.

POLLHUP does show that socket can not be used for transfer, that is what
select() expects to receive. Given select() semantic and the fact, that
socket error is cleared, there is no simple way to say that socket is
not suitable for output - actually not - all reset events ends up with
tcp_done() which marks socket as close, so if in polling time we have
closed socket, it can be considered as error and thus we can add POLLERR
into the mask - so we can extend following code in poll:

if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE)
        mask |= POLLHUP;

to

if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE)
        mask |= POLLHUP | (sk->sk_state == TCP_CLOSE)?POLLERR:0;


Thoughts?

-- 
        Evgeniy Polyakov
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to