summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-11-21 22:57:23 +0100
committerAnton Kling <anton@kling.gg>2023-11-21 22:57:55 +0100
commit24f81104f5ff9cb4ab7db766c53f77fe0e5b86cc (patch)
tree2ef254d7821ac46cbfa5b6643bb887d2654fd7ec
parentc7cc762db3bee687f025cd085ebc48d5ba0f96c4 (diff)
Kernel: Make poll() return number of file descriptors that had revent set
-rw-r--r--kernel/poll.c5
1 files changed, 4 insertions, 1 deletions
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;
}