From 68980bf71175a47bbf8b22b8cea04a84527ae531 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sun, 10 Jul 2022 00:29:59 +0300 Subject: Kernel: Stop reporting POLLHUP exclusively when available in sys$poll As per Dr. Posix, unlike POLLERR and POLLNVAL, POLLHUP is only mutually exclusive with POLLOUT, all other events may be reported together with it. --- Kernel/Syscalls/poll.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Kernel/Syscalls/poll.cpp') diff --git a/Kernel/Syscalls/poll.cpp b/Kernel/Syscalls/poll.cpp index 940719af94..731540b0f5 100644 --- a/Kernel/Syscalls/poll.cpp +++ b/Kernel/Syscalls/poll.cpp @@ -96,11 +96,11 @@ ErrorOr Process::sys$poll(Userspace use if (fds_entry.unblocked_flags == BlockFlags::None) continue; - if (has_any_flag(fds_entry.unblocked_flags, BlockFlags::WriteError | BlockFlags::WriteHangUp) || !fds_entry.description) { + if (has_flag(fds_entry.unblocked_flags, BlockFlags::WriteHangUp)) + pfd.revents |= POLLHUP; + if (has_flag(fds_entry.unblocked_flags, BlockFlags::WriteError) || !fds_entry.description) { if (has_flag(fds_entry.unblocked_flags, BlockFlags::WriteError)) pfd.revents |= POLLERR; - if (has_flag(fds_entry.unblocked_flags, BlockFlags::WriteHangUp)) - pfd.revents |= POLLHUP; if (!fds_entry.description) pfd.revents |= POLLNVAL; } else { @@ -112,7 +112,7 @@ ErrorOr Process::sys$poll(Userspace use VERIFY(pfd.events & POLLPRI); pfd.revents |= POLLPRI; } - if (has_flag(fds_entry.unblocked_flags, BlockFlags::Write)) { + if (!has_flag(fds_entry.unblocked_flags, BlockFlags::WriteHangUp) && has_flag(fds_entry.unblocked_flags, BlockFlags::Write)) { VERIFY(pfd.events & POLLOUT); pfd.revents |= POLLOUT; } -- cgit v1.2.3