Class IOURingParams
- All Implemented Interfaces:
AutoCloseable,org.lwjgl.system.NativeResource,org.lwjgl.system.Pointer
setup. Copied back with updated info on success.
The flags, sq_thread_cpu, and sq_thread_idle fields are used to configure the io_uring instance. If no flags
are specified, the io_uring instance is setup for interrupt driven I/O. I/O may be submitted using enter and 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_off describes the offsets of various ring buffer fields. Taken together, sq_entries and sq_off provide 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_off is the io_sqring_offsets structure, and ring_fd is the file descriptor returned from setup. The addition of
sq_off.array to 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 adding sq_off.head to the address returned from mmap(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_entries and cq_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 {
__u32 sq_entries();
__u32 cq_entries;
__u32 flags();
__u32 sq_thread_cpu;
__u32 sq_thread_idle;
__u32 features();
__u32 wq_fd;
__u32 resv[3];
struct io_sqring_offsets sq_off();
struct io_cqring_offsets cq_off;
}-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.lwjgl.system.Struct
org.lwjgl.system.Struct.StructValidationNested classes/interfaces inherited from interface org.lwjgl.system.Pointer
org.lwjgl.system.Pointer.Default -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe struct alignment in bytes.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct size in bytes.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.static final intThe struct member offsets.Fields inherited from interface org.lwjgl.system.Pointer
BITS32, BITS64, CLONG_SHIFT, CLONG_SIZE, POINTER_SHIFT, POINTER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionIOURingParams(ByteBuffer container) Creates aIOURingParamsinstance at the current position of the specifiedByteBuffercontainer. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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(int value) Sets the specified value to thecq_entriesfield.cq_off()cq_off(Consumer<IOCQRingOffsets> consumer) Passes thecq_offfield to the specifiedConsumer.cq_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 @Nullable IOURingParamscreateSafe(long address) static @Nullable IOURingParams.BuffercreateSafe(long address, int capacity) intfeatures()filled in by the kernel, which specifies various features supported by current kernel version.features(int value) Sets the specified value to thefeatures()field.intflags()flags(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 IntBuffernresv(long struct) static intnresv(long struct, int index) static voidnresv(long struct, int index, int value) static voidstatic 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.set(int sq_entries, int cq_entries, int flags, int sq_thread_cpu, int sq_thread_idle, int features, int wq_fd, IOSQRingOffsets sq_off, IOCQRingOffsets cq_off) Initializes this struct with the specified values.set(IOURingParams src) Copies the specified struct data to this struct.intsizeof()intthe number of submission queue entries allocatedsq_entries(int value) Sets the specified value to thesq_entries()field.sq_off()Theflagsfield is used by the kernel to communicate state information to the application.sq_off(Consumer<IOSQRingOffsets> consumer) sq_off(IOSQRingOffsets value) Copies the specifiedIOSQRingOffsetsto thesq_off()field.intsq_thread_cpu(int value) Sets the specified value to thesq_thread_cpufield.intsq_thread_idle(int value) Sets the specified value to thesq_thread_idlefield.intwq_fd()wq_fd(int value) Sets the specified value to thewq_fdfield.Methods inherited from class org.lwjgl.system.Struct
clear, free, isNull, validate, validateMethods inherited from class org.lwjgl.system.Pointer.Default
address, equals, hashCode, toStringMethods inherited from interface org.lwjgl.system.NativeResource
close, free
-
Field Details
-
SIZEOF
public static final int SIZEOFThe struct size in bytes. -
ALIGNOF
public static final int ALIGNOFThe struct alignment in bytes. -
SQ_ENTRIES
public static final int SQ_ENTRIESThe struct member offsets. -
CQ_ENTRIES
public static final int CQ_ENTRIESThe struct member offsets. -
FLAGS
public static final int FLAGSThe struct member offsets. -
SQ_THREAD_CPU
public static final int SQ_THREAD_CPUThe struct member offsets. -
SQ_THREAD_IDLE
public static final int SQ_THREAD_IDLEThe struct member offsets. -
FEATURES
public static final int FEATURESThe struct member offsets. -
WQ_FD
public static final int WQ_FDThe struct member offsets. -
RESV
public static final int RESVThe struct member offsets. -
SQ_OFF
public static final int SQ_OFFThe struct member offsets. -
CQ_OFF
public static final int CQ_OFFThe struct member offsets.
-
-
Constructor Details
-
IOURingParams
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 Details
-
sizeof
public int sizeof()- Specified by:
sizeofin classorg.lwjgl.system.Struct<IOURingParams>
-
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: -
wq_fd
public int wq_fd()- Returns:
- the value of the
wq_fdfield.
-
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
- Returns:
- a
IOCQRingOffsetsview of thecq_offfield.
-
sq_entries
Sets the specified value to thesq_entries()field. -
cq_entries
Sets the specified value to thecq_entriesfield. -
flags
Sets the specified value to theflags()field. -
sq_thread_cpu
Sets the specified value to thesq_thread_cpufield. -
sq_thread_idle
Sets the specified value to thesq_thread_idlefield. -
features
Sets the specified value to thefeatures()field. -
wq_fd
Sets the specified value to thewq_fdfield. -
sq_off
Copies the specifiedIOSQRingOffsetsto thesq_off()field. -
sq_off
-
cq_off
Copies the specifiedIOCQRingOffsetsto thecq_offfield. -
cq_off
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, IOSQRingOffsets sq_off, IOCQRingOffsets cq_off) Initializes this struct with the specified values. -
set
Copies the specified struct data to this struct.- Parameters:
src- the source struct- Returns:
- this struct
-
malloc
Returns a newIOURingParamsinstance allocated withmemAlloc. The instance must be explicitly freed. -
calloc
Returns a newIOURingParamsinstance allocated withmemCalloc. The instance must be explicitly freed. -
create
Returns a newIOURingParamsinstance allocated withBufferUtils. -
create
Returns a newIOURingParamsinstance for the specified memory address. -
createSafe
-
malloc
Returns a newIOURingParams.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
Returns a newIOURingParams.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
Returns a newIOURingParams.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
Create aIOURingParams.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
createSafe
-
malloc
Returns a newIOURingParamsinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
calloc
Returns a newIOURingParamsinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
malloc
Returns a newIOURingParams.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
calloc
Returns a newIOURingParams.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacitystack- the stack from which to allocate
-
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
-
nresv
public static int nresv(long struct, int index) -
nsq_off
Unsafe version ofsq_off(). -
ncq_off
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
-
nresv
public static void nresv(long struct, int index, int value) -
nsq_off
Unsafe version ofsq_off. -
ncq_off
Unsafe version ofcq_off.
-