diff --git a/ChangeLog b/ChangeLog index f486c4cc22..2d4d68e010 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4774,4 +4774,6 @@ STM32L-Discovery's segment LCD (2013-5-22). * fs/fs_poll.c: Poll setup/teardown logic should ignore invalid (i.e., negative) file descriptors. Max Holtzberg (2013-5-23). - + * net/net_poll.c: When readahead data is availalbe, the network poll + logic should set POLLIN (or POLLRDNORM), not POLLOUT. Max Holtzberg + (2013-5-23) diff --git a/include/poll.h b/include/poll.h index 3bf4c4badd..4439710e90 100644 --- a/include/poll.h +++ b/include/poll.h @@ -59,12 +59,14 @@ * Priority data may be read without blocking. * POLLPRI * High priority data may be read without blocking. + * * POLLOUT * Normal data may be written without blocking. * POLLWRNORM * Equivalent to POLLOUT. * POLLWRBAND * Priority data may be written. + * * POLLERR * An error has occurred (revents only). * POLLHUP diff --git a/net/net_poll.c b/net/net_poll.c index 55ede320d1..77f2f6ef70 100644 --- a/net/net_poll.c +++ b/net/net_poll.c @@ -205,7 +205,7 @@ static inline int net_pollsetup(FAR struct socket *psock, { return -ENOMEM; } - + /* Some of the following must be atomic */ flags = uip_lock(); @@ -250,7 +250,9 @@ static inline int net_pollsetup(FAR struct socket *psock, if (!sq_empty(&conn->readahead)) #endif { - fds->revents |= (POLLOUT & fds->events); + /* Normal data may be read without blocking. */ + + fds->revents |= (POLLRDNORM & fds->events); } /* Check for a loss of connection events. We need to be careful here. @@ -415,7 +417,7 @@ int psock_poll(FAR struct socket *psock, FAR struct pollfd *fds, bool setup) #endif /* Check if we are setting up or tearing down the poll */ - + if (setup) { /* Perform the TCP/IP poll() setup */