mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 20:08:15 +08:00
poll: pollsetup should notify only one fd passd by caller
since it's redundant to iterate the whole fds array in setup Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Alin Jerpelea
parent
11b3adf17f
commit
eddd90de78
@@ -77,17 +77,12 @@ struct usrsockdev_s
|
||||
|
||||
static ssize_t usrsockdev_read(FAR struct file *filep, FAR char *buffer,
|
||||
size_t len);
|
||||
|
||||
static ssize_t usrsockdev_write(FAR struct file *filep,
|
||||
FAR const char *buffer, size_t len);
|
||||
|
||||
static off_t usrsockdev_seek(FAR struct file *filep, off_t offset,
|
||||
int whence);
|
||||
|
||||
static int usrsockdev_open(FAR struct file *filep);
|
||||
|
||||
static int usrsockdev_close(FAR struct file *filep);
|
||||
|
||||
static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
bool setup);
|
||||
|
||||
@@ -395,7 +390,6 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
{
|
||||
FAR struct inode *inode = filep->f_inode;
|
||||
FAR struct usrsockdev_s *dev;
|
||||
pollevent_t eventset;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
@@ -447,18 +441,14 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
||||
|
||||
/* Should immediately notify on any of the requested events? */
|
||||
|
||||
eventset = 0;
|
||||
|
||||
/* Notify the POLLIN event if pending request. */
|
||||
|
||||
if (dev->req.iov != NULL &&
|
||||
!(usrsock_iovec_get(NULL, 0, dev->req.iov,
|
||||
dev->req.iovcnt, dev->req.pos, NULL) < 0))
|
||||
{
|
||||
eventset |= POLLIN;
|
||||
poll_notify(&fds, 1, POLLIN);
|
||||
}
|
||||
|
||||
poll_notify(dev->pollfds, nitems(dev->pollfds), eventset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user