[][src]Struct io_uring::Submitter

pub struct Submitter<'a> { /* fields omitted */ }

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.

Implementations

impl<'a> Submitter<'a>[src]

pub unsafe fn enter<T: Sized>(
    &self,
    to_submit: u32,
    min_complete: u32,
    flag: u32,
    arg: Option<&T>
) -> Result<usize>
[src]

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.

Safety

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

pub fn submit(&self) -> Result<usize>[src]

Submit all queued submission queue events to the kernel.

pub fn submit_and_wait(&self, want: usize) -> Result<usize>[src]

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

pub fn submit_with_args(
    &self,
    want: usize,
    args: &Args<'_, '_>
) -> Result<usize>
[src]

pub fn squeue_wait(&self) -> Result<usize>[src]

Wait for the submission queue to have free entries.

Requires the unstable feature.

pub fn register_buffers(&self, bufs: &[iovec]) -> Result<()>[src]

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

pub fn register_files(&self, fds: &[RawFd]) -> Result<()>[src]

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.

pub fn register_files_update(&self, offset: u32, fds: &[RawFd]) -> Result<usize>[src]

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.

pub fn register_eventfd(&self, eventfd: RawFd) -> Result<()>[src]

Register an eventfd created by eventfd with the io_uring instance.

pub fn register_eventfd_async(&self, eventfd: RawFd) -> Result<()>[src]

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.

pub fn register_probe(&self, probe: &mut Probe) -> Result<()>[src]

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

Examples

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!");
}

pub fn register_personality(&self) -> Result<i32>[src]

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 (although this library does not currently support that).

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.

pub fn unregister_buffers(&self) -> Result<()>[src]

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.

pub fn unregister_files(&self) -> Result<()>[src]

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.

pub fn unregister_eventfd(&self) -> Result<()>[src]

Unregister an eventfd file descriptor to stop notifications.

pub fn unregister_personality(&self, id: i32) -> Result<()>[src]

Unregister a previously registered personality.

pub fn register_restrictions(&self, res: &mut [Restriction]) -> Result<()>[src]

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.

Requires the unstable feature.

pub fn register_enable_rings(&self) -> Result<()>[src]

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

Requires the unstable feature.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Submitter<'a>[src]

impl<'a> !Send for Submitter<'a>[src]

impl<'a> !Sync for Submitter<'a>[src]

impl<'a> Unpin for Submitter<'a>[src]

impl<'a> UnwindSafe for Submitter<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.