eve.backend.posix.poll

POSIX Layer 0 fallback backend built on poll.

This backend replaces select as the portable POSIX fallback. It uses the poll() system call which has no FD_SETSIZE limit, supports arbitrary file descriptors, and provides a cleaner pollfd array API while keeping the same O(n) scaling characteristics as select.

poll cannot reliably distinguish hangup from error on all platforms, so hangup-only registrations are mapped to POLLHUP where available and reported as IoReady.hangup.

Types 3

private structRegistration
Fields
IoInterest interest
ulong userData
bool active

Native event type returned by the poll backend.

Like select, poll does not produce a kernel-owned event payload, so the backend materializes a small translated record directly.

Fields
Handle handleHandle that became ready.
ulong userDataOpaque user value supplied at registration time.
IoReady readyShared readiness flags observed for the handle.
structOsPoller

poll-backed poller state.

Fields
private Registration[maxRegistrations] _registrations
private uint _count
private bool _valid
Methods
OsPoller create() static @safe nothrow @nogcCreate a new `poll` poller.
bool isValid() @property const pure @safe nothrow @nogcCheck whether the poller instance is still usable.
Handle handle() @property const pure @safe nothrow @nogcReturn the native handle wrapper for this poller.
BackendId backendId() @property const pure @safe nothrow @nogcReturn the identifier of this backend.
BackendCapabilities capabilities() @property const pure @safe nothrow @nogcReturn the capability flags for this backend.
int dispose() @safe nothrow @nogcDispose the poller and drop all registrations.
int registerHandle(Handle handle, IoInterest interest, ulong userData, WatcherFlags flags = WatcherFlags.none) @safe nothrow @nogcRegister a handle with the given interests and opaque user data.
int modifyHandle(Handle handle, IoInterest interest, ulong userData, WatcherFlags flags = WatcherFlags.none) @safe nothrow @nogcModify the interest mask and user data for an already-registered handle.
int unregisterHandle(Handle handle) @safe nothrow @nogcRemove a handle from the registration table.
int wait(scope NativeEvent[] nativeEvents, int timeoutMs) @trusted nothrow @nogcWait for native events.
OsEvent translate(ref const(NativeEvent) nativeEvent) static pure @safe nothrow @nogcTranslate a native `poll` event into the shared Layer 0 event shape.
IoReady translateReady(IoReady nativeReady) static pure @safe nothrow @nogcTranslate native readiness into shared readiness flags.

Functions 2

private fnshort toPollEvents(IoInterest interest) pure @safe nothrow @nogc
private fnIoReady fromPollRevents(short revents, IoInterest interest) pure @safe nothrow @nogc

Variables 1

private enumvarmaxRegistrations = 4096