summaryrefslogtreecommitdiff
path: root/kernel/poll.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-04-26 19:06:46 +0200
committerAnton Kling <anton@kling.gg>2024-04-26 19:06:46 +0200
commit7ab3153f92f38223157c4c1f4af1c30e33c94a76 (patch)
tree301f950cd6dc8fde244e9b5c1201ec01d964347b /kernel/poll.c
parent2e2805c88789c148cce0118d3a4ff0212458bb86 (diff)
Kernel/VFS: Change polling from variables to functions
Instead of having to store state in variables functions are called to check the object directly.
Diffstat (limited to 'kernel/poll.c')
-rw-r--r--kernel/poll.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/poll.c b/kernel/poll.c
index 7107646..4c6e411 100644
--- a/kernel/poll.c
+++ b/kernel/poll.c
@@ -57,11 +57,15 @@ int poll(struct pollfd *fds, size_t nfds, int timeout) {
fds[i].revents |= POLLHUP;
}
} else {
- if (f->inode->has_data && fds[i].events & POLLIN) {
- fds[i].revents |= POLLIN;
+ if (f->inode->_has_data) {
+ if (f->inode->_has_data(f->inode) && fds[i].events & POLLIN) {
+ fds[i].revents |= POLLIN;
+ }
}
- if (f->inode->can_write && fds[i].events & POLLOUT) {
- fds[i].revents |= POLLOUT;
+ if (f->inode->_can_write) {
+ if (f->inode->_can_write(f->inode) && fds[i].events & POLLOUT) {
+ fds[i].revents |= POLLOUT;
+ }
}
if (!(f->inode->is_open) && fds[i].events & POLLHUP) {
fds[i].revents |= POLLHUP;