From e99c76a3132b64aa45b4949e581e77c3e31035db Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 2 Oct 2022 05:45:06 +0800 Subject: [PATCH] poll: Don't need monitor POLLERR or POLLHUP explicitly since spec require the implementation always report POLLERR/POLLHUP: https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html Signed-off-by: Xiang Xiao --- fs/vfs/fs_epoll.c | 5 ++--- fs/vfs/fs_poll.c | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c index 4d3ab3db26..f68b227209 100644 --- a/fs/vfs/fs_epoll.c +++ b/fs/vfs/fs_epoll.c @@ -308,7 +308,7 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev) } eph->data[++eph->occupied] = ev->data; - eph->poll[eph->occupied].events = ev->events | POLLERR | POLLHUP; + eph->poll[eph->occupied].events = ev->events; eph->poll[eph->occupied].fd = fd; break; @@ -347,7 +347,7 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev) if (eph->poll[i].fd == fd) { eph->data[i] = ev->data; - eph->poll[i].events = ev->events | POLLERR | POLLHUP; + eph->poll[i].events = ev->events; break; } } @@ -366,7 +366,6 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev) } poll_notify(&eph->poll, 1, eph->poll[0].events); - return 0; } diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c index 86ca32ff96..781d3cf093 100644 --- a/fs/vfs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -153,7 +153,6 @@ static inline int poll_setup(FAR struct pollfd *fds, nfds_t nfds, fds[i].cb = poll_default_cb; fds[i].revents = 0; fds[i].priv = NULL; - fds[i].events |= POLLERR | POLLHUP; /* Check for invalid descriptors. "If the value of fd is less than 0, * events shall be ignored, and revents shall be set to 0 in that entry @@ -419,7 +418,6 @@ int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) else { poll_notify(&fds, 1, POLLERR | POLLHUP); - ret = OK; }