When readahead data is available, poll needs to return POLLIN or POLLRDNORM, not POLLOUT

This commit is contained in:
Gregory Nutt 2013-05-23 07:16:46 -06:00
parent 16d04c7aa7
commit 9d280a58aa
3 changed files with 10 additions and 4 deletions

View File

@ -4774,4 +4774,6 @@
STM32L-Discovery's segment LCD (2013-5-22). STM32L-Discovery's segment LCD (2013-5-22).
* fs/fs_poll.c: Poll setup/teardown logic should ignore invalid (i.e., * fs/fs_poll.c: Poll setup/teardown logic should ignore invalid (i.e.,
negative) file descriptors. Max Holtzberg (2013-5-23). 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)

View File

@ -59,12 +59,14 @@
* Priority data may be read without blocking. * Priority data may be read without blocking.
* POLLPRI * POLLPRI
* High priority data may be read without blocking. * High priority data may be read without blocking.
*
* POLLOUT * POLLOUT
* Normal data may be written without blocking. * Normal data may be written without blocking.
* POLLWRNORM * POLLWRNORM
* Equivalent to POLLOUT. * Equivalent to POLLOUT.
* POLLWRBAND * POLLWRBAND
* Priority data may be written. * Priority data may be written.
*
* POLLERR * POLLERR
* An error has occurred (revents only). * An error has occurred (revents only).
* POLLHUP * POLLHUP

View File

@ -205,7 +205,7 @@ static inline int net_pollsetup(FAR struct socket *psock,
{ {
return -ENOMEM; return -ENOMEM;
} }
/* Some of the following must be atomic */ /* Some of the following must be atomic */
flags = uip_lock(); flags = uip_lock();
@ -250,7 +250,9 @@ static inline int net_pollsetup(FAR struct socket *psock,
if (!sq_empty(&conn->readahead)) if (!sq_empty(&conn->readahead))
#endif #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. /* 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 #endif
/* Check if we are setting up or tearing down the poll */ /* Check if we are setting up or tearing down the poll */
if (setup) if (setup)
{ {
/* Perform the TCP/IP poll() setup */ /* Perform the TCP/IP poll() setup */