io_uring_enter

Initiate and/or complete asynchronous I/O

io_uring_enter() is used to initiate and complete I/O using the shared submission and completion queues setup by a call to io_uring_setup(2). A single call can both submit new I/O and wait for completions of I/O initiated by this call or previous calls to io_uring_enter()`.

When the system call returns that a certain amount of SQEs have been consumed and submitted, it's safe to reuse SQE entries in the ring. This is true even if the actual IO submission had to be punted to async context, which means that the SQE may in fact not have been submitted yet. If the kernel requires later use of a particular SQE entry, it will have made a private copy of it.

Note: For interrupt driven I/O (where IORING_SETUP_IOPOLL was not specified in the call to io_uring_setup(2)), an application may check the completion queue for event completions without entering the kernel at all.

version(linux)
@nogc
int
io_uring_enter
(
int fd
,,,,
const sigset_t* sig = null
)

Parameters

fd int

the file descriptor returned by io_uring_setup(2).

to_submit uint

specifies the number of I/Os to submit from the submission queue.

min_complete uint

If the IORING_ENTER_GETEVENTS bit is set in flags, then the system call will attempt to wait for min_complete event completions before returning. If the io_uring instance was configured for polling, by specifying IORING_SETUP_IOPOLL in the call to io_uring_setup(2), then min_complete has a slightly different meaning. Passing a value of 0 instructs the kernel to return any events which are already complete, without blocking. If min_complete is a non-zero value, the kernel will still return immediately if any completion events are available. If no event completions are available, then the call will poll either until one or more completions become available, or until the process has exceeded its scheduler time slice.

flags EnterFlags

Behavior modification flags - EnterFlags

sig sigset_t*

a pointer to a signal mask (see sigprocmask(2)); if sig is not null, io_uring_enter() first replaces the current signal mask by the one pointed to by sig, then waits for events to become available in the completion queue, and then restores the original signal mask. The following io_uring_enter() call:

Return Value

Type: int

See Also

io_uring_enter(2)

Meta