logos.std.io.linux.uring
Module std · package logos-std
Types
structIoRing
struct IoRing
Wraps liburing’s struct io_uring in submit-and-wait mode: each op submits one SQE and
blocks until the kernel posts its CQE.
The ring bytes are heap-allocated and non-null once constructed; Drop releases them.
Implements: Drop
Fields
ring: *mut u8
Methods
fn close(self: &mut IoRing, fd: i32) -> Result
Closes file descriptor fd.
fn drop(self: IoRing) -> void
fn new(entries: i32) -> Result
Creates an IoRing with entries SQ/CQ slots.
On kernel init failure returns Errno carrying the negative errno.
fn openat(self: &mut IoRing, dirfd: i32, path: *const u8, flags: i32, mode: i32) -> Result
Opens path relative to dirfd and returns the new fd; AT_FDCWD() (-100) resolves
relative to the cwd.
Common flags (fcntl.h, Linux x86-64): O_RDONLY=0, O_WRONLY=1, O_RDWR=2,
O_CREAT=64, O_TRUNC=512, O_APPEND=1024.
fn read(self: &mut IoRing, fd: i32, buf: *mut u8, len: i64, offset: i64) -> Result
Reads up to len bytes from fd into buf at file offset offset; returns bytes read.
Pass offset = -1 to use the file’s current position.
fn write(self: &mut IoRing, fd: i32, buf: *const u8, len: i64, offset: i64) -> Result
Writes up to len bytes from buf to fd at file offset offset.
Returns the number of bytes written.
enumIoUringError
enum IoUringError
Represents an IoRing failure; one variant per logical failure class.
Variants
Errno(i32)
RingFull
Functions
fnAT_FDCWD
fn AT_FDCWD() -> i32
Returns AT_FDCWD (-100): resolve openat paths relative to the current directory.
fnio_err_errno
fn io_err_errno(e: IoUringError) -> i32
Collapses an IoUringError to a negative-errno i32; RingFull maps to -EAGAIN (-11).
fnO_APPEND
fn O_APPEND() -> i32
Returns the O_APPEND flag (1024): append on every write.
fnO_CREAT
fn O_CREAT() -> i32
Returns the O_CREAT flag (64): create the file if it does not exist.
fnO_NONBLOCK
fn O_NONBLOCK() -> i32
Returns the O_NONBLOCK flag (2048): open in non-blocking mode.
fnO_RDONLY
fn O_RDONLY() -> i32
Returns the O_RDONLY flag (0): open read-only.
fnO_RDWR
fn O_RDWR() -> i32
Returns the O_RDWR flag (2): open read-write.
fnO_TRUNC
fn O_TRUNC() -> i32
Returns the O_TRUNC flag (512): truncate to length 0 on open.
fnO_WRONLY
fn O_WRONLY() -> i32
Returns the O_WRONLY flag (1): open write-only.