Function register_files [src]

Registers an array of file descriptors. Every time a file descriptor is put in an SQE and submitted to the kernel, the kernel must retrieve a reference to the file, and once I/O has completed the file reference must be dropped. The atomic nature of this file reference can be a slowdown for high IOPS workloads. This slowdown can be avoided by pre-registering file descriptors. To refer to a registered file descriptor, IOSQE_FIXED_FILE must be set in the SQE's flags, and the SQE's fd must be set to the index of the file descriptor in the registered array. Registering file descriptors will wait for the ring to idle. Files are automatically unregistered by the kernel when the ring is torn down. An application need unregister only if it wants to register a new array of file descriptors.

Prototype

pub fn register_files(self: *IoUring, fds: []const posix.fd_t) !void

Parameters

self: *IoUringfds: []const posix.fd_t

Source

pub fn register_files(self: *IoUring, fds: []const posix.fd_t) !void { assert(self.fd >= 0); const res = linux.io_uring_register( self.fd, .REGISTER_FILES, @as(*const anyopaque, @ptrCast(fds.ptr)), @as(u32, @intCast(fds.len)), ); try handle_registration_result(res); }