Class LibURing
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
static void
io_uring_buf_ring_add
(IOURingBufRing br, ByteBuffer addr, short bid, int mask, int buf_offset) static void
io_uring_buf_ring_advance
(IOURingBufRing br, int count) static void
io_uring_buf_ring_cq_advance
(IOURing ring, IOURingBufRing br, int count) static void
static int
io_uring_buf_ring_mask
(int ring_entries) Return the appropriate mask for a buffer ring of sizering_entries
static boolean
io_uring_check_version
(int major, int minor) static int
static boolean
Returns true if theeventfd
notification is currently enabled.static int
io_uring_cq_eventfd_toggle
(IOURing ring, boolean enabled) Toggleeventfd
notification on or off, if aneventfd
is registered with the ring.static boolean
Returns true if there are overflow entries waiting to be flushed onto the CQ ringstatic int
io_uring_cq_ready
(IOURing ring) Retuns the number of unconsumed entries that are ready belonging to thering
param.static long
Returns theuser_data
with the completion queue entrycqe
.static long
Seesqe_set_data64
.static void
io_uring_cqe_seen
(IOURing ring, IOURingCQE cqe) Marks the IO completioncqe
belonging to thering
param as processed.static int
io_uring_enable_rings
(IOURing ring) static int
io_uring_enter
(int fd, int to_submit, int min_complete, int flags, long sig) Seeenter
.static int
io_uring_enter2
(int fd, int to_submit, int min_complete, int flags, long sig, long sz) Seeenter2
.static int
io_uring_free_buf_ring
(IOURing ring, IOURingBufRing br, int nentries, int bgid) static void
io_uring_free_probe
(IOURingProbe probe) Frees theprobe
instance allocated with theget_probe
function.static int
io_uring_get_events
(IOURing ring) Runs outstanding work and flushes completion events to the CQE ring.static IOURingProbe
Returns an allocatedio_uring_probe
structure to the caller.static IOURingProbe
Return an allocatedio_uring_probe
structure, orNULL
if probe fails (for example, if it is not available).static IOURingSQE
io_uring_get_sqe
(IOURing ring) Gets the next available submission queue entry from the submission queue belonging to thering
param.static int
static int
static int
io_uring_mlock_size
(int entries, int flags) Return requiredulimit -l
memory space for a given ring setup.static int
io_uring_mlock_size_params
(int entries, IOURingParams p) Returns the requiredulimit -l memlock
memory required for a given ring setup, in bytes.static int
io_uring_opcode_supported
(IOURingProbe p, int op) Allows the caller to determine if the passed inopcode
belonging to theprobe
param is supported.static int
io_uring_peek_batch_cqe
(IOURing ring, org.lwjgl.PointerBuffer cqes) Fill in an array of IO completions up to count, if any are available.static int
io_uring_peek_cqe
(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr) Returns an IO completion, if one is readily available.static void
io_uring_prep_accept
(IOURingSQE sqe, int fd, Sockaddr addr, IntBuffer addrlen, int flags) static void
io_uring_prep_accept_direct
(IOURingSQE sqe, int fd, Sockaddr addr, IntBuffer addrlen, int flags, int file_index) static void
io_uring_prep_cancel
(IOURingSQE sqe, long user_data, int flags) static void
io_uring_prep_cancel_fd
(IOURingSQE sqe, int fd, int flags) static void
io_uring_prep_cancel64
(IOURingSQE sqe, long user_data, int flags) static void
io_uring_prep_close
(IOURingSQE sqe, int fd) static void
io_uring_prep_close_direct
(IOURingSQE sqe, int file_index) static void
io_uring_prep_connect
(IOURingSQE sqe, int fd, Sockaddr addr, int addrlen) static void
io_uring_prep_epoll_ctl
(IOURingSQE sqe, int epfd, int fd, int op, EpollEvent ev) static void
io_uring_prep_fadvise
(IOURingSQE sqe, int fd, int offset, long len, int advice) static void
io_uring_prep_fallocate
(IOURingSQE sqe, int fd, int mode, long offset, long len) static void
io_uring_prep_fgetxattr
(IOURingSQE sqe, int fd, CharSequence name, ByteBuffer value) static void
io_uring_prep_fgetxattr
(IOURingSQE sqe, int fd, ByteBuffer name, ByteBuffer value) static void
io_uring_prep_files_update
(IOURingSQE sqe, IntBuffer fds, int offset) static void
io_uring_prep_fsetxattr
(IOURingSQE sqe, int fd, CharSequence name, ByteBuffer value, int flags) static void
io_uring_prep_fsetxattr
(IOURingSQE sqe, int fd, ByteBuffer name, ByteBuffer value, int flags) static void
io_uring_prep_fsync
(IOURingSQE sqe, int fd, int fsync_flags) static void
io_uring_prep_getxattr
(IOURingSQE sqe, CharSequence name, ByteBuffer value, CharSequence path) static void
io_uring_prep_getxattr
(IOURingSQE sqe, ByteBuffer name, ByteBuffer value, ByteBuffer path) static void
io_uring_prep_link
(IOURingSQE sqe, CharSequence oldpath, CharSequence newpath, int flags) static void
io_uring_prep_link
(IOURingSQE sqe, ByteBuffer oldpath, ByteBuffer newpath, int flags) static void
io_uring_prep_link_timeout
(IOURingSQE sqe, KernelTimespec ts, int flags) static void
io_uring_prep_linkat
(IOURingSQE sqe, int olddfd, CharSequence oldpath, int newdfd, CharSequence newpath, int flags) static void
io_uring_prep_linkat
(IOURingSQE sqe, int olddfd, ByteBuffer oldpath, int newdfd, ByteBuffer newpath, int flags) static void
io_uring_prep_madvise
(IOURingSQE sqe, ByteBuffer addr, int advice) static void
io_uring_prep_mkdir
(IOURingSQE sqe, CharSequence path, int mode) static void
io_uring_prep_mkdir
(IOURingSQE sqe, ByteBuffer path, int mode) static void
io_uring_prep_mkdirat
(IOURingSQE sqe, int dfd, CharSequence path, int mode) static void
io_uring_prep_mkdirat
(IOURingSQE sqe, int dfd, ByteBuffer path, int mode) static void
io_uring_prep_msg_ring
(IOURingSQE sqe, int fd, int len, long data, int flags) static void
io_uring_prep_msg_ring_cqe_flags
(IOURingSQE sqe, int fd, int len, long data, int flags, int cqe_flags) static void
io_uring_prep_msg_ring_fd
(IOURingSQE sqe, int fd, int source_fd, int target_fd, long data, int flags) static void
io_uring_prep_msg_ring_fd_alloc
(IOURingSQE sqe, int fd, int source_fd, long data, int flags) static void
io_uring_prep_multishot_accept
(IOURingSQE sqe, int fd, Sockaddr addr, IntBuffer addrlen, int flags) static void
io_uring_prep_multishot_accept_direct
(IOURingSQE sqe, int fd, Sockaddr addr, IntBuffer addrlen, int flags) static void
static void
io_uring_prep_openat
(IOURingSQE sqe, int dfd, CharSequence path, int flags, int mode) static void
io_uring_prep_openat
(IOURingSQE sqe, int dfd, ByteBuffer path, int flags, int mode) static void
io_uring_prep_openat_direct
(IOURingSQE sqe, int dfd, CharSequence path, int flags, int mode, int file_index) static void
io_uring_prep_openat_direct
(IOURingSQE sqe, int dfd, ByteBuffer path, int flags, int mode, int file_index) static void
io_uring_prep_openat2
(IOURingSQE sqe, int dfd, CharSequence path, OpenHow how) static void
io_uring_prep_openat2
(IOURingSQE sqe, int dfd, ByteBuffer path, OpenHow how) static void
io_uring_prep_openat2_direct
(IOURingSQE sqe, int dfd, CharSequence path, OpenHow how, int file_index) open directly into the fixed file tablestatic void
io_uring_prep_openat2_direct
(IOURingSQE sqe, int dfd, ByteBuffer path, OpenHow how, int file_index) open directly into the fixed file tablestatic void
io_uring_prep_poll_add
(IOURingSQE sqe, int fd, int poll_mask) static void
io_uring_prep_poll_multishot
(IOURingSQE sqe, int fd, int poll_mask) static void
io_uring_prep_poll_remove
(IOURingSQE sqe, long user_data) static void
io_uring_prep_poll_update
(IOURingSQE sqe, long old_user_data, long new_user_data, int poll_mask, int flags) static void
io_uring_prep_provide_buffers
(IOURingSQE sqe, ByteBuffer addr, int nr, int bgid, int bid) static void
io_uring_prep_read
(IOURingSQE sqe, int fd, ByteBuffer buf, int offset) Prepares an IO read request.static void
io_uring_prep_read_fixed
(IOURingSQE sqe, int fd, ByteBuffer buf, int offset, int buf_index) Prepares an IO read request with a previously registered IO buffer.static void
io_uring_prep_readv
(IOURingSQE sqe, int fd, IOVec.Buffer iovecs, int offset) Prepares a vectored IO read request.static void
io_uring_prep_readv2
(IOURingSQE sqe, int fd, IOVec.Buffer iovecs, int offset, int flags) Prepares a vectored IO read request.static void
io_uring_prep_recv
(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags) static void
io_uring_prep_recv_multishot
(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags) static void
io_uring_prep_recvmsg
(IOURingSQE sqe, int fd, Msghdr msg, int flags) static void
io_uring_prep_recvmsg_multishot
(IOURingSQE sqe, int fd, Msghdr msg, int flags) static void
io_uring_prep_remove_buffers
(IOURingSQE sqe, int nr, int bgid) static void
io_uring_prep_rename
(IOURingSQE sqe, CharSequence oldpath, CharSequence newpath) static void
io_uring_prep_rename
(IOURingSQE sqe, ByteBuffer oldpath, ByteBuffer newpath) static void
io_uring_prep_renameat
(IOURingSQE sqe, int olddfd, CharSequence oldpath, int newdfd, CharSequence newpath, int flags) static void
io_uring_prep_renameat
(IOURingSQE sqe, int olddfd, ByteBuffer oldpath, int newdfd, ByteBuffer newpath, int flags) static void
io_uring_prep_send
(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags) static void
io_uring_prep_send_set_addr
(IOURingSQE sqe, Sockaddr dest_addr, short addr_len) static void
io_uring_prep_send_zc
(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags, int zc_flags) static void
io_uring_prep_send_zc_fixed
(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags, int zc_flags, int buf_index) static void
io_uring_prep_sendmsg
(IOURingSQE sqe, int fd, Msghdr msg, int flags) static void
io_uring_prep_sendmsg_zc
(IOURingSQE sqe, int fd, Msghdr msg, int flags) static void
io_uring_prep_sendto
(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags, Sockaddr addr, int addrlen) static void
io_uring_prep_setxattr
(IOURingSQE sqe, CharSequence name, ByteBuffer value, CharSequence path, int flags) static void
io_uring_prep_setxattr
(IOURingSQE sqe, ByteBuffer name, ByteBuffer value, ByteBuffer path, int flags) static void
io_uring_prep_shutdown
(IOURingSQE sqe, int fd, int how) static void
io_uring_prep_socket
(IOURingSQE sqe, int domain, int type, int protocol, int flags) static void
io_uring_prep_socket_direct
(IOURingSQE sqe, int domain, int type, int protocol, int file_index, int flags) static void
io_uring_prep_socket_direct_alloc
(IOURingSQE sqe, int domain, int type, int protocol, int flags) static void
io_uring_prep_splice
(IOURingSQE sqe, int fd_in, long off_in, int fd_out, long off_out, int nbytes, int splice_flags) Precondition: Eitherfd_in
orfd_out
must be a pipe.static void
io_uring_prep_statx
(IOURingSQE sqe, int dfd, CharSequence path, int flags, int mask, Statx statxbuf) static void
io_uring_prep_statx
(IOURingSQE sqe, int dfd, ByteBuffer path, int flags, int mask, Statx statxbuf) static void
io_uring_prep_symlink
(IOURingSQE sqe, CharSequence target, CharSequence linkpath) static void
io_uring_prep_symlink
(IOURingSQE sqe, ByteBuffer target, ByteBuffer linkpath) static void
io_uring_prep_symlinkat
(IOURingSQE sqe, CharSequence target, int newdirfd, CharSequence linkpath) static void
io_uring_prep_symlinkat
(IOURingSQE sqe, ByteBuffer target, int newdirfd, ByteBuffer linkpath) static void
io_uring_prep_sync_file_range
(IOURingSQE sqe, int fd, int len, int offset, int flags) static void
io_uring_prep_tee
(IOURingSQE sqe, int fd_in, int fd_out, int nbytes, int splice_flags) static void
io_uring_prep_timeout
(IOURingSQE sqe, KernelTimespec ts, int count, int flags) static void
io_uring_prep_timeout_remove
(IOURingSQE sqe, long user_data, int flags) static void
io_uring_prep_timeout_update
(IOURingSQE sqe, KernelTimespec ts, long user_data, int flags) static void
io_uring_prep_unlink
(IOURingSQE sqe, CharSequence path, int flags) static void
io_uring_prep_unlink
(IOURingSQE sqe, ByteBuffer path, int flags) static void
io_uring_prep_unlinkat
(IOURingSQE sqe, int dfd, CharSequence path, int flags) static void
io_uring_prep_unlinkat
(IOURingSQE sqe, int dfd, ByteBuffer path, int flags) static void
io_uring_prep_write
(IOURingSQE sqe, int fd, ByteBuffer buf, int offset) Prepares an IO write request.static void
io_uring_prep_write_fixed
(IOURingSQE sqe, int fd, ByteBuffer buf, int offset, int buf_index) Prepares an IO write request with a previously registered IO buffer.static void
io_uring_prep_writev
(IOURingSQE sqe, int fd, IOVec.Buffer iovecs, int offset) Prepares a vectored IO write request.static void
io_uring_prep_writev2
(IOURingSQE sqe, int fd, IOVec.Buffer iovecs, int offset, int flags) Prepares a vectored IO write request.static void
io_uring_queue_exit
(IOURing ring) Will release all resources acquired and initialized byqueue_init
.static int
io_uring_queue_init
(int entries, IOURing ring, int flags) Executes thesetup
syscall to initialize the submission and completion queues in the kernel with at leastentries
entries and then maps the resulting file descriptor to memory shared between the application and the kernel.static int
io_uring_queue_init_params
(int entries, IOURing ring, IOURingParams p) static int
io_uring_queue_mmap
(int fd, IOURingParams p, IOURing ring) For users that want to specifysq_thread_cpu
orsq_thread_idle
, this interface is a convenient helper formmap()
ing the rings.static CMsghdr
static CMsghdr
io_uring_recvmsg_cmsg_nexthdr
(IOURingRecvmsgOut o, Msghdr msgh, CMsghdr cmsg) static long
static long
static int
io_uring_recvmsg_payload_length
(IOURingRecvmsgOut o, int buf_len, Msghdr msgh) static IOURingRecvmsgOut
io_uring_recvmsg_validate
(ByteBuffer buf, Msghdr msgh) static int
io_uring_register
(int fd, int opcode, long arg, int nr_args) Seeregister
.static int
io_uring_register_buf_ring
(IOURing ring, IOURingBufReg reg, int flags) Registers a shared buffer ring to be used with provided buffers.static int
io_uring_register_buffers
(IOURing ring, IOVec.Buffer iovecs) Registersnr_iovecs
number of buffers defined by the arrayiovecs
belonging to thering
.static int
io_uring_register_buffers_sparse
(IOURing ring, int nr_iovecs) Registersnr_iovecs
empty buffers belonging to thering
.static int
io_uring_register_buffers_tags
(IOURing ring, IOVec.Buffer iovecs, LongBuffer tags) static int
io_uring_register_buffers_update_tag
(IOURing ring, int off, IOVec.Buffer iovecs, LongBuffer tags) static int
io_uring_register_eventfd
(IOURing ring, int fd) static int
io_uring_register_eventfd_async
(IOURing ring, int fd) static int
io_uring_register_file_alloc_range
(IOURing ring, int off, int len) static int
io_uring_register_files
(IOURing ring, IntBuffer files) Registersnr_files
number of file descriptors defined by the arrayfiles
belonging to thering
for subsequent operations.static int
io_uring_register_files_sparse
(IOURing ring, int nr_files) Registers an empty file table ofnr_files
number of file descriptors.static int
io_uring_register_files_tags
(IOURing ring, IntBuffer files, LongBuffer tags) static int
io_uring_register_files_update
(IOURing ring, int off, IntBuffer files) static int
io_uring_register_files_update_tag
(IOURing ring, int off, IntBuffer files, LongBuffer tags) static int
io_uring_register_iowq_aff
(IOURing ring, long cpusz, long mask) static int
io_uring_register_iowq_max_workers
(IOURing ring, IntBuffer values) static int
static int
io_uring_register_probe
(IOURing ring, IOURingProbe p, int nr) static int
static int
Registers the file descriptor of the ring.static int
static int
Ensure that themmap
'ed rings aren't available to a child after afork(2)
.static int
io_uring_setup
(int entries, IOURingParams p) Seesetup
.static IOURingBufRing
io_uring_setup_buf_ring
(IOURing ring, int nentries, int bgid, int flags, IntBuffer ret) static int
io_uring_sq_ready
(IOURing ring) Returns the number of unconsumed (ifSQPOLL
) or unsubmitted entries that exist in the SQ ring belonging to thering
param.static int
Returns how much space is left in the SQ ring belonging to thering
param.static void
io_uring_sqe_set_data
(IOURingSQE sqe, long data) Stores auser_data
pointer with the submission queue entrysqe
.static void
io_uring_sqe_set_data64
(IOURingSQE sqe, long data) Assign a 64-bit value to thissqe
, which can get retrieved at completion time withcqe_get_data64
.static void
io_uring_sqe_set_flags
(IOURingSQE sqe, int flags) Allows the caller to change the behavior of the submission queue entry by specifying flags.static int
io_uring_sqring_wait
(IOURing ring) Allows the caller to wait for space to free up in the SQ ring belonging to thering
param, which happens when the kernel side thread has consumed one or more entries.static int
io_uring_submit
(IOURing ring) Submits the next events to the submission queue belonging to thering
.static int
Submits the next events to the submission queue as withsubmit
.static int
io_uring_submit_and_wait
(IOURing ring, int wait_nr) Submits the next events to the submission queue belonging to thering
and waits forwait_nr
completion events.static int
io_uring_submit_and_wait_timeout
(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr, KernelTimespec ts, long sigmask) Submits the next events to the submission queue belonging to thering
and waits forwait_nr
completion events or until the timeoutts
expires.The completion events are stored in thecqe_ptr
array.static int
io_uring_unregister_buf_ring
(IOURing ring, int bgid) Function unregisters a previously registered shared buffer ring indicated bybgid
.static int
Unregisters the fixed buffers previously registered to thering
.static int
static int
static int
static int
io_uring_unregister_personality
(IOURing ring, int id) static int
Unregisters the file descriptor of the ring.static int
io_uring_wait_cqe
(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr) Returns an IO completion from the queue belonging to thering
param, waiting for it if necessary.static int
io_uring_wait_cqe_nr
(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr) Returnswait_nr
IO completion events from the queue belonging to thering
param, waiting for it if necessary.static int
io_uring_wait_cqe_timeout
(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr, KernelTimespec ts) Returns one IO completion from the queue belonging to thering
param, waiting for it if necessary or until the timeoutts
expires.static int
io_uring_wait_cqes
(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr, KernelTimespec ts, long sigmask) Returnswait_nr
IO completions from the queue belonging to thering
param, waiting for it if necessary or until the timeoutts
expires.static int
n__io_uring_sqring_wait
(long ring) static void
nio_uring_buf_ring_advance
(long br, int count) static void
nio_uring_buf_ring_cq_advance
(long ring, long br, int count) static int
nio_uring_close_ring_fd
(long ring) static boolean
nio_uring_cq_eventfd_enabled
(long ring) Unsafe version of:cq_eventfd_enabled
static int
nio_uring_cq_eventfd_toggle
(long ring, boolean enabled) Unsafe version of:cq_eventfd_toggle
static boolean
nio_uring_cq_has_overflow
(long ring) Unsafe version of:cq_has_overflow
static int
nio_uring_cq_ready
(long ring) Unsafe version of:cq_ready
static long
nio_uring_cqe_get_data
(long cqe) Unsafe version of:cqe_get_data
static long
nio_uring_cqe_get_data64
(long cqe) Unsafe version of:cqe_get_data64
static void
nio_uring_cqe_seen
(long ring, long cqe) Unsafe version of:cqe_seen
static int
nio_uring_enable_rings
(long ring) static int
nio_uring_enter
(int fd, int to_submit, int min_complete, int flags, long sig) Unsafe version of:enter
static int
nio_uring_enter2
(int fd, int to_submit, int min_complete, int flags, long sig, long sz) Unsafe version of:enter2
static int
nio_uring_free_buf_ring
(long ring, long br, int nentries, int bgid) static void
nio_uring_free_probe
(long probe) Unsafe version of:free_probe
static int
nio_uring_get_events
(long ring) Unsafe version of:get_events
static long
Unsafe version of:get_probe
static long
nio_uring_get_probe_ring
(long ring) Unsafe version of:get_probe_ring
static long
nio_uring_get_sqe
(long ring) Unsafe version of:get_sqe
static int
nio_uring_mlock_size_params
(int entries, long p) Unsafe version of:mlock_size_params
static int
nio_uring_opcode_supported
(long p, int op) Unsafe version of:opcode_supported
static int
nio_uring_peek_batch_cqe
(long ring, long cqes, int count) Unsafe version of:peek_batch_cqe
static int
nio_uring_peek_cqe
(long ring, long cqe_ptr) Unsafe version of:peek_cqe
static void
nio_uring_prep_accept
(long sqe, int fd, long addr, long addrlen, int flags) static void
nio_uring_prep_accept_direct
(long sqe, int fd, long addr, long addrlen, int flags, int file_index) static void
nio_uring_prep_cancel
(long sqe, long user_data, int flags) static void
nio_uring_prep_cancel_fd
(long sqe, int fd, int flags) static void
nio_uring_prep_cancel64
(long sqe, long user_data, int flags) static void
nio_uring_prep_close
(long sqe, int fd) static void
nio_uring_prep_close_direct
(long sqe, int file_index) static void
nio_uring_prep_connect
(long sqe, int fd, long addr, int addrlen) static void
nio_uring_prep_epoll_ctl
(long sqe, int epfd, int fd, int op, long ev) static void
nio_uring_prep_fadvise
(long sqe, int fd, int offset, long len, int advice) static void
nio_uring_prep_fallocate
(long sqe, int fd, int mode, long offset, long len) static void
nio_uring_prep_fgetxattr
(long sqe, int fd, long name, long value, int len) static void
nio_uring_prep_files_update
(long sqe, long fds, int nr_fds, int offset) static void
nio_uring_prep_fsetxattr
(long sqe, int fd, long name, long value, int flags, int len) static void
nio_uring_prep_fsync
(long sqe, int fd, int fsync_flags) static void
nio_uring_prep_getxattr
(long sqe, long name, long value, long path, int len) static void
nio_uring_prep_link
(long sqe, long oldpath, long newpath, int flags) static void
nio_uring_prep_link_timeout
(long sqe, long ts, int flags) static void
nio_uring_prep_linkat
(long sqe, int olddfd, long oldpath, int newdfd, long newpath, int flags) static void
nio_uring_prep_madvise
(long sqe, long addr, long length, int advice) static void
nio_uring_prep_mkdir
(long sqe, long path, int mode) static void
nio_uring_prep_mkdirat
(long sqe, int dfd, long path, int mode) static void
nio_uring_prep_msg_ring
(long sqe, int fd, int len, long data, int flags) static void
nio_uring_prep_msg_ring_cqe_flags
(long sqe, int fd, int len, long data, int flags, int cqe_flags) static void
nio_uring_prep_msg_ring_fd
(long sqe, int fd, int source_fd, int target_fd, long data, int flags) static void
nio_uring_prep_msg_ring_fd_alloc
(long sqe, int fd, int source_fd, long data, int flags) static void
nio_uring_prep_multishot_accept
(long sqe, int fd, long addr, long addrlen, int flags) static void
nio_uring_prep_multishot_accept_direct
(long sqe, int fd, long addr, long addrlen, int flags) static void
nio_uring_prep_nop
(long sqe) static void
nio_uring_prep_openat
(long sqe, int dfd, long path, int flags, int mode) static void
nio_uring_prep_openat_direct
(long sqe, int dfd, long path, int flags, int mode, int file_index) static void
nio_uring_prep_openat2
(long sqe, int dfd, long path, long how) static void
nio_uring_prep_openat2_direct
(long sqe, int dfd, long path, long how, int file_index) Unsafe version of:prep_openat2_direct
static void
nio_uring_prep_poll_add
(long sqe, int fd, int poll_mask) static void
nio_uring_prep_poll_multishot
(long sqe, int fd, int poll_mask) static void
nio_uring_prep_poll_remove
(long sqe, long user_data) static void
nio_uring_prep_poll_update
(long sqe, long old_user_data, long new_user_data, int poll_mask, int flags) static void
nio_uring_prep_provide_buffers
(long sqe, long addr, int len, int nr, int bgid, int bid) static void
nio_uring_prep_read
(long sqe, int fd, long buf, int nbytes, int offset) Unsafe version of:prep_read
static void
nio_uring_prep_read_fixed
(long sqe, int fd, long buf, int nbytes, int offset, int buf_index) Unsafe version of:prep_read_fixed
static void
nio_uring_prep_readv
(long sqe, int fd, long iovecs, int nr_vecs, int offset) Unsafe version of:prep_readv
static void
nio_uring_prep_readv2
(long sqe, int fd, long iovecs, int nr_vecs, int offset, int flags) Unsafe version of:prep_readv2
static void
nio_uring_prep_recv
(long sqe, int sockfd, long buf, long len, int flags) static void
nio_uring_prep_recv_multishot
(long sqe, int sockfd, long buf, long len, int flags) static void
nio_uring_prep_recvmsg
(long sqe, int fd, long msg, int flags) static void
nio_uring_prep_recvmsg_multishot
(long sqe, int fd, long msg, int flags) static void
nio_uring_prep_remove_buffers
(long sqe, int nr, int bgid) static void
nio_uring_prep_rename
(long sqe, long oldpath, long newpath) static void
nio_uring_prep_renameat
(long sqe, int olddfd, long oldpath, int newdfd, long newpath, int flags) static void
nio_uring_prep_send
(long sqe, int sockfd, long buf, long len, int flags) static void
nio_uring_prep_send_set_addr
(long sqe, long dest_addr, short addr_len) static void
nio_uring_prep_send_zc
(long sqe, int sockfd, long buf, long len, int flags, int zc_flags) static void
nio_uring_prep_send_zc_fixed
(long sqe, int sockfd, long buf, long len, int flags, int zc_flags, int buf_index) static void
nio_uring_prep_sendmsg
(long sqe, int fd, long msg, int flags) static void
nio_uring_prep_sendmsg_zc
(long sqe, int fd, long msg, int flags) static void
nio_uring_prep_sendto
(long sqe, int sockfd, long buf, long len, int flags, long addr, int addrlen) static void
nio_uring_prep_setxattr
(long sqe, long name, long value, long path, int flags, int len) static void
nio_uring_prep_shutdown
(long sqe, int fd, int how) static void
nio_uring_prep_socket
(long sqe, int domain, int type, int protocol, int flags) static void
nio_uring_prep_socket_direct
(long sqe, int domain, int type, int protocol, int file_index, int flags) static void
nio_uring_prep_socket_direct_alloc
(long sqe, int domain, int type, int protocol, int flags) static void
nio_uring_prep_splice
(long sqe, int fd_in, long off_in, int fd_out, long off_out, int nbytes, int splice_flags) Unsafe version of:prep_splice
static void
nio_uring_prep_statx
(long sqe, int dfd, long path, int flags, int mask, long statxbuf) static void
nio_uring_prep_symlink
(long sqe, long target, long linkpath) static void
nio_uring_prep_symlinkat
(long sqe, long target, int newdirfd, long linkpath) static void
nio_uring_prep_sync_file_range
(long sqe, int fd, int len, int offset, int flags) static void
nio_uring_prep_tee
(long sqe, int fd_in, int fd_out, int nbytes, int splice_flags) static void
nio_uring_prep_timeout
(long sqe, long ts, int count, int flags) static void
nio_uring_prep_timeout_remove
(long sqe, long user_data, int flags) static void
nio_uring_prep_timeout_update
(long sqe, long ts, long user_data, int flags) static void
nio_uring_prep_unlink
(long sqe, long path, int flags) static void
nio_uring_prep_unlinkat
(long sqe, int dfd, long path, int flags) static void
nio_uring_prep_write
(long sqe, int fd, long buf, int nbytes, int offset) Unsafe version of:prep_write
static void
nio_uring_prep_write_fixed
(long sqe, int fd, long buf, int nbytes, int offset, int buf_index) Unsafe version of:prep_write_fixed
static void
nio_uring_prep_writev
(long sqe, int fd, long iovecs, int nr_vecs, int offset) Unsafe version of:prep_writev
static void
nio_uring_prep_writev2
(long sqe, int fd, long iovecs, int nr_vecs, int offset, int flags) Unsafe version of:prep_writev2
static void
nio_uring_queue_exit
(long ring) Unsafe version of:queue_exit
static int
nio_uring_queue_init
(int entries, long ring, int flags) Unsafe version of:queue_init
static int
nio_uring_queue_init_params
(int entries, long ring, long p) static int
nio_uring_queue_mmap
(int fd, long p, long ring) Unsafe version of:queue_mmap
static long
nio_uring_recvmsg_cmsg_firsthdr
(long o, long msgh) static long
nio_uring_recvmsg_cmsg_nexthdr
(long o, long msgh, long cmsg) static long
nio_uring_recvmsg_name
(long o) static long
nio_uring_recvmsg_payload
(long o, long msgh) static int
nio_uring_recvmsg_payload_length
(long o, int buf_len, long msgh) static long
nio_uring_recvmsg_validate
(long buf, int buf_len, long msgh) static int
nio_uring_register_buf_ring
(long ring, long reg, int flags) Unsafe version of:register_buf_ring
static int
nio_uring_register_buffers
(long ring, long iovecs, int nr_iovecs) Unsafe version of:register_buffers
static int
nio_uring_register_buffers_sparse
(long ring, int nr_iovecs) Unsafe version of:register_buffers_sparse
static int
nio_uring_register_buffers_tags
(long ring, long iovecs, long tags, int nr) static int
nio_uring_register_buffers_update_tag
(long ring, int off, long iovecs, long tags, int nr) static int
nio_uring_register_eventfd
(long ring, int fd) static int
nio_uring_register_eventfd_async
(long ring, int fd) static int
nio_uring_register_file_alloc_range
(long ring, int off, int len) static int
nio_uring_register_files
(long ring, long files, int nr_files) Unsafe version of:register_files
static int
nio_uring_register_files_sparse
(long ring, int nr_files) Unsafe version of:register_files_sparse
static int
nio_uring_register_files_tags
(long ring, long files, long tags, int nr) static int
nio_uring_register_files_update
(long ring, int off, long files, int nr_files) static int
nio_uring_register_files_update_tag
(long ring, int off, long files, long tags, int nr_files) static int
nio_uring_register_iowq_aff
(long ring, long cpusz, long mask) static int
nio_uring_register_iowq_max_workers
(long ring, long values) static int
nio_uring_register_personality
(long ring) static int
nio_uring_register_probe
(long ring, long p, int nr) static int
nio_uring_register_restrictions
(long ring, long res, int nr_res) static int
nio_uring_register_ring_fd
(long ring) Unsafe version of:register_ring_fd
static int
nio_uring_register_sync_cancel
(long ring, long reg) static int
nio_uring_ring_dontfork
(long ring) Unsafe version of:ring_dontfork
static int
nio_uring_setup
(int entries, long p) Unsafe version of:setup
static long
nio_uring_setup_buf_ring
(long ring, int nentries, int bgid, int flags, long ret) static int
nio_uring_sq_ready
(long ring) Unsafe version of:sq_ready
static int
nio_uring_sq_space_left
(long ring) Unsafe version of:sq_space_left
static void
nio_uring_sqe_set_data
(long sqe, long data) Unsafe version of:sqe_set_data
static void
nio_uring_sqe_set_data64
(long sqe, long data) Unsafe version of:sqe_set_data64
static void
nio_uring_sqe_set_flags
(long sqe, int flags) Unsafe version of:sqe_set_flags
static int
nio_uring_sqring_wait
(long ring) Unsafe version of:sqring_wait
static int
nio_uring_submit
(long ring) Unsafe version of:submit
static int
nio_uring_submit_and_get_events
(long ring) Unsafe version of:submit_and_get_events
static int
nio_uring_submit_and_wait
(long ring, int wait_nr) Unsafe version of:submit_and_wait
static int
nio_uring_submit_and_wait_timeout
(long ring, long cqe_ptr, int wait_nr, long ts, long sigmask) Unsafe version of:submit_and_wait_timeout
static int
nio_uring_unregister_buf_ring
(long ring, int bgid) Unsafe version of:unregister_buf_ring
static int
nio_uring_unregister_buffers
(long ring) Unsafe version of:unregister_buffers
static int
nio_uring_unregister_eventfd
(long ring) static int
nio_uring_unregister_files
(long ring) static int
nio_uring_unregister_iowq_aff
(long ring) static int
nio_uring_unregister_personality
(long ring, int id) static int
nio_uring_unregister_ring_fd
(long ring) Unsafe version of:unregister_ring_fd
static int
nio_uring_wait_cqe
(long ring, long cqe_ptr) Unsafe version of:wait_cqe
static int
nio_uring_wait_cqe_nr
(long ring, long cqe_ptr, int wait_nr) Unsafe version of:wait_cqe_nr
static int
nio_uring_wait_cqe_timeout
(long ring, long cqe_ptr, long ts) Unsafe version of:wait_cqe_timeout
static int
nio_uring_wait_cqes
(long ring, long cqe_ptr, int wait_nr, long ts, long sigmask) Unsafe version of:wait_cqes
-
Field Details
-
LIBURING_UDATA_TIMEOUT
public static final long LIBURING_UDATA_TIMEOUT- See Also:
-
-
Method Details
-
nio_uring_get_probe_ring
public static long nio_uring_get_probe_ring(long ring) Unsafe version of:get_probe_ring
-
io_uring_get_probe_ring
Return an allocatedio_uring_probe
structure, orNULL
if probe fails (for example, if it is not available).The caller is responsible for freeing it.
-
nio_uring_get_probe
public static long nio_uring_get_probe()Unsafe version of:get_probe
-
io_uring_get_probe
Returns an allocatedio_uring_probe
structure to the caller.The caller is responsible for freeing the structure with the function
free_probe
.Note: Earlier versions of the Linux kernel (≤ 5.5) do not support probe. If the kernel doesn't support probe, this function will return
NULL
. -
nio_uring_free_probe
public static void nio_uring_free_probe(long probe) Unsafe version of:free_probe
-
io_uring_free_probe
Frees theprobe
instance allocated with theget_probe
function. -
nio_uring_opcode_supported
public static int nio_uring_opcode_supported(long p, int op) Unsafe version of:opcode_supported
-
io_uring_opcode_supported
Allows the caller to determine if the passed inopcode
belonging to theprobe
param is supported.An instance of the
io_uring_probe
instance can be obtained by calling the functionget_probe
. -
nio_uring_queue_init_params
public static int nio_uring_queue_init_params(int entries, long ring, long p) -
io_uring_queue_init_params
-
nio_uring_queue_init
public static int nio_uring_queue_init(int entries, long ring, int flags) Unsafe version of:queue_init
-
io_uring_queue_init
Executes thesetup
syscall to initialize the submission and completion queues in the kernel with at leastentries
entries and then maps the resulting file descriptor to memory shared between the application and the kernel.On success, the resources held by
ring
should be released via a corresponding call toqueue_exit
.- Parameters:
flags
- will be passed through to thesetup
syscall- Returns:
- 0 on success and
ring
will point to the shared memory containing theio_uring
queues. On failure-errno
is returned.
-
nio_uring_queue_mmap
public static int nio_uring_queue_mmap(int fd, long p, long ring) Unsafe version of:queue_mmap
-
io_uring_queue_mmap
For users that want to specifysq_thread_cpu
orsq_thread_idle
, this interface is a convenient helper formmap()
ing the rings.- Parameters:
fd
- a file descriptor returned bysetup
ring
- on success, contains the necessary information to read/write to the rings- Returns:
-errno
on error, or zero on success
-
nio_uring_ring_dontfork
public static int nio_uring_ring_dontfork(long ring) Unsafe version of:ring_dontfork
-
io_uring_ring_dontfork
Ensure that themmap
'ed rings aren't available to a child after afork(2)
.This uses
madvise(..., MADV_DONTFORK)
on themmap
'ed ranges. -
nio_uring_queue_exit
public static void nio_uring_queue_exit(long ring) Unsafe version of:queue_exit
-
io_uring_queue_exit
Will release all resources acquired and initialized byqueue_init
.It first unmaps the memory shared between the application and the kernel and then closes the
io_uring
file descriptor. -
nio_uring_peek_batch_cqe
public static int nio_uring_peek_batch_cqe(long ring, long cqes, int count) Unsafe version of:peek_batch_cqe
-
io_uring_peek_batch_cqe
Fill in an array of IO completions up to count, if any are available.- Returns:
- the amount of IO completions filled
-
nio_uring_wait_cqes
public static int nio_uring_wait_cqes(long ring, long cqe_ptr, int wait_nr, long ts, long sigmask) Unsafe version of:wait_cqes
-
io_uring_wait_cqes
public static int io_uring_wait_cqes(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr, @Nullable KernelTimespec ts, long sigmask) Returnswait_nr
IO completions from the queue belonging to thering
param, waiting for it if necessary or until the timeoutts
expires.If
ts
is specified, the application does not need to callsubmit
before callingio_uring_wait_cqes()
.- Parameters:
cqe_ptr
- filled in on successsigmask
- the set of signals to block. The prevailing signal mask is restored before returning.- Returns:
- 0 on success and the
cqe_ptr
param is filled in. On failure it returns-errno
.
-
nio_uring_wait_cqe_timeout
public static int nio_uring_wait_cqe_timeout(long ring, long cqe_ptr, long ts) Unsafe version of:wait_cqe_timeout
-
io_uring_wait_cqe_timeout
public static int io_uring_wait_cqe_timeout(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr, @Nullable KernelTimespec ts) Returns one IO completion from the queue belonging to thering
param, waiting for it if necessary or until the timeoutts
expires.If
ts
is specified, the application does not need to callsubmit
before callingio_uring_wait_cqe_timeout()
.- Parameters:
cqe_ptr
- filled in on success- Returns:
- 0 on success and the
cqe_ptr
param is filled in. On failure it returns-errno
.
-
nio_uring_submit
public static int nio_uring_submit(long ring) Unsafe version of:submit
-
io_uring_submit
Submits the next events to the submission queue belonging to thering
.After the caller retrieves a submission queue entry (SQE) with
get_sqe
, prepares the SQE, it can be submitted withio_uring_submit()
.- Returns:
- the number of submitted submission queue entries on success. On failure it returns
-errno
.
-
nio_uring_submit_and_wait
public static int nio_uring_submit_and_wait(long ring, int wait_nr) Unsafe version of:submit_and_wait
-
io_uring_submit_and_wait
Submits the next events to the submission queue belonging to thering
and waits forwait_nr
completion events.After the caller retrieves a submission queue entry (SQE) with
get_sqe
, prepares the SQE, it can be submitted withio_uring_submit_and_wait()
.- Returns:
- the number of submitted submission queue entries on success. On failure it returns
-errno
.
-
nio_uring_submit_and_wait_timeout
public static int nio_uring_submit_and_wait_timeout(long ring, long cqe_ptr, int wait_nr, long ts, long sigmask) Unsafe version of:submit_and_wait_timeout
-
io_uring_submit_and_wait_timeout
public static int io_uring_submit_and_wait_timeout(IOURing ring, org.lwjgl.PointerBuffer cqe_ptr, @Nullable KernelTimespec ts, long sigmask) Submits the next events to the submission queue belonging to thering
and waits forwait_nr
completion events or until the timeoutts
expires.The completion events are stored in thecqe_ptr
array.After the caller retrieves a submission queue entry (SQE) with
get_sqe
, prepares the SQE, it can be submitted withio_uring_submit_and_wait_timeout()
.- Parameters:
sigmask
- the set of signals to block. The prevailing signal mask is restored before returning.- Returns:
- the number of submitted submission queue entries on success. On failure it returns
-errno
.
-
nio_uring_register_buffers
public static int nio_uring_register_buffers(long ring, long iovecs, int nr_iovecs) Unsafe version of:register_buffers
-
io_uring_register_buffers
Registersnr_iovecs
number of buffers defined by the arrayiovecs
belonging to thering
.After the caller has registered the buffers, they can be used with one of the fixed buffers functions.
Registered buffers is an optimization that is useful in conjunction with
O_DIRECT
reads and writes, where maps the specified range into the kernel once when the buffer is registered, rather than doing a map and unmap for each IO every time IO is performed to that region. Additionally, it also avoids manipulating the page reference counts for each IO.- Returns:
- 0 on success. On failure it returns
-errno
.
-
nio_uring_register_buffers_tags
public static int nio_uring_register_buffers_tags(long ring, long iovecs, long tags, int nr) -
io_uring_register_buffers_tags
public static int io_uring_register_buffers_tags(IOURing ring, IOVec.Buffer iovecs, LongBuffer tags) -
nio_uring_register_buffers_sparse
public static int nio_uring_register_buffers_sparse(long ring, int nr_iovecs) Unsafe version of:register_buffers_sparse
-
io_uring_register_buffers_sparse
Registersnr_iovecs
empty buffers belonging to thering
.These buffers must be updated before use, using eg
register_buffers_update_tag
.After the caller has registered the buffers, they can be used with one of the fixed buffers functions.
Registered buffers is an optimization that is useful in conjunction with
O_DIRECT
reads and writes, where it maps the specified range into the kernel once when the buffer is registered rather than doing a map and unmap for each IO every time IO is performed to that region. Additionally, it also avoids manipulating the page reference counts for each IO. -
nio_uring_register_buffers_update_tag
public static int nio_uring_register_buffers_update_tag(long ring, int off, long iovecs, long tags, int nr) -
io_uring_register_buffers_update_tag
public static int io_uring_register_buffers_update_tag(IOURing ring, int off, IOVec.Buffer iovecs, LongBuffer tags) -
nio_uring_unregister_buffers
public static int nio_uring_unregister_buffers(long ring) Unsafe version of:unregister_buffers
-
io_uring_unregister_buffers
Unregisters the fixed buffers previously registered to thering
.- Returns:
- 0 on success. On failure it returns
-errno
.
-
nio_uring_register_files
public static int nio_uring_register_files(long ring, long files, int nr_files) Unsafe version of:register_files
-
io_uring_register_files
Registersnr_files
number of file descriptors defined by the arrayfiles
belonging to thering
for subsequent operations.After the caller has registered the buffers, they can be used with the submission queue polling operations.
- Returns:
- 0 on success. On failure it returns
-errno
.
-
nio_uring_register_files_tags
public static int nio_uring_register_files_tags(long ring, long files, long tags, int nr) -
io_uring_register_files_tags
-
nio_uring_register_files_sparse
public static int nio_uring_register_files_sparse(long ring, int nr_files) Unsafe version of:register_files_sparse
-
io_uring_register_files_sparse
Registers an empty file table ofnr_files
number of file descriptors.Registering a file table is a prerequisite for using any request that uses direct descriptors.
The sparse variant is available in kernels 5.19 and later.
-
nio_uring_register_files_update_tag
public static int nio_uring_register_files_update_tag(long ring, int off, long files, long tags, int nr_files) -
io_uring_register_files_update_tag
public static int io_uring_register_files_update_tag(IOURing ring, int off, IntBuffer files, LongBuffer tags) -
nio_uring_unregister_files
public static int nio_uring_unregister_files(long ring) -
io_uring_unregister_files
-
nio_uring_register_files_update
public static int nio_uring_register_files_update(long ring, int off, long files, int nr_files) -
io_uring_register_files_update
-
nio_uring_register_eventfd
public static int nio_uring_register_eventfd(long ring, int fd) -
io_uring_register_eventfd
-
nio_uring_register_eventfd_async
public static int nio_uring_register_eventfd_async(long ring, int fd) -
io_uring_register_eventfd_async
-
nio_uring_unregister_eventfd
public static int nio_uring_unregister_eventfd(long ring) -
io_uring_unregister_eventfd
-
nio_uring_register_probe
public static int nio_uring_register_probe(long ring, long p, int nr) -
io_uring_register_probe
-
nio_uring_register_personality
public static int nio_uring_register_personality(long ring) -
io_uring_register_personality
-
nio_uring_unregister_personality
public static int nio_uring_unregister_personality(long ring, int id) -
io_uring_unregister_personality
-
nio_uring_register_restrictions
public static int nio_uring_register_restrictions(long ring, long res, int nr_res) -
io_uring_register_restrictions
-
nio_uring_enable_rings
public static int nio_uring_enable_rings(long ring) -
io_uring_enable_rings
-
n__io_uring_sqring_wait
public static int n__io_uring_sqring_wait(long ring) -
__io_uring_sqring_wait
-
nio_uring_register_iowq_aff
public static int nio_uring_register_iowq_aff(long ring, long cpusz, long mask) -
io_uring_register_iowq_aff
-
nio_uring_unregister_iowq_aff
public static int nio_uring_unregister_iowq_aff(long ring) -
io_uring_unregister_iowq_aff
-
nio_uring_register_iowq_max_workers
public static int nio_uring_register_iowq_max_workers(long ring, long values) -
io_uring_register_iowq_max_workers
-
nio_uring_register_ring_fd
public static int nio_uring_register_ring_fd(long ring) Unsafe version of:register_ring_fd
-
io_uring_register_ring_fd
Registers the file descriptor of the ring.Whenever
enter
is called to submit request or wait for completions, the kernel must grab a reference to the file descriptor. If the application using io_uring is threaded, the file table is marked as shared, and the reference grab and put of the file descriptor count is more expensive than it is for a non-threaded application.Similarly to how io_uring allows registration of files, this allow registration of the ring file descriptor itself. This reduces the overhead of the
io_uring_enter (2)
system call.If an application using liburing is threaded, then an application should call this function to register the ring descriptor when a ring is set up. See NOTES for restrictions when a ring is shared.
Note
When the ring descriptor is registered, it is stored internally in the
struct io_uring
structure. For applications that share a ring between threads, for example having one thread do submits and another reap events, then this optimization cannot be used as each thread may have a different index for the registered ring fd.- Returns:
- 1 on success, indicating that one file descriptor was registered, or
-errno
on error
-
nio_uring_unregister_ring_fd
public static int nio_uring_unregister_ring_fd(long ring) Unsafe version of:unregister_ring_fd
-
io_uring_unregister_ring_fd
Unregisters the file descriptor of the ring.Unregisters a ring descriptor previously registered with the task. This is done automatically when
queue_exit
is called, but can also be done to free up space for new ring registrations. For more information on ring descriptor registration, seeregister_ring_fd
.- Returns:
- 1 on success, indicating that one file descriptor was unregistered, or
-errno
on error
-
nio_uring_close_ring_fd
public static int nio_uring_close_ring_fd(long ring) -
io_uring_close_ring_fd
-
nio_uring_register_buf_ring
public static int nio_uring_register_buf_ring(long ring, long reg, int flags) Unsafe version of:register_buf_ring
-
io_uring_register_buf_ring
Registers a shared buffer ring to be used with provided buffers.For the request types that support it, provided buffers are given to the ring and one is selected by a request if it has
LibIOURing.IOSQE_BUFFER_SELECT
set in the SQEflags
, when the request is ready to receive data. This allows both clear ownership of the buffer lifetime, and a way to have more read/receive type of operations in flight than buffers available.The
reg
argument must be filled in with the appropriate information. It looks as follows:struct io_uring_buf_reg { __u64 ring_addr; __u32 ring_entries; __u16 bgid; __u16 pad; __u64 resv[3]; };
The
ring_addr
field must contain the address to the memory allocated to fit this ring. The memory must be page aligned and hence allocated appropriately using egposix_memalign (3)
or similar. The size of the ring is the product ofring_entries
and the size of"struct io_uring_buf"
.ring_entries
is the desired size of the ring, and must be a power-of-2 in size.bgid
is the buffer group ID associated with this ring. SQEs that select a buffer has a buffer group associated with them in theirbuf_group
field, and the associated CQE will haveLibIOURing.IORING_CQE_F_BUFFER
set in theirflags
member, which will also contain the specific ID of the buffer selected. The rest of the fields are reserved and must be cleared to zero.The
flags
argument is currently unused and must be set to zero.A shared buffer ring looks as follows:
struct io_uring_buf_ring { union { struct { __u64 resv1; __u32 resv2; __u16 resv3; __u16 tail; }; struct io_uring_buf bufs[0]; }; };
where
tail
is the index at which the application can insert new buffers for consumption by requests, andstruct io_uring_buf
is buffer definition:struct io_uring_buf { __u64 addr; __u32 len; __u16 bid; __u16 resv; };
where
addr
is the address for the buffer,len
is the length of the buffer in bytes, andbid
is the buffer ID that will be returned in the CQE once consumed.Reserved fields must not be touched. Applications must use
buf_ring_init
to initialise the buffer ring. Applications may usebuf_ring_add
andbuf_ring_advance
orbuf_ring_advance
to provide buffers, which will set these fields and update the tail.Available since 5.19.
- Returns:
- 0 on success,
-errno
on failure
-
nio_uring_unregister_buf_ring
public static int nio_uring_unregister_buf_ring(long ring, int bgid) Unsafe version of:unregister_buf_ring
-
io_uring_unregister_buf_ring
Function unregisters a previously registered shared buffer ring indicated bybgid
.- Returns:
- 0 on success,
-errno
on failure
-
nio_uring_register_sync_cancel
public static int nio_uring_register_sync_cancel(long ring, long reg) -
io_uring_register_sync_cancel
-
nio_uring_register_file_alloc_range
public static int nio_uring_register_file_alloc_range(long ring, int off, int len) -
io_uring_register_file_alloc_range
-
nio_uring_get_events
public static int nio_uring_get_events(long ring) Unsafe version of:get_events
-
io_uring_get_events
Runs outstanding work and flushes completion events to the CQE ring.There can be events needing to be flushed if the ring was full and had overflowed. Alternatively if the ring was setup with the
SETUP_DEFER_TASKRUN
flag then this will process outstanding tasks, possibly resulting in more CQEs.- Returns:
- 0 on success,
-errno
on failure
-
nio_uring_submit_and_get_events
public static int nio_uring_submit_and_get_events(long ring) Unsafe version of:submit_and_get_events
-
io_uring_submit_and_get_events
Submits the next events to the submission queue as withsubmit
.After submission it will flush CQEs as with
get_events
.The benefit of this function is that it does both with only one system call.
- Returns:
- the number of submitted submission queue entries on success,
-errno
on failure
-
nio_uring_enter
public static int nio_uring_enter(int fd, int to_submit, int min_complete, int flags, long sig) Unsafe version of:enter
-
io_uring_enter
public static int io_uring_enter(int fd, int to_submit, int min_complete, int flags, long sig) Seeenter
. -
nio_uring_enter2
public static int nio_uring_enter2(int fd, int to_submit, int min_complete, int flags, long sig, long sz) Unsafe version of:enter2
-
io_uring_enter2
public static int io_uring_enter2(int fd, int to_submit, int min_complete, int flags, long sig, long sz) Seeenter2
. -
nio_uring_setup
public static int nio_uring_setup(int entries, long p) Unsafe version of:setup
-
io_uring_setup
Seesetup
. -
io_uring_register
public static int io_uring_register(int fd, int opcode, long arg, int nr_args) Seeregister
. -
nio_uring_setup_buf_ring
public static long nio_uring_setup_buf_ring(long ring, int nentries, int bgid, int flags, long ret) -
io_uring_setup_buf_ring
@Nullable public static IOURingBufRing io_uring_setup_buf_ring(IOURing ring, int nentries, int bgid, int flags, IntBuffer ret) -
nio_uring_free_buf_ring
public static int nio_uring_free_buf_ring(long ring, long br, int nentries, int bgid) -
io_uring_free_buf_ring
-
nio_uring_cqe_seen
public static void nio_uring_cqe_seen(long ring, long cqe) Unsafe version of:cqe_seen
-
io_uring_cqe_seen
-
nio_uring_sqe_set_data
public static void nio_uring_sqe_set_data(long sqe, long data) Unsafe version of:sqe_set_data
-
io_uring_sqe_set_data
Stores auser_data
pointer with the submission queue entrysqe
.After the caller has requested an submission queue entry (SQE) with
get_sqe
, they can associate a data pointer with the SQE. Once the completion arrives, the functioncqe_get_data
can be called to identify the user request. -
nio_uring_cqe_get_data
public static long nio_uring_cqe_get_data(long cqe) Unsafe version of:cqe_get_data
-
io_uring_cqe_get_data
Returns theuser_data
with the completion queue entrycqe
.After the caller has received a completion queue entry (CQE) with
wait_cqe
, they can call theio_uring_cqe_get_data()
function to retrieve theuser_data
value. This requires thatuser_data
has been set earlier with the functionsqe_set_data
. -
nio_uring_sqe_set_data64
public static void nio_uring_sqe_set_data64(long sqe, long data) Unsafe version of:sqe_set_data64
-
io_uring_sqe_set_data64
Assign a 64-bit value to thissqe
, which can get retrieved at completion time withcqe_get_data64
.Just like the non-64 variants, except these store a 64-bit type rather than a data pointer.
-
nio_uring_cqe_get_data64
public static long nio_uring_cqe_get_data64(long cqe) Unsafe version of:cqe_get_data64
-
io_uring_cqe_get_data64
Seesqe_set_data64
. -
nio_uring_sqe_set_flags
public static void nio_uring_sqe_set_flags(long sqe, int flags) Unsafe version of:sqe_set_flags
-
io_uring_sqe_set_flags
Allows the caller to change the behavior of the submission queue entry by specifying flags.It enables the
flags
belonging to thesqe
submission queue entry param. -
nio_uring_prep_splice
public static void nio_uring_prep_splice(long sqe, int fd_in, long off_in, int fd_out, long off_out, int nbytes, int splice_flags) Unsafe version of:prep_splice
-
io_uring_prep_splice
public static void io_uring_prep_splice(IOURingSQE sqe, int fd_in, long off_in, int fd_out, long off_out, int nbytes, int splice_flags) Precondition: Eitherfd_in
orfd_out
must be a pipe.This splice operation can be used to implement
sendfile
by splicing to an intermediate pipe first, then splice to the final destination. In fact, the implementation ofsendfile
in kernel usessplice
internally.NOTE that even if
fd_in
orfd_out
refers to a pipe, the splice operation can still fail withEINVAL
if one of the fd doesn't explicitly support splice operation, e.g. reading from terminal is unsupported from kernel 5.7 to 5.11. Check issue #291 for more information.- Parameters:
off_in
- iffd_in
refers to a pipe,off_in
must be(int64_t) -1
; Iffd_in
does not refer to a pipe andoff_in
is(int64_t) -1
, then bytes are read fromfd_in
starting from the file offset and it is adjust appropriately; Iffd_in
does not refer to a pipe andoff_in
is not(int64_t) -1
, then the startingoffset
offd_in
will beoff_in
.off_out
- the description ofoff_in
also applied tooff_out
splice_flags
- see mansplice(2)
for description of flags
-
nio_uring_prep_tee
public static void nio_uring_prep_tee(long sqe, int fd_in, int fd_out, int nbytes, int splice_flags) -
io_uring_prep_tee
public static void io_uring_prep_tee(IOURingSQE sqe, int fd_in, int fd_out, int nbytes, int splice_flags) -
nio_uring_prep_readv
public static void nio_uring_prep_readv(long sqe, int fd, long iovecs, int nr_vecs, int offset) Unsafe version of:prep_readv
-
io_uring_prep_readv
Prepares a vectored IO read request.The submission queue entry
sqe
is setup to use the file descriptorfd
to start readingnr_vecs
into theiovecs
array at the specifiedoffset
.On files that support seeking, if the
offset
is set to -1, the read operation commences at the file offset, and the file offset is incremented by the number of bytes read. Seeread(2)
for more details.On files that are not capable of seeking, the offset is ignored.
After the write has been prepared it can be submitted with one of the submit functions.
-
nio_uring_prep_readv2
public static void nio_uring_prep_readv2(long sqe, int fd, long iovecs, int nr_vecs, int offset, int flags) Unsafe version of:prep_readv2
-
io_uring_prep_readv2
public static void io_uring_prep_readv2(IOURingSQE sqe, int fd, IOVec.Buffer iovecs, int offset, int flags) Prepares a vectored IO read request.The submission queue entry
sqe
is setup to use the file descriptorfd
to start readingnr_vecs
into theiovecs
array at the specifiedoffset
.The behavior of the function can be controlled with the
flags
parameter. Supported values for flags are:RWF_HIPRI
- High priority request, poll if possibleRWF_DSYNC
- per-IOO_DSYNC
RWF_SYNC
- per-IOO_SYNC
RWF_NOWAIT
- per-IO, return-EAGAIN
if operation would blockRWF_APPEND
- per-IOO_APPEND
On files that support seeking, if the
offset
is set to -1, the read operation commences at the file offset, and the file offset is incremented by the number of bytes read. Seeread(2)
for more details.On files that are not capable of seeking, the offset is ignored.
After the write has been prepared, it can be submitted with one of the submit functions.
-
nio_uring_prep_read_fixed
public static void nio_uring_prep_read_fixed(long sqe, int fd, long buf, int nbytes, int offset, int buf_index) Unsafe version of:prep_read_fixed
-
io_uring_prep_read_fixed
public static void io_uring_prep_read_fixed(IOURingSQE sqe, int fd, ByteBuffer buf, int offset, int buf_index) Prepares an IO read request with a previously registered IO buffer.The submission queue entry
sqe
is setup to use the file descriptorfd
to start readingnbytes
into the bufferbuf
at the specifiedoffset
, and with the buffer matching the registered index ofbuf_index
.This work just like
prep_read
except it requires the user of buffers that have been registered withregister_buffers
. Thebuf
andnbytes
arguments must fall within a region specificed bybuf_index
in the previously registered buffer. The buffer need not be aligned with the start of the registered buffer.After the read has been prepared it can be submitted with one of the submit functions.
-
nio_uring_prep_writev
public static void nio_uring_prep_writev(long sqe, int fd, long iovecs, int nr_vecs, int offset) Unsafe version of:prep_writev
-
io_uring_prep_writev
Prepares a vectored IO write request.The submission queue entry
sqe
is setup to use the file descriptorfd
to start writingnr_vecs
from theiovecs
array at the specifiedoffset
.On files that support seeking, if the
offset
is set to -1, the write operation commences at the file offset, and the file offset is incremented by the number of bytes written. Seewrite(2)
for more details.On files that are not capable of seeking, the offset is ignored.
After the write has been prepared it can be submitted with one of the submit functions.
-
nio_uring_prep_writev2
public static void nio_uring_prep_writev2(long sqe, int fd, long iovecs, int nr_vecs, int offset, int flags) Unsafe version of:prep_writev2
-
io_uring_prep_writev2
public static void io_uring_prep_writev2(IOURingSQE sqe, int fd, IOVec.Buffer iovecs, int offset, int flags) Prepares a vectored IO write request.The submission queue entry
sqe
is setup to use the file descriptorfd
to start writingnr_vecs
from theiovecs
array at the specifiedoffset
.The behavior of the function can be controlled with the
flags
parameter. Supported values for flags are:RWF_HIPRI
- High priority request, poll if possibleRWF_DSYNC
- per-IOO_DSYNC
RWF_SYNC
- per-IOO_SYNC
RWF_NOWAIT
- per-IO, return-EAGAIN
if operation would blockRWF_APPEND
- per-IOO_APPEND
On files that support seeking, if the
offset
is set to -1, the write operation commences at the file offset, and the file offset is incremented by the number of bytes written. Seewrite(2)
for more details.On files that are not capable of seeking, the offset is ignored.
After the write has been prepared, it can be submitted with one of the submit functions.
-
nio_uring_prep_write_fixed
public static void nio_uring_prep_write_fixed(long sqe, int fd, long buf, int nbytes, int offset, int buf_index) Unsafe version of:prep_write_fixed
-
io_uring_prep_write_fixed
public static void io_uring_prep_write_fixed(IOURingSQE sqe, int fd, ByteBuffer buf, int offset, int buf_index) Prepares an IO write request with a previously registered IO buffer.The submission queue entry
sqe
is setup to use the file descriptorfd
to start writingnbytes
from the bufferbuf
at the specifiedoffset
, and with the buffer matching the registered index ofbuf_index
.This work just like
prep_write
except it requires the user of buffers that have been registered withregister_buffers
. Thebuf
andnbytes
arguments must fall within a region specificed bybuf_index
in the previously registered buffer. The buffer need not be aligned with the start of the registered buffer.After the read has been prepared it can be submitted with one of the submit functions.
-
nio_uring_prep_recvmsg
public static void nio_uring_prep_recvmsg(long sqe, int fd, long msg, int flags) -
io_uring_prep_recvmsg
-
nio_uring_prep_recvmsg_multishot
public static void nio_uring_prep_recvmsg_multishot(long sqe, int fd, long msg, int flags) -
io_uring_prep_recvmsg_multishot
-
nio_uring_prep_sendmsg
public static void nio_uring_prep_sendmsg(long sqe, int fd, long msg, int flags) -
io_uring_prep_sendmsg
-
nio_uring_prep_poll_add
public static void nio_uring_prep_poll_add(long sqe, int fd, int poll_mask) -
io_uring_prep_poll_add
-
nio_uring_prep_poll_multishot
public static void nio_uring_prep_poll_multishot(long sqe, int fd, int poll_mask) -
io_uring_prep_poll_multishot
-
nio_uring_prep_poll_remove
public static void nio_uring_prep_poll_remove(long sqe, long user_data) -
io_uring_prep_poll_remove
-
nio_uring_prep_poll_update
public static void nio_uring_prep_poll_update(long sqe, long old_user_data, long new_user_data, int poll_mask, int flags) -
io_uring_prep_poll_update
public static void io_uring_prep_poll_update(IOURingSQE sqe, long old_user_data, long new_user_data, int poll_mask, int flags) -
nio_uring_prep_fsync
public static void nio_uring_prep_fsync(long sqe, int fd, int fsync_flags) -
io_uring_prep_fsync
-
nio_uring_prep_nop
public static void nio_uring_prep_nop(long sqe) -
io_uring_prep_nop
-
nio_uring_prep_timeout
public static void nio_uring_prep_timeout(long sqe, long ts, int count, int flags) -
io_uring_prep_timeout
-
nio_uring_prep_timeout_remove
public static void nio_uring_prep_timeout_remove(long sqe, long user_data, int flags) -
io_uring_prep_timeout_remove
-
nio_uring_prep_timeout_update
public static void nio_uring_prep_timeout_update(long sqe, long ts, long user_data, int flags) -
io_uring_prep_timeout_update
public static void io_uring_prep_timeout_update(IOURingSQE sqe, KernelTimespec ts, long user_data, int flags) -
nio_uring_prep_accept
public static void nio_uring_prep_accept(long sqe, int fd, long addr, long addrlen, int flags) -
io_uring_prep_accept
public static void io_uring_prep_accept(IOURingSQE sqe, int fd, Sockaddr addr, IntBuffer addrlen, int flags) -
nio_uring_prep_accept_direct
public static void nio_uring_prep_accept_direct(long sqe, int fd, long addr, long addrlen, int flags, int file_index) -
io_uring_prep_accept_direct
public static void io_uring_prep_accept_direct(IOURingSQE sqe, int fd, Sockaddr addr, IntBuffer addrlen, int flags, int file_index) -
nio_uring_prep_multishot_accept
public static void nio_uring_prep_multishot_accept(long sqe, int fd, long addr, long addrlen, int flags) -
io_uring_prep_multishot_accept
public static void io_uring_prep_multishot_accept(IOURingSQE sqe, int fd, Sockaddr addr, IntBuffer addrlen, int flags) -
nio_uring_prep_multishot_accept_direct
public static void nio_uring_prep_multishot_accept_direct(long sqe, int fd, long addr, long addrlen, int flags) -
io_uring_prep_multishot_accept_direct
public static void io_uring_prep_multishot_accept_direct(IOURingSQE sqe, int fd, Sockaddr addr, IntBuffer addrlen, int flags) -
nio_uring_prep_cancel64
public static void nio_uring_prep_cancel64(long sqe, long user_data, int flags) -
io_uring_prep_cancel64
-
nio_uring_prep_cancel
public static void nio_uring_prep_cancel(long sqe, long user_data, int flags) -
io_uring_prep_cancel
-
nio_uring_prep_cancel_fd
public static void nio_uring_prep_cancel_fd(long sqe, int fd, int flags) -
io_uring_prep_cancel_fd
-
nio_uring_prep_link_timeout
public static void nio_uring_prep_link_timeout(long sqe, long ts, int flags) -
io_uring_prep_link_timeout
-
nio_uring_prep_connect
public static void nio_uring_prep_connect(long sqe, int fd, long addr, int addrlen) -
io_uring_prep_connect
-
nio_uring_prep_files_update
public static void nio_uring_prep_files_update(long sqe, long fds, int nr_fds, int offset) -
io_uring_prep_files_update
-
nio_uring_prep_fallocate
public static void nio_uring_prep_fallocate(long sqe, int fd, int mode, long offset, long len) -
io_uring_prep_fallocate
-
nio_uring_prep_openat
public static void nio_uring_prep_openat(long sqe, int dfd, long path, int flags, int mode) -
io_uring_prep_openat
public static void io_uring_prep_openat(IOURingSQE sqe, int dfd, ByteBuffer path, int flags, int mode) -
io_uring_prep_openat
public static void io_uring_prep_openat(IOURingSQE sqe, int dfd, CharSequence path, int flags, int mode) -
nio_uring_prep_openat_direct
public static void nio_uring_prep_openat_direct(long sqe, int dfd, long path, int flags, int mode, int file_index) -
io_uring_prep_openat_direct
public static void io_uring_prep_openat_direct(IOURingSQE sqe, int dfd, ByteBuffer path, int flags, int mode, int file_index) -
io_uring_prep_openat_direct
public static void io_uring_prep_openat_direct(IOURingSQE sqe, int dfd, CharSequence path, int flags, int mode, int file_index) -
nio_uring_prep_close
public static void nio_uring_prep_close(long sqe, int fd) -
io_uring_prep_close
-
nio_uring_prep_close_direct
public static void nio_uring_prep_close_direct(long sqe, int file_index) -
io_uring_prep_close_direct
-
nio_uring_prep_read
public static void nio_uring_prep_read(long sqe, int fd, long buf, int nbytes, int offset) Unsafe version of:prep_read
-
io_uring_prep_read
Prepares an IO read request.The submission queue entry
sqe
is setup to use the file descriptorfd
to start readingnbytes
into the bufferbuf
at the specifiedoffset
.On files that support seeking, if the
offset
is set to -1, the read operation commences at the file offset, and the file offset is incremented by the number of bytes read. Seeread(2)
for more details.On files that are not capable of seeking, the
offset
is ignored.After the read has been prepared it can be submitted with one of the submit functions.
-
nio_uring_prep_write
public static void nio_uring_prep_write(long sqe, int fd, long buf, int nbytes, int offset) Unsafe version of:prep_write
-
io_uring_prep_write
Prepares an IO write request.The submission queue entry
sqe
is setup to use the file descriptorfd
to start writingnbytes
from the bufferbuf
at the specifiedoffset
.On files that support seeking, if the
offset
is set to -1, the write operation commences at the file offset, and the file offset is incremented by the number of bytes written. Seewrite(2)
for more details.On files that are not capable of seeking, the offset is ignored.
After the write has been prepared, it can be submitted with one of the submit functions.
-
nio_uring_prep_statx
public static void nio_uring_prep_statx(long sqe, int dfd, long path, int flags, int mask, long statxbuf) -
io_uring_prep_statx
public static void io_uring_prep_statx(IOURingSQE sqe, int dfd, ByteBuffer path, int flags, int mask, Statx statxbuf) -
io_uring_prep_statx
public static void io_uring_prep_statx(IOURingSQE sqe, int dfd, CharSequence path, int flags, int mask, Statx statxbuf) -
nio_uring_prep_fadvise
public static void nio_uring_prep_fadvise(long sqe, int fd, int offset, long len, int advice) -
io_uring_prep_fadvise
-
nio_uring_prep_madvise
public static void nio_uring_prep_madvise(long sqe, long addr, long length, int advice) -
io_uring_prep_madvise
-
nio_uring_prep_send
public static void nio_uring_prep_send(long sqe, int sockfd, long buf, long len, int flags) -
io_uring_prep_send
-
nio_uring_prep_send_set_addr
public static void nio_uring_prep_send_set_addr(long sqe, long dest_addr, short addr_len) -
io_uring_prep_send_set_addr
-
nio_uring_prep_sendto
public static void nio_uring_prep_sendto(long sqe, int sockfd, long buf, long len, int flags, long addr, int addrlen) -
io_uring_prep_sendto
public static void io_uring_prep_sendto(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags, Sockaddr addr, int addrlen) -
nio_uring_prep_send_zc
public static void nio_uring_prep_send_zc(long sqe, int sockfd, long buf, long len, int flags, int zc_flags) -
io_uring_prep_send_zc
public static void io_uring_prep_send_zc(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags, int zc_flags) -
nio_uring_prep_send_zc_fixed
public static void nio_uring_prep_send_zc_fixed(long sqe, int sockfd, long buf, long len, int flags, int zc_flags, int buf_index) -
io_uring_prep_send_zc_fixed
public static void io_uring_prep_send_zc_fixed(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags, int zc_flags, int buf_index) -
nio_uring_prep_sendmsg_zc
public static void nio_uring_prep_sendmsg_zc(long sqe, int fd, long msg, int flags) -
io_uring_prep_sendmsg_zc
-
nio_uring_prep_recv
public static void nio_uring_prep_recv(long sqe, int sockfd, long buf, long len, int flags) -
io_uring_prep_recv
-
nio_uring_prep_recv_multishot
public static void nio_uring_prep_recv_multishot(long sqe, int sockfd, long buf, long len, int flags) -
io_uring_prep_recv_multishot
public static void io_uring_prep_recv_multishot(IOURingSQE sqe, int sockfd, ByteBuffer buf, int flags) -
nio_uring_recvmsg_validate
public static long nio_uring_recvmsg_validate(long buf, int buf_len, long msgh) -
io_uring_recvmsg_validate
-
nio_uring_recvmsg_name
public static long nio_uring_recvmsg_name(long o) -
io_uring_recvmsg_name
-
nio_uring_recvmsg_cmsg_firsthdr
public static long nio_uring_recvmsg_cmsg_firsthdr(long o, long msgh) -
io_uring_recvmsg_cmsg_firsthdr
-
nio_uring_recvmsg_cmsg_nexthdr
public static long nio_uring_recvmsg_cmsg_nexthdr(long o, long msgh, long cmsg) -
io_uring_recvmsg_cmsg_nexthdr
@Nullable public static CMsghdr io_uring_recvmsg_cmsg_nexthdr(IOURingRecvmsgOut o, Msghdr msgh, CMsghdr cmsg) -
nio_uring_recvmsg_payload
public static long nio_uring_recvmsg_payload(long o, long msgh) -
io_uring_recvmsg_payload
-
nio_uring_recvmsg_payload_length
public static int nio_uring_recvmsg_payload_length(long o, int buf_len, long msgh) -
io_uring_recvmsg_payload_length
-
nio_uring_prep_openat2
public static void nio_uring_prep_openat2(long sqe, int dfd, long path, long how) -
io_uring_prep_openat2
-
io_uring_prep_openat2
-
nio_uring_prep_openat2_direct
public static void nio_uring_prep_openat2_direct(long sqe, int dfd, long path, long how, int file_index) Unsafe version of:prep_openat2_direct
-
io_uring_prep_openat2_direct
public static void io_uring_prep_openat2_direct(IOURingSQE sqe, int dfd, ByteBuffer path, OpenHow how, int file_index) open directly into the fixed file table -
io_uring_prep_openat2_direct
public static void io_uring_prep_openat2_direct(IOURingSQE sqe, int dfd, CharSequence path, OpenHow how, int file_index) open directly into the fixed file table -
nio_uring_prep_epoll_ctl
public static void nio_uring_prep_epoll_ctl(long sqe, int epfd, int fd, int op, long ev) -
io_uring_prep_epoll_ctl
-
nio_uring_prep_provide_buffers
public static void nio_uring_prep_provide_buffers(long sqe, long addr, int len, int nr, int bgid, int bid) -
io_uring_prep_provide_buffers
public static void io_uring_prep_provide_buffers(IOURingSQE sqe, ByteBuffer addr, int nr, int bgid, int bid) -
nio_uring_prep_remove_buffers
public static void nio_uring_prep_remove_buffers(long sqe, int nr, int bgid) -
io_uring_prep_remove_buffers
-
nio_uring_prep_shutdown
public static void nio_uring_prep_shutdown(long sqe, int fd, int how) -
io_uring_prep_shutdown
-
nio_uring_prep_unlinkat
public static void nio_uring_prep_unlinkat(long sqe, int dfd, long path, int flags) -
io_uring_prep_unlinkat
-
io_uring_prep_unlinkat
-
nio_uring_prep_unlink
public static void nio_uring_prep_unlink(long sqe, long path, int flags) -
io_uring_prep_unlink
-
io_uring_prep_unlink
-
nio_uring_prep_renameat
public static void nio_uring_prep_renameat(long sqe, int olddfd, long oldpath, int newdfd, long newpath, int flags) -
io_uring_prep_renameat
public static void io_uring_prep_renameat(IOURingSQE sqe, int olddfd, ByteBuffer oldpath, int newdfd, ByteBuffer newpath, int flags) -
io_uring_prep_renameat
public static void io_uring_prep_renameat(IOURingSQE sqe, int olddfd, CharSequence oldpath, int newdfd, CharSequence newpath, int flags) -
nio_uring_prep_rename
public static void nio_uring_prep_rename(long sqe, long oldpath, long newpath) -
io_uring_prep_rename
-
io_uring_prep_rename
-
nio_uring_prep_sync_file_range
public static void nio_uring_prep_sync_file_range(long sqe, int fd, int len, int offset, int flags) -
io_uring_prep_sync_file_range
public static void io_uring_prep_sync_file_range(IOURingSQE sqe, int fd, int len, int offset, int flags) -
nio_uring_prep_mkdirat
public static void nio_uring_prep_mkdirat(long sqe, int dfd, long path, int mode) -
io_uring_prep_mkdirat
-
io_uring_prep_mkdirat
-
nio_uring_prep_mkdir
public static void nio_uring_prep_mkdir(long sqe, long path, int mode) -
io_uring_prep_mkdir
-
io_uring_prep_mkdir
-
nio_uring_prep_symlinkat
public static void nio_uring_prep_symlinkat(long sqe, long target, int newdirfd, long linkpath) -
io_uring_prep_symlinkat
public static void io_uring_prep_symlinkat(IOURingSQE sqe, ByteBuffer target, int newdirfd, ByteBuffer linkpath) -
io_uring_prep_symlinkat
public static void io_uring_prep_symlinkat(IOURingSQE sqe, CharSequence target, int newdirfd, CharSequence linkpath) -
nio_uring_prep_symlink
public static void nio_uring_prep_symlink(long sqe, long target, long linkpath) -
io_uring_prep_symlink
-
io_uring_prep_symlink
public static void io_uring_prep_symlink(IOURingSQE sqe, CharSequence target, CharSequence linkpath) -
nio_uring_prep_linkat
public static void nio_uring_prep_linkat(long sqe, int olddfd, long oldpath, int newdfd, long newpath, int flags) -
io_uring_prep_linkat
public static void io_uring_prep_linkat(IOURingSQE sqe, int olddfd, ByteBuffer oldpath, int newdfd, ByteBuffer newpath, int flags) -
io_uring_prep_linkat
public static void io_uring_prep_linkat(IOURingSQE sqe, int olddfd, CharSequence oldpath, int newdfd, CharSequence newpath, int flags) -
nio_uring_prep_link
public static void nio_uring_prep_link(long sqe, long oldpath, long newpath, int flags) -
io_uring_prep_link
public static void io_uring_prep_link(IOURingSQE sqe, ByteBuffer oldpath, ByteBuffer newpath, int flags) -
io_uring_prep_link
public static void io_uring_prep_link(IOURingSQE sqe, CharSequence oldpath, CharSequence newpath, int flags) -
nio_uring_prep_msg_ring_cqe_flags
public static void nio_uring_prep_msg_ring_cqe_flags(long sqe, int fd, int len, long data, int flags, int cqe_flags) -
io_uring_prep_msg_ring_cqe_flags
public static void io_uring_prep_msg_ring_cqe_flags(IOURingSQE sqe, int fd, int len, long data, int flags, int cqe_flags) -
nio_uring_prep_msg_ring
public static void nio_uring_prep_msg_ring(long sqe, int fd, int len, long data, int flags) -
io_uring_prep_msg_ring
-
nio_uring_prep_msg_ring_fd
public static void nio_uring_prep_msg_ring_fd(long sqe, int fd, int source_fd, int target_fd, long data, int flags) -
io_uring_prep_msg_ring_fd
public static void io_uring_prep_msg_ring_fd(IOURingSQE sqe, int fd, int source_fd, int target_fd, long data, int flags) -
nio_uring_prep_msg_ring_fd_alloc
public static void nio_uring_prep_msg_ring_fd_alloc(long sqe, int fd, int source_fd, long data, int flags) -
io_uring_prep_msg_ring_fd_alloc
public static void io_uring_prep_msg_ring_fd_alloc(IOURingSQE sqe, int fd, int source_fd, long data, int flags) -
nio_uring_prep_getxattr
public static void nio_uring_prep_getxattr(long sqe, long name, long value, long path, int len) -
io_uring_prep_getxattr
public static void io_uring_prep_getxattr(IOURingSQE sqe, ByteBuffer name, ByteBuffer value, ByteBuffer path) -
io_uring_prep_getxattr
public static void io_uring_prep_getxattr(IOURingSQE sqe, CharSequence name, ByteBuffer value, CharSequence path) -
nio_uring_prep_setxattr
public static void nio_uring_prep_setxattr(long sqe, long name, long value, long path, int flags, int len) -
io_uring_prep_setxattr
public static void io_uring_prep_setxattr(IOURingSQE sqe, ByteBuffer name, ByteBuffer value, ByteBuffer path, int flags) -
io_uring_prep_setxattr
public static void io_uring_prep_setxattr(IOURingSQE sqe, CharSequence name, ByteBuffer value, CharSequence path, int flags) -
nio_uring_prep_fgetxattr
public static void nio_uring_prep_fgetxattr(long sqe, int fd, long name, long value, int len) -
io_uring_prep_fgetxattr
public static void io_uring_prep_fgetxattr(IOURingSQE sqe, int fd, ByteBuffer name, ByteBuffer value) -
io_uring_prep_fgetxattr
public static void io_uring_prep_fgetxattr(IOURingSQE sqe, int fd, CharSequence name, ByteBuffer value) -
nio_uring_prep_fsetxattr
public static void nio_uring_prep_fsetxattr(long sqe, int fd, long name, long value, int flags, int len) -
io_uring_prep_fsetxattr
public static void io_uring_prep_fsetxattr(IOURingSQE sqe, int fd, ByteBuffer name, ByteBuffer value, int flags) -
io_uring_prep_fsetxattr
public static void io_uring_prep_fsetxattr(IOURingSQE sqe, int fd, CharSequence name, ByteBuffer value, int flags) -
nio_uring_prep_socket
public static void nio_uring_prep_socket(long sqe, int domain, int type, int protocol, int flags) -
io_uring_prep_socket
public static void io_uring_prep_socket(IOURingSQE sqe, int domain, int type, int protocol, int flags) -
nio_uring_prep_socket_direct
public static void nio_uring_prep_socket_direct(long sqe, int domain, int type, int protocol, int file_index, int flags) -
io_uring_prep_socket_direct
public static void io_uring_prep_socket_direct(IOURingSQE sqe, int domain, int type, int protocol, int file_index, int flags) -
nio_uring_prep_socket_direct_alloc
public static void nio_uring_prep_socket_direct_alloc(long sqe, int domain, int type, int protocol, int flags) -
io_uring_prep_socket_direct_alloc
public static void io_uring_prep_socket_direct_alloc(IOURingSQE sqe, int domain, int type, int protocol, int flags) -
nio_uring_sq_ready
public static int nio_uring_sq_ready(long ring) Unsafe version of:sq_ready
-
io_uring_sq_ready
Returns the number of unconsumed (ifSQPOLL
) or unsubmitted entries that exist in the SQ ring belonging to thering
param. -
nio_uring_sq_space_left
public static int nio_uring_sq_space_left(long ring) Unsafe version of:sq_space_left
-
io_uring_sq_space_left
Returns how much space is left in the SQ ring belonging to thering
param. -
nio_uring_sqring_wait
public static int nio_uring_sqring_wait(long ring) Unsafe version of:sqring_wait
-
io_uring_sqring_wait
Allows the caller to wait for space to free up in the SQ ring belonging to thering
param, which happens when the kernel side thread has consumed one or more entries.If the SQ ring is currently non-full, no action is taken.
This feature can only be used when
SQPOLL
is enabled. -
nio_uring_cq_ready
public static int nio_uring_cq_ready(long ring) Unsafe version of:cq_ready
-
io_uring_cq_ready
Retuns the number of unconsumed entries that are ready belonging to thering
param. -
nio_uring_cq_has_overflow
public static boolean nio_uring_cq_has_overflow(long ring) Unsafe version of:cq_has_overflow
-
io_uring_cq_has_overflow
Returns true if there are overflow entries waiting to be flushed onto the CQ ring -
nio_uring_cq_eventfd_enabled
public static boolean nio_uring_cq_eventfd_enabled(long ring) Unsafe version of:cq_eventfd_enabled
-
io_uring_cq_eventfd_enabled
Returns true if theeventfd
notification is currently enabled. -
nio_uring_cq_eventfd_toggle
public static int nio_uring_cq_eventfd_toggle(long ring, boolean enabled) Unsafe version of:cq_eventfd_toggle
-
io_uring_cq_eventfd_toggle
Toggleeventfd
notification on or off, if aneventfd
is registered with the ring. -
nio_uring_wait_cqe_nr
public static int nio_uring_wait_cqe_nr(long ring, long cqe_ptr, int wait_nr) Unsafe version of:wait_cqe_nr
-
io_uring_wait_cqe_nr
Returnswait_nr
IO completion events from the queue belonging to thering
param, waiting for it if necessary. Thecqe_ptr
param is filled in on success.After the caller has submitted a request with
submit
, they can retrieve the completion withio_uring_wait_cqe_nr()
.- Returns:
- 0 on success and the
cqe_ptr
param is filled in. On failure it returns-errno
.
-
nio_uring_peek_cqe
public static int nio_uring_peek_cqe(long ring, long cqe_ptr) Unsafe version of:peek_cqe
-
io_uring_peek_cqe
Returns an IO completion, if one is readily available.- Returns:
- 0 with
cqe_ptr
filled in on success,-errno
on failure
-
nio_uring_wait_cqe
public static int nio_uring_wait_cqe(long ring, long cqe_ptr) Unsafe version of:wait_cqe
-
io_uring_wait_cqe
Returns an IO completion from the queue belonging to thering
param, waiting for it if necessary. Thecqe_ptr
param is filled in on success.After the caller has submitted a request with
submit
, they can retrieve the completion withio_uring_wait_cqe()
.- Returns:
- 0 on success and the
cqe_ptr
param is filled in. On failure it returns-errno
.
-
nio_uring_buf_ring_advance
public static void nio_uring_buf_ring_advance(long br, int count) -
io_uring_buf_ring_advance
-
nio_uring_buf_ring_cq_advance
public static void nio_uring_buf_ring_cq_advance(long ring, long br, int count) -
io_uring_buf_ring_cq_advance
-
nio_uring_get_sqe
public static long nio_uring_get_sqe(long ring) Unsafe version of:get_sqe
-
io_uring_get_sqe
Gets the next available submission queue entry from the submission queue belonging to thering
param.If a submission queue event is returned, it should be filled out via one of the prep functions such as
prep_read
and submitted viasubmit
.- Returns:
- a pointer to the next submission queue event on success and
NULL
on failure
-
io_uring_mlock_size
public static int io_uring_mlock_size(int entries, int flags) Return requiredulimit -l
memory space for a given ring setup. Seemlock_size_params
.- Parameters:
flags
-io_uring_params
flags
-
nio_uring_mlock_size_params
public static int nio_uring_mlock_size_params(int entries, long p) Unsafe version of:mlock_size_params
-
io_uring_mlock_size_params
Returns the requiredulimit -l memlock
memory required for a given ring setup, in bytes.May return
-errno
on error. On newer (5.12+) kernels,io_uring
no longer requires anymemlock
memory, and hence this function will return 0 for that case. On older (5.11 and prior) kernels, this will return the required memory so that the caller can ensure that enough space is available before setting up a ring with the specified parameters. -
io_uring_major_version
public static int io_uring_major_version() -
io_uring_minor_version
public static int io_uring_minor_version() -
io_uring_check_version
public static boolean io_uring_check_version(int major, int minor) -
io_uring_buf_ring_mask
public static int io_uring_buf_ring_mask(int ring_entries) Return the appropriate mask for a buffer ring of sizering_entries
-
io_uring_buf_ring_init
-
io_uring_buf_ring_add
public static void io_uring_buf_ring_add(IOURingBufRing br, ByteBuffer addr, short bid, int mask, int buf_offset)
-