eve.backend.linux.uring

Linux runtime-selected Layer 0 backend.

On kernels that allow io_uring, this module exposes a real io_uring-backed readiness poller. When setup is rejected or unavailable it falls back to the reliable epoll backend so higher layers still have a usable Linux path.

Types 2

private enumOperationKind : ubyte
POLL = 1
REMOVE = 2
structOsPoller

Linux Layer 0 poller that prefers io_uring and falls back to epoll when the runtime rejects io_uring setup.

Fields
bool _usingFallback
bool _ioUringAvailable
int _probeError
int _fd
void * _sqRing
void * _cqRing
void * _sqesRegion
size_t _sqRingLength
size_t _cqRingLength
size_t _sqesLength
bool _singleMmap
shared(uint) * _sqHead
shared(uint) * _sqTail
shared(uint) * _sqRingMask
shared(uint) * _sqRingEntries
shared(uint) * _sqArray
io_uring_sqe * _sqes
shared(uint) * _cqHead
shared(uint) * _cqTail
shared(uint) * _cqRingMask
shared(uint) * _cqRingEntries
io_uring_cqe * _cqes
Registration * _registrations
size_t _registrationCapacity
NativeEvent * _pendingEvents
size_t _pendingHead
size_t _pendingCount
ulong _submitSequence
Methods
uint load(shared(uint) * value) @trusted nothrow @nogc
void store(shared(uint) * value, uint payload) @trusted nothrow @nogc
ulong makeOperationId(uint slotIndex, OperationKind kind, ulong sequence) pure @safe nothrow @nogc
OperationKind operationKind(ulong userData) pure @safe nothrow @nogc
uint operationSlot(ulong userData) pure @safe nothrow @nogc
size_t maxSize(size_t left, size_t right) pure @safe nothrow @nogc
size_t pendingIndex(size_t offset) const pure @safe nothrow @nogc
Registration slot(uint index) ref @trusted nothrow @nogc
const(Registration) slot(uint index) ref const @trusted nothrow @nogc
int initializeIoUring() @trusted nothrow @nogc
void cleanupIoUring() @trusted nothrow @nogc
int submit(uint count) @trusted nothrow @nogc
io_uring_sqe * acquireSqe() @trusted nothrow @nogc
int findRegistration(Handle handle) const @safe nothrow @nogc
int findFreeRegistration() const @safe nothrow @nogc
ulong nextOperationId(uint slotIndex, OperationKind kind) @safe nothrow @nogc
int submitPollAdd(uint slotIndex) @trusted nothrow @nogc
int submitPollRemove(ulong targetUserData, ulong userData) @trusted nothrow @nogc
bool queueEvent(NativeEvent event) @trusted nothrow @nogc
int flushPending(scope NativeEvent[] nativeEvents) @trusted nothrow @nogc
int waitForRing(int timeoutMs) @trusted nothrow @nogc
size_t activeRegistrationCount() const @safe nothrow @nogc
bool processCompletion(ref const(io_uring_cqe) cqe, scope NativeEvent[] output, ref int written, ulong awaitedUserData, ref int awaitedResult) @trusted nothrow @nogc
bool drainCompletions(scope NativeEvent[] output, ref int written, ulong awaitedUserData, ref int awaitedResult) @trusted nothrow @nogc
int waitForOperation(ulong awaitedUserData) @trusted nothrow @nogc
OsPoller create() @trusted nothrow @nogcCreate a new Linux poller.
bool isValid() @property const pure @safe nothrow @nogcCheck whether the active backend was created successfully.
bool ioUringAvailable() @property const pure @safe nothrow @nogcReport whether `io_uring` is active for this poller instance.
bool usingFallback() @property const pure @safe nothrow @nogcReport whether this poller instance is using the `epoll` fallback path.
int probeError() @property const pure @safe nothrow @nogcReturn the last `io_uring` setup error.
Handle handle() @property const pure @safe nothrow @nogcReturn the native handle wrapper for the active backend.
int dispose() @trusted nothrow @nogcDispose the active backend state.
int registerHandle(Handle handle, IoInterest interest, ulong userData) @trusted nothrow @nogcRegister a handle with the active backend.
int modifyHandle(Handle handle, IoInterest interest, ulong userData) @trusted nothrow @nogcModify the interest mask and user data for a registered handle.
int unregisterHandle(Handle handle) @trusted nothrow @nogcRemove a handle from the active backend.
int wait(scope NativeEvent[] nativeEvents, int timeoutMs) @trusted nothrow @nogcWait for native events from the active backend.
OsEvent translate(ref const(NativeEvent) nativeEvent) pure @safe nothrow @nogcTranslate a native backend event into the shared Layer 0 event shape.
IoReady translateReady(uint nativeMask) pure @safe nothrow @nogcTranslate a native readiness mask into shared readiness flags.
Nested Templates
Registration

Functions 3

private fnushort toNativeMask(IoInterest interest) pure @safe nothrow @nogc
private fnuint nativeMaskFromResult(int result) pure @safe nothrow @nogc
private fnint probeIoUringSupport() @trusted nothrow @nogc

Variables 1

private enumvarrequestedRingEntries = 1024u