Struct io_uring::Submitter

source ·
pub struct Submitter<'a> { /* private fields */ }
Expand description

Interface for submitting submission queue events in an io_uring instance to the kernel for executing and registering files or buffers with the instance.

io_uring supports both directly performing I/O on buffers and file descriptors and registering them beforehand. Registering is slow, but it makes performing the actual I/O much faster.


Initiate and/or complete asynchronous I/O. This is a low-level wrapper around io_uring_enter - see man io_uring_enter (or its online version for more details.

You will probably want to use a more high-level API such as submit or submit_and_wait.


This provides a raw interface so developer must ensure that parameters are correct.

Submit all queued submission queue events to the kernel.

Submit all queued submission queue events to the kernel and wait for at least want completion events to complete.

Wait for the submission queue to have free entries.

Register in-memory user buffers for I/O with the kernel. You can use these buffers with the ReadFixed and WriteFixed operations.

Registers an empty file table of nr_files number of file descriptors. The sparse variant is available in kernels 5.19 and later.

Registering a file table is a prerequisite for using any request that uses direct descriptors.

Register files for I/O. You can use the registered files with Fixed.

Each fd may be -1, in which case it is considered “sparse”, and can be filled in later with register_files_update.

Note that this will wait for the ring to idle; it will only return once all active requests are complete. Use register_files_update to avoid this.

This operation replaces existing files in the registered file set with new ones, either turning a sparse entry (one where fd is equal to -1) into a real one, removing an existing entry (new one is set to -1), or replacing an existing entry with a new existing entry. The offset parameter specifies the offset into the list of registered files at which to start updating files.

You can also perform this asynchronously with the FilesUpdate opcode.

Register an eventfd created by eventfd with the io_uring instance.

This works just like register_eventfd, except notifications are only posted for events that complete in an async manner, so requests that complete immediately will not cause a notification.

Fill in the given Probe with information about the opcodes supported by io_uring on the running kernel.

let io_uring = io_uring::IoUring::new(1)?;
let mut probe = io_uring::Probe::new();
io_uring.submitter().register_probe(&mut probe)?;

if probe.is_supported(io_uring::opcode::Read::CODE) {
    println!("Reading is supported!");

Register credentials of the running application with io_uring, and get an id associated with these credentials. This ID can then be passed into submission queue entries to issue the request with this process’ credentials.

By default, if Parameters::is_feature_cur_personality is set then requests will use the credentials of the task that called Submitter::enter, otherwise they will use the credentials of the task that originally registered the io_uring.

Unregister all previously registered buffers.

You do not need to explicitly call this before dropping the IoUring, as it will be cleaned up by the kernel automatically.

Unregister all previously registered files.

You do not need to explicitly call this before dropping the IoUring, as it will be cleaned up by the kernel automatically.

Unregister an eventfd file descriptor to stop notifications.

Unregister a previously registered personality.

Permanently install a feature allowlist. Once this has been called, attempting to perform an operation not on the allowlist will fail with -EACCES.

This can only be called once, to prevent untrusted code from removing restrictions.

Enable the rings of the io_uring instance if they have been disabled with setup_r_disabled.

Get and/or set the limit for number of io_uring worker threads per NUMA node. max[0] holds the limit for bounded workers, which process I/O operations expected to be bound in time, that is I/O on regular files or block devices. While max[1] holds the limit for unbounded workers, which carry out I/O operations that can never complete, for instance I/O on sockets. Passing 0 does not change the current limit. Returns previous limits on success.

Register buffer ring for provided buffers.

Details can be found in the io_uring_register_buf_ring.3 man page.

If the register command is not supported, or the ring_entries value exceeds 32768, the InvalidInput error is returned.

Available since 5.19.

Unregister a previously registered buffer ring.

Available since 5.19.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.