kevy-uring
Pure-Rust io_uring bindings against
the Linux kernel ABI. A completion-based engine: submit reads / writes /
accepts into a shared submission queue (SQ), then reap their results from
the completion queue (CQ) — batching many operations into one
io_uring_enter syscall.
io_uring_setup/io_uring_enter/io_uring_registerissued as raw syscalls. NoliburingC dependency, nolibccrate, no third-party Rust dependency.- SQ / CQ / SQE regions
mmap'd and driven through the documented head/tail cursors, with the appropriate Acquire / Release fences against the kernel-side updates. - Multishot
recv+ provided-buffer ring (kernel 5.19+) supported, the same primitives a thread-per-core reactor needs. - Linux-only: on every other target the crate compiles to an empty
module that any caller can
cfg-gate.
use Write;
use TcpListener;
use AsRawFd;
use IoUring;
let listener = bind?;
let mut ring = new?;
assert!;
ring.submit_and_wait?;
ring.for_each_completion;
# Ok::
Why a separate crate
Carved out of kevy-sys so the
engine can be reused independently of kevy's network internals (sockets,
readiness pollers). The bindings are generic Linux infrastructure;
nothing here is specific to kevy's command surface.
Part of the kevy key–value server.
Safety
The shared ring cursors are accessed as AtomicU32 over the mmap'd
memory (the kernel is the other party): the producer publishes the SQ
tail with Release and reads the SQ head with Acquire; the consumer
reads the CQ tail with Acquire and publishes the CQ head with
Release. IoUring owns its ring fd and three mappings, freed on drop.
unsafe is confined to the FFI module's extern "C" declarations and
the wrappers that read / write through the mmap'd ring memory. Every
unsafe block carries a SAFETY: comment naming the kernel invariant
it relies on.
License
Licensed under either of MIT or Apache-2.0 at your option.