summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-05-23 07:16:46 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-05-23 07:16:46 -0600
commit26b10bd86f5d58fe9df3af58d5dd65f2542312fe (patch)
treeb8569ce95088134faf14e4d64bda4e8caf6e4765
parent1b957501729f74c052a43b0cae64e19634adbec6 (diff)
downloadnuttx-26b10bd86f5d58fe9df3af58d5dd65f2542312fe.tar.gz
nuttx-26b10bd86f5d58fe9df3af58d5dd65f2542312fe.tar.bz2
nuttx-26b10bd86f5d58fe9df3af58d5dd65f2542312fe.zip
When readahead data is available, poll needs to return POLLIN or POLLRDNORM, not POLLOUT
-rw-r--r--nuttx/ChangeLog4
-rw-r--r--nuttx/include/poll.h2
-rw-r--r--nuttx/net/net_poll.c8
3 files changed, 10 insertions, 4 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index f486c4cc2..2d4d68e01 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/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/nuttx/include/poll.h b/nuttx/include/poll.h
index 3bf4c4bad..4439710e9 100644
--- a/nuttx/include/poll.h
+++ b/nuttx/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/nuttx/net/net_poll.c b/nuttx/net/net_poll.c
index 55ede320d..77f2f6ef7 100644
--- a/nuttx/net/net_poll.c
+++ b/nuttx/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 */