Class IOURingParams
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.system.linux.liburing.IOURingParams
-
- All Implemented Interfaces:
java.lang.AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
public class IOURingParams extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResourcePassed in forsetup. Copied back with updated info on success.The
flags,sq_thread_cpu, andsq_thread_idlefields are used to configure theio_uringinstance. If noflagsare specified, theio_uringinstance is setup for interrupt driven I/O. I/O may be submitted usingenterand can be reaped by polling the completion queue.The rest of the fields are filled in by the kernel, and provide the information necessary to memory map the submission queue, completion queue, and the array of submission queue entries.
sq_offdescribes the offsets of various ring buffer fields. Taken together,sq_entriesandsq_offprovide all of the information necessary for accessing the submission queue ring buffer and the submission queue entry array. The submission queue can be mapped with a call like:ptr = mmap(0, sq_off.array + sq_entries * sizeof(__u32), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, ring_fd, IORING_OFF_SQ_RING);where
sq_offis theio_sqring_offsetsstructure, andring_fdis the file descriptor returned fromsetup. The addition ofsq_off.arrayto the length of the region accounts for the fact that the ring located at the end of the data structure. As an example, the ring buffer head pointer can be accessed by addingsq_off.headto the address returned frommmap(2):head = ptr + sq_off.head;The array of submission queue entries is mapped with:
sqentries = mmap(0, sq_entries * sizeof(struct io_uring_sqe), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, ring_fd, IORING_OFF_SQES);The completion queue is described by
cq_entriesandcq_off. The completion queue is simpler, since the entries are not separated from the queue itself, and can be mapped with:ptr = mmap(0, cq_off.cqes + cq_entries * sizeof(struct io_uring_cqe), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, ring_fd, IORING_OFF_CQ_RING);Layout
struct io_uring_params { __u32sq_entries(); __u32 cq_entries; __u32flags(); __u32 sq_thread_cpu; __u32 sq_thread_idle; __u32features(); __u32 wq_fd; __u32 resv[3];struct io_sqring_offsetssq_off();struct io_cqring_offsetscq_off; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIOURingParams.BufferAn array ofIOURingParamsstructs.
-
Field Summary
Fields Modifier and Type Field Description static intALIGNOFThe struct alignment in bytes.static intCQ_ENTRIES
CQ_OFF
FEATURES
FLAGS
RESVThe struct member offsets.static intSIZEOFThe struct size in bytes.static intSQ_ENTRIES
SQ_OFF
SQ_THREAD_CPU
SQ_THREAD_IDLE
WQ_FDThe struct member offsets.
-
Constructor Summary
Constructors Constructor Description IOURingParams(java.nio.ByteBuffer container)Creates aIOURingParamsinstance at the current position of the specifiedByteBuffercontainer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IOURingParamscalloc()Returns a newIOURingParamsinstance allocated withmemCalloc.static IOURingParams.Buffercalloc(int capacity)Returns a newIOURingParams.Bufferinstance allocated withmemCalloc.static IOURingParams.Buffercalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newIOURingParams.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static IOURingParamscalloc(org.lwjgl.system.MemoryStack stack)Returns a newIOURingParamsinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.intcq_entries()IOURingParamscq_entries(int value)Sets the specified value to thecq_entriesfield.IOCQRingOffsetscq_off()IOURingParamscq_off(java.util.function.Consumer<IOCQRingOffsets> consumer)Passes thecq_offfield to the specifiedConsumer.IOURingParamscq_off(IOCQRingOffsets value)Copies the specifiedIOCQRingOffsetsto thecq_offfield.static IOURingParamscreate()Returns a newIOURingParamsinstance allocated withBufferUtils.static IOURingParams.Buffercreate(int capacity)Returns a newIOURingParams.Bufferinstance allocated withBufferUtils.static IOURingParamscreate(long address)Returns a newIOURingParamsinstance for the specified memory address.static IOURingParams.Buffercreate(long address, int capacity)Create aIOURingParams.Bufferinstance at the specified memory.static IOURingParamscreateSafe(long address)static IOURingParams.BuffercreateSafe(long address, int capacity)intfeatures()filled in by the kernel, which specifies various features supported by current kernel version.IOURingParamsfeatures(int value)Sets the specified value to thefeatures()field.intflags()IOURingParamsflags(int value)Sets the specified value to theflags()field.static IOURingParamsmalloc()Returns a newIOURingParamsinstance allocated withmemAlloc.static IOURingParams.Buffermalloc(int capacity)Returns a newIOURingParams.Bufferinstance allocated withmemAlloc.static IOURingParams.Buffermalloc(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newIOURingParams.Bufferinstance allocated on the specifiedMemoryStack.static IOURingParamsmalloc(org.lwjgl.system.MemoryStack stack)Returns a newIOURingParamsinstance allocated on the specifiedMemoryStack.static intncq_entries(long struct)Unsafe version ofcq_entries().static voidncq_entries(long struct, int value)Unsafe version ofcq_entries.static IOCQRingOffsetsncq_off(long struct)Unsafe version ofcq_off().static voidncq_off(long struct, IOCQRingOffsets value)Unsafe version ofcq_off.static intnfeatures(long struct)Unsafe version offeatures().static voidnfeatures(long struct, int value)Unsafe version offeatures.static intnflags(long struct)Unsafe version offlags().static voidnflags(long struct, int value)Unsafe version offlags.static java.nio.IntBuffernresv(long struct)Unsafe version ofresv().static intnresv(long struct, int index)Unsafe version ofresv.static voidnresv(long struct, int index, int value)Unsafe version ofresv.static voidnresv(long struct, java.nio.IntBuffer value)Unsafe version ofresv.static intnsq_entries(long struct)Unsafe version ofsq_entries().static voidnsq_entries(long struct, int value)Unsafe version ofsq_entries.static IOSQRingOffsetsnsq_off(long struct)Unsafe version ofsq_off().static voidnsq_off(long struct, IOSQRingOffsets value)Unsafe version ofsq_off.static intnsq_thread_cpu(long struct)Unsafe version ofsq_thread_cpu().static voidnsq_thread_cpu(long struct, int value)Unsafe version ofsq_thread_cpu.static intnsq_thread_idle(long struct)Unsafe version ofsq_thread_idle().static voidnsq_thread_idle(long struct, int value)Unsafe version ofsq_thread_idle.static intnwq_fd(long struct)Unsafe version ofwq_fd().static voidnwq_fd(long struct, int value)Unsafe version ofwq_fd.java.nio.IntBufferresv()intresv(int index)IOURingParamsresv(int index, int value)Sets the specified value at the specified index of theresvfield.IOURingParamsresv(java.nio.IntBuffer value)Copies the specifiedIntBufferto theresvfield.IOURingParamsset(int sq_entries, int cq_entries, int flags, int sq_thread_cpu, int sq_thread_idle, int features, int wq_fd, java.nio.IntBuffer resv, IOSQRingOffsets sq_off, IOCQRingOffsets cq_off)Initializes this struct with the specified values.IOURingParamsset(IOURingParams src)Copies the specified struct data to this struct.intsizeof()intsq_entries()the number of submission queue entries allocatedIOURingParamssq_entries(int value)Sets the specified value to thesq_entries()field.IOSQRingOffsetssq_off()Theflagsfield is used by the kernel to communicate state information to the application.IOURingParamssq_off(java.util.function.Consumer<IOSQRingOffsets> consumer)Passes thesq_off()field to the specifiedConsumer.IOURingParamssq_off(IOSQRingOffsets value)Copies the specifiedIOSQRingOffsetsto thesq_off()field.intsq_thread_cpu()IOURingParamssq_thread_cpu(int value)Sets the specified value to thesq_thread_cpufield.intsq_thread_idle()IOURingParamssq_thread_idle(int value)Sets the specified value to thesq_thread_idlefield.intwq_fd()IOURingParamswq_fd(int value)Sets the specified value to thewq_fdfield.
-
-
-
Constructor Detail
-
IOURingParams
public IOURingParams(java.nio.ByteBuffer container)
Creates aIOURingParamsinstance at the current position of the specifiedByteBuffercontainer. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Detail
-
sizeof
public int sizeof()
- Specified by:
sizeofin classorg.lwjgl.system.Struct
-
sq_entries
public int sq_entries()
the number of submission queue entries allocated
-
cq_entries
public int cq_entries()
- Returns:
- the value of the
cq_entriesfield.
-
flags
public int flags()
-
sq_thread_cpu
public int sq_thread_cpu()
- Returns:
- the value of the
sq_thread_cpufield.
-
sq_thread_idle
public int sq_thread_idle()
- Returns:
- the value of the
sq_thread_idlefield.
-
features
public int features()
filled in by the kernel, which specifies various features supported by current kernel version. One or more of:FEAT_SINGLE_MMAPFEAT_NODROPFEAT_SUBMIT_STABLEFEAT_RW_CUR_POSFEAT_CUR_PERSONALITYFEAT_FAST_POLLFEAT_POLL_32BITSFEAT_SQPOLL_NONFIXEDFEAT_EXT_ARGFEAT_NATIVE_WORKERSFEAT_RSRC_TAGSFEAT_CQE_SKIP
-
wq_fd
public int wq_fd()
- Returns:
- the value of the
wq_fdfield.
-
resv
public java.nio.IntBuffer resv()
- Returns:
- a
IntBufferview of theresvfield.
-
resv
public int resv(int index)
- Returns:
- the value at the specified index of the
resvfield.
-
sq_off
public IOSQRingOffsets sq_off()
Theflagsfield is used by the kernel to communicate state information to the application. Currently, it is used to inform the application when a call toenteris necessary.The
droppedmember is incremented for each invalid submission queue entry encountered in the ring buffer.The
headandtailtrack the ring buffer state. Thetailis incremented by the application when submitting new I/O, and theheadis incremented by the kernel when the I/O has been successfully submitted. Determining the index of theheadortailinto the ring is accomplished by applying a mask:index = tail & ring_mask;
-
cq_off
public IOCQRingOffsets cq_off()
- Returns:
- a
IOCQRingOffsetsview of thecq_offfield.
-
sq_entries
public IOURingParams sq_entries(int value)
Sets the specified value to thesq_entries()field.
-
cq_entries
public IOURingParams cq_entries(int value)
Sets the specified value to thecq_entriesfield.
-
flags
public IOURingParams flags(int value)
Sets the specified value to theflags()field.
-
sq_thread_cpu
public IOURingParams sq_thread_cpu(int value)
Sets the specified value to thesq_thread_cpufield.
-
sq_thread_idle
public IOURingParams sq_thread_idle(int value)
Sets the specified value to thesq_thread_idlefield.
-
features
public IOURingParams features(int value)
Sets the specified value to thefeatures()field.
-
wq_fd
public IOURingParams wq_fd(int value)
Sets the specified value to thewq_fdfield.
-
resv
public IOURingParams resv(java.nio.IntBuffer value)
Copies the specifiedIntBufferto theresvfield.
-
resv
public IOURingParams resv(int index, int value)
Sets the specified value at the specified index of theresvfield.
-
sq_off
public IOURingParams sq_off(IOSQRingOffsets value)
Copies the specifiedIOSQRingOffsetsto thesq_off()field.
-
sq_off
public IOURingParams sq_off(java.util.function.Consumer<IOSQRingOffsets> consumer)
Passes thesq_off()field to the specifiedConsumer.
-
cq_off
public IOURingParams cq_off(IOCQRingOffsets value)
Copies the specifiedIOCQRingOffsetsto thecq_offfield.
-
cq_off
public IOURingParams cq_off(java.util.function.Consumer<IOCQRingOffsets> consumer)
Passes thecq_offfield to the specifiedConsumer.
-
set
public IOURingParams set(int sq_entries, int cq_entries, int flags, int sq_thread_cpu, int sq_thread_idle, int features, int wq_fd, java.nio.IntBuffer resv, IOSQRingOffsets sq_off, IOCQRingOffsets cq_off)
Initializes this struct with the specified values.
-
set
public IOURingParams set(IOURingParams src)
Copies the specified struct data to this struct.- Parameters:
src- the source struct- Returns:
- this struct
-
malloc
public static IOURingParams malloc()
Returns a newIOURingParamsinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static IOURingParams calloc()
Returns a newIOURingParamsinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static IOURingParams create()
Returns a newIOURingParamsinstance allocated withBufferUtils.
-
create
public static IOURingParams create(long address)
Returns a newIOURingParamsinstance for the specified memory address.
-
createSafe
@Nullable public static IOURingParams createSafe(long address)
-
malloc
public static IOURingParams.Buffer malloc(int capacity)
Returns a newIOURingParams.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static IOURingParams.Buffer calloc(int capacity)
Returns a newIOURingParams.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static IOURingParams.Buffer create(int capacity)
Returns a newIOURingParams.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static IOURingParams.Buffer create(long address, int capacity)
Create aIOURingParams.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
@Nullable public static IOURingParams.Buffer createSafe(long address, int capacity)
-
malloc
public static IOURingParams malloc(org.lwjgl.system.MemoryStack stack)
Returns a newIOURingParamsinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
public static IOURingParams calloc(org.lwjgl.system.MemoryStack stack)
Returns a newIOURingParamsinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
public static IOURingParams.Buffer malloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newIOURingParams.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
calloc
public static IOURingParams.Buffer calloc(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newIOURingParams.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
nsq_entries
public static int nsq_entries(long struct)
Unsafe version ofsq_entries().
-
ncq_entries
public static int ncq_entries(long struct)
Unsafe version ofcq_entries().
-
nflags
public static int nflags(long struct)
Unsafe version offlags().
-
nsq_thread_cpu
public static int nsq_thread_cpu(long struct)
Unsafe version ofsq_thread_cpu().
-
nsq_thread_idle
public static int nsq_thread_idle(long struct)
Unsafe version ofsq_thread_idle().
-
nfeatures
public static int nfeatures(long struct)
Unsafe version offeatures().
-
nwq_fd
public static int nwq_fd(long struct)
Unsafe version ofwq_fd().
-
nresv
public static java.nio.IntBuffer nresv(long struct)
Unsafe version ofresv().
-
nresv
public static int nresv(long struct, int index)Unsafe version ofresv.
-
nsq_off
public static IOSQRingOffsets nsq_off(long struct)
Unsafe version ofsq_off().
-
ncq_off
public static IOCQRingOffsets ncq_off(long struct)
Unsafe version ofcq_off().
-
nsq_entries
public static void nsq_entries(long struct, int value)Unsafe version ofsq_entries.
-
ncq_entries
public static void ncq_entries(long struct, int value)Unsafe version ofcq_entries.
-
nflags
public static void nflags(long struct, int value)Unsafe version offlags.
-
nsq_thread_cpu
public static void nsq_thread_cpu(long struct, int value)Unsafe version ofsq_thread_cpu.
-
nsq_thread_idle
public static void nsq_thread_idle(long struct, int value)Unsafe version ofsq_thread_idle.
-
nfeatures
public static void nfeatures(long struct, int value)Unsafe version offeatures.
-
nwq_fd
public static void nwq_fd(long struct, int value)Unsafe version ofwq_fd.
-
nresv
public static void nresv(long struct, java.nio.IntBuffer value)Unsafe version ofresv.
-
nresv
public static void nresv(long struct, int index, int value)Unsafe version ofresv.
-
nsq_off
public static void nsq_off(long struct, IOSQRingOffsets value)Unsafe version ofsq_off.
-
ncq_off
public static void ncq_off(long struct, IOCQRingOffsets value)Unsafe version ofcq_off.
-
-