diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-07-10 00:29:59 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-10 14:24:34 +0200 |
commit | 68980bf71175a47bbf8b22b8cea04a84527ae531 (patch) | |
tree | 364e6f4a0cd8ba0b6e0ebb717b1b897c6f7ef900 /Kernel/Syscalls/poll.cpp | |
parent | 08e88bfcad0145d31e30daab8cab9b96eeec7d99 (diff) | |
download | serenity-68980bf71175a47bbf8b22b8cea04a84527ae531.zip |
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.
Diffstat (limited to 'Kernel/Syscalls/poll.cpp')
-rw-r--r-- | Kernel/Syscalls/poll.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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<FlatPtr> Process::sys$poll(Userspace<Syscall::SC_poll_params const*> 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<FlatPtr> Process::sys$poll(Userspace<Syscall::SC_poll_params const*> 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; } |