From 24f81104f5ff9cb4ab7db766c53f77fe0e5b86cc Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Tue, 21 Nov 2023 22:57:23 +0100 Subject: Kernel: Make poll() return number of file descriptors that had revent set --- kernel/poll.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'kernel/poll.c') diff --git a/kernel/poll.c b/kernel/poll.c index 5e02723..211faf7 100644 --- a/kernel/poll.c +++ b/kernel/poll.c @@ -5,6 +5,7 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { (void)timeout; + int rc = 0; int read_locks[nfds]; int write_locks[nfds]; int disconnect_locks[nfds]; @@ -48,7 +49,9 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) { fds[i].revents |= POLLOUT; if (!(f->inode->is_open) && fds[i].events & POLLHUP) fds[i].revents |= POLLHUP; + if (fds[i].revents) + rc++; } } - return 0; + return rc; } -- cgit v1.2.3