1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

AK+Kernel: Implement and use EnumBits has_any_flag()

This duplicates the old functionality of has_flag and will return true
when any flags present in the mask are also in the value.
This commit is contained in:
Timothy 2021-07-14 21:59:22 +10:00 committed by Andreas Kling
parent 371911b1b5
commit 9715311837
3 changed files with 9 additions and 3 deletions

View file

@ -112,7 +112,7 @@ KResultOr<FlatPtr> Process::sys$select(Userspace<const Syscall::SC_select_params
FD_SET(selected_fds[i], &fds_write);
marked_fd_count++;
}
if (params.exceptfds && has_flag(fd_entry.unblocked_flags, BlockFlags::Exception)) {
if (params.exceptfds && has_any_flag(fd_entry.unblocked_flags, BlockFlags::Exception)) {
FD_SET(selected_fds[i], &fds_except);
marked_fd_count++;
}
@ -207,7 +207,7 @@ KResultOr<FlatPtr> Process::sys$poll(Userspace<const Syscall::SC_poll_params*> u
if (fds_entry.unblocked_flags == BlockFlags::None)
continue;
if (has_flag(fds_entry.unblocked_flags, BlockFlags::Exception)) {
if (has_any_flag(fds_entry.unblocked_flags, BlockFlags::Exception)) {
if (has_flag(fds_entry.unblocked_flags, BlockFlags::ReadHangUp))
pfd.revents |= POLLRDHUP;
if (has_flag(fds_entry.unblocked_flags, BlockFlags::WriteError))