mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Stop providing POLLRDHUP events in sys$poll by default
Dr. Posix specifies that only POLLERR, POLLHUP & POLLNVAL are provided by default.
This commit is contained in:
parent
5ca46abb51
commit
e32f6903f6
Notes:
sideshowbarker
2024-07-17 09:32:59 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/e32f6903f6 Pull-request: https://github.com/SerenityOS/serenity/pull/14533 Reviewed-by: https://github.com/linusg ✅
1 changed files with 8 additions and 4 deletions
|
@ -51,7 +51,7 @@ ErrorOr<FlatPtr> Process::sys$poll(Userspace<Syscall::SC_poll_params const*> use
|
|||
for (size_t i = 0; i < params.nfds; i++) {
|
||||
auto& pfd = fds_copy[i];
|
||||
auto description = TRY(fds.open_file_description(pfd.fd));
|
||||
BlockFlags block_flags = BlockFlags::Exception; // always want POLLERR, POLLHUP, POLLNVAL
|
||||
BlockFlags block_flags = BlockFlags::WriteError | BlockFlags::WriteHangUp; // always want POLLERR, POLLHUP, POLLNVAL
|
||||
if (pfd.events & POLLIN)
|
||||
block_flags |= BlockFlags::Read;
|
||||
if (pfd.events & POLLOUT)
|
||||
|
@ -60,6 +60,8 @@ ErrorOr<FlatPtr> Process::sys$poll(Userspace<Syscall::SC_poll_params const*> use
|
|||
block_flags |= BlockFlags::ReadPriority;
|
||||
if (pfd.events & POLLWRBAND)
|
||||
block_flags |= BlockFlags::WritePriority;
|
||||
if (pfd.events & POLLRDHUP)
|
||||
block_flags |= BlockFlags::ReadHangUp;
|
||||
fds_info.unchecked_append({ move(description), block_flags });
|
||||
}
|
||||
return {};
|
||||
|
@ -91,9 +93,7 @@ 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::Exception)) {
|
||||
if (has_flag(fds_entry.unblocked_flags, BlockFlags::ReadHangUp))
|
||||
pfd.revents |= POLLRDHUP;
|
||||
if (has_any_flag(fds_entry.unblocked_flags, BlockFlags::WriteError | BlockFlags::WriteHangUp)) {
|
||||
if (has_flag(fds_entry.unblocked_flags, BlockFlags::WriteError))
|
||||
pfd.revents |= POLLERR;
|
||||
if (has_flag(fds_entry.unblocked_flags, BlockFlags::WriteHangUp))
|
||||
|
@ -115,6 +115,10 @@ ErrorOr<FlatPtr> Process::sys$poll(Userspace<Syscall::SC_poll_params const*> use
|
|||
VERIFY(pfd.events & POLLWRBAND);
|
||||
pfd.revents |= POLLWRBAND;
|
||||
}
|
||||
if (has_flag(fds_entry.unblocked_flags, BlockFlags::ReadHangUp)) {
|
||||
VERIFY(pfd.events & POLLRDHUP);
|
||||
pfd.revents |= POLLRDHUP;
|
||||
}
|
||||
}
|
||||
if (pfd.revents)
|
||||
fds_with_revents++;
|
||||
|
|
Loading…
Reference in a new issue