9#ifndef EPOLL_SYSCALLS_H
10#define EPOLL_SYSCALLS_H
12#include "pedigree/kernel/compiler.h"
13#include "pedigree/kernel/process/Readiness.h"
14#include "pedigree/kernel/processor/types.h"
22static_assert(
sizeof(
LinuxEpollEvent) == 12,
"Linux x86-64 epoll_event must be packed");
25constexpr uint32_t In = 0x00000001U;
26constexpr uint32_t Priority = 0x00000002U;
27constexpr uint32_t Out = 0x00000004U;
28constexpr uint32_t Error = 0x00000008U;
29constexpr uint32_t Hangup = 0x00000010U;
30constexpr uint32_t Invalid = 0x00000020U;
31constexpr uint32_t ReadNormal = 0x00000040U;
32constexpr uint32_t ReadBand = 0x00000080U;
33constexpr uint32_t WriteNormal = 0x00000100U;
34constexpr uint32_t WriteBand = 0x00000200U;
35constexpr uint32_t Message = 0x00000400U;
36constexpr uint32_t ReadHangup = 0x00002000U;
37constexpr uint32_t Exclusive = 1U << 28;
38constexpr uint32_t Wakeup = 1U << 29;
39constexpr uint32_t OneShot = 1U << 30;
40constexpr uint32_t EdgeTriggered = 1U << 31;
42constexpr int ControlAdd = 1;
43constexpr int ControlDelete = 2;
44constexpr int ControlModify = 3;
48constexpr int CloseOnExec = 0x00080000;
64 int wait(
LinuxEpollEvent* events,
int maxEvents,
int timeoutMilliseconds);
67 ReadyMask queryReady();
75 int collectEvents(
LinuxEpollEvent* events,
int maxEvents,
bool consumeOneShot);
77 void sourceReadinessChanged(ReadyMask mask);
82int posix_epoll_create1(
int flags);
83int posix_epoll_create(
int size);
84int posix_epoll_ctl(
int epollFd,
int operation,
int targetFd,
const LinuxEpollEvent* event);
85int posix_epoll_wait(
int epollFd,
LinuxEpollEvent* events,
int maxEvents,
int timeoutMilliseconds);
86int posix_epoll_pwait(
int epollFd,
LinuxEpollEvent* events,
int maxEvents,
int timeoutMilliseconds,
87 const void* signalMask,
size_t signalMaskSize);