1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 14:07:45 +00:00

Kernel: Add support for the POLLWRBAND poll event

This commit is contained in:
Idan Horowitz 2021-12-02 01:26:08 +02:00 committed by Andreas Kling
parent f2fef049e1
commit 265764ff2f
3 changed files with 14 additions and 6 deletions

View file

@ -20,6 +20,7 @@ extern "C" {
#define POLLERR (1u << 3) #define POLLERR (1u << 3)
#define POLLHUP (1u << 4) #define POLLHUP (1u << 4)
#define POLLNVAL (1u << 5) #define POLLNVAL (1u << 5)
#define POLLWRBAND (1u << 12)
#define POLLRDHUP (1u << 13) #define POLLRDHUP (1u << 13)
struct pollfd { struct pollfd {

View file

@ -159,6 +159,8 @@ ErrorOr<FlatPtr> Process::sys$poll(Userspace<const Syscall::SC_poll_params*> use
block_flags |= BlockFlags::Write; block_flags |= BlockFlags::Write;
if (pfd.events & POLLPRI) if (pfd.events & POLLPRI)
block_flags |= BlockFlags::ReadPriority; block_flags |= BlockFlags::ReadPriority;
if (pfd.events & POLLWRBAND)
block_flags |= BlockFlags::WritePriority;
TRY(fds_info.try_append({ move(description), block_flags })); TRY(fds_info.try_append({ move(description), block_flags }));
} }
@ -208,6 +210,10 @@ ErrorOr<FlatPtr> Process::sys$poll(Userspace<const Syscall::SC_poll_params*> use
VERIFY(pfd.events & POLLOUT); VERIFY(pfd.events & POLLOUT);
pfd.revents |= POLLOUT; pfd.revents |= POLLOUT;
} }
if (has_flag(fds_entry.unblocked_flags, BlockFlags::WritePriority)) {
VERIFY(pfd.events & POLLWRBAND);
pfd.revents |= POLLWRBAND;
}
} }
if (pfd.revents) if (pfd.revents)
fds_with_revents++; fds_with_revents++;

View file

@ -588,15 +588,16 @@ public:
Read = 1 << 0, Read = 1 << 0,
Write = 1 << 1, Write = 1 << 1,
ReadPriority = 1 << 2, ReadPriority = 1 << 2,
WritePriority = 1 << 3,
Accept = 1 << 3, Accept = 1 << 4,
Connect = 1 << 4, Connect = 1 << 5,
SocketFlags = Accept | Connect, SocketFlags = Accept | Connect,
WriteNotOpen = 1 << 5, WriteNotOpen = 1 << 6,
WriteError = 1 << 6, WriteError = 1 << 7,
WriteHangUp = 1 << 7, WriteHangUp = 1 << 8,
ReadHangUp = 1 << 8, ReadHangUp = 1 << 9,
Exception = WriteNotOpen | WriteError | WriteHangUp | ReadHangUp, Exception = WriteNotOpen | WriteError | WriteHangUp | ReadHangUp,
}; };