RegisterOpCode

io_uring_register(2) opcodes and arguments

Values

ValueMeaning
REGISTER_BUFFERS0

arg points to a struct iovec array of nr_args entries. The buffers associated with the iovecs will be locked in memory and charged against the user's RLIMIT_MEMLOCK resource limit. See getrlimit(2) for more informa‐ tion. Additionally, there is a size limit of 1GiB per buffer. Currently, the buffers must be anonymous, non-file-backed memory, such as that returned by malloc(3) or mmap(2) with the MAP_ANONYMOUS flag set. It is expected that this limitation will be lifted in the future. Huge pages are supported as well. Note that the entire huge page will be pinned in the kernel, even if only a portion of it is used.

After a successful call, the supplied buffers are mapped into the kernel and eligible for I/O. To make use of them, the application must specify the IORING_OP_READ_FIXED or IORING_OP_WRITE_FIXED opcodes in the submis‐ sion queue entry (see the struct io_uring_sqe definition in io_uring_enter(2)), and set the buf_index field to the desired buffer index. The memory range described by the submission queue entry's addr and len fields must fall within the indexed buffer.

It is perfectly valid to setup a large buffer and then only use part of it for an I/O, as long as the range is within the originally mapped region.

An application can increase or decrease the size or number of registered buffers by first unregistering the existing buffers, and then issuing a new call to io_uring_register() with the new buffers.

An application need not unregister buffers explicitly before shutting down the io_uring instance.

IORING_REGISTER_BUFFERS

UNREGISTER_BUFFERS1

This operation takes no argument, and arg must be passed as NULL. All previously registered buffers associated with the io_uring instance will be released.

IORING_UNREGISTER_BUFFERS

REGISTER_FILES2

Register files for I/O. arg contains a pointer to an array of nr_args file descriptors (signed 32 bit integers).

To make use of the registered files, the IOSQE_FIXED_FILE flag must be set in the flags member of the struct io_uring_sqe, and the fd member is set to the index of the file in the file descriptor array.

Files are automatically unregistered when the io_uring instance is torn down. An application need only unregister if it wishes to register a new set of fds.

IORING_REGISTER_FILES

UNREGISTER_FILES3

This operation requires no argument, and arg must be passed as NULL. All previously registered files associated with the io_uring instance will be unregistered.

IORING_UNREGISTER_FILES

REGISTER_EVENTFD4

IORING_REGISTER_EVENTFD

Registers eventfd that would be used to notify about completions on io_uring itself.

Note: available from Linux 5.2

UNREGISTER_EVENTFD5

IORING_UNREGISTER_EVENTFD

Unregisters previously registered eventfd.

Note: available from Linux 5.2

REGISTER_FILES_UPDATE6

IORING_REGISTER_FILES_UPDATE (from Linux 5.5)

Meta