Top Description Inners Fields Constructors Methods
org.lwjgl.system.linux.liburing

public Class IOURingParams

extends Struct<IOURingParams>
implements NativeResource
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.NativeResource, java.lang.AutoCloseable
Annotations
@NativeType:struct io_uring_params
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

Passed in for 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 and Inner Type Summary

Modifier and TypeClass and Description
public static class
IOURingParams.Buffer

An array of IOURingParams structs.

Field Summary

Modifier and TypeField and Description
public static final int
ALIGNOF

The struct alignment in bytes.

public static final int
CQ_ENTRIES

The struct member offsets.

public static final int
CQ_OFF

The struct member offsets.

public static final int
FEATURES

The struct member offsets.

public static final int
FLAGS

The struct member offsets.

public static final int
RESV

The struct member offsets.

public static final int
SIZEOF

The struct size in bytes.

public static final int
SQ_ENTRIES

The struct member offsets.

public static final int
SQ_OFF

The struct member offsets.

public static final int
SQ_THREAD_CPU

The struct member offsets.

public static final int
SQ_THREAD_IDLE

The struct member offsets.

public static final int
WQ_FD

The struct member offsets.

Inherited from org.lwjgl.system.Struct:
containerDEFAULT_ALIGN_ASDEFAULT_PACK_ALIGNMENT

Constructor Summary

AccessConstructor and Description
protected
IOURingParams(long address, ByteBuffer container)

public
IOURingParams(ByteBuffer container)

Creates a IOURingParams instance at the current position of the specified ByteBuffer container.

Method Summary

Modifier and TypeMethod and Description
public static IOURingParams
calloc()

Returns a new IOURingParams instance allocated with memCalloc.

public static IOURingParams.Buffer
calloc(int
the buffer capacity
capacity
)

Returns a new IOURingParams.Buffer instance allocated with memCalloc.

public static IOURingParams
calloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new IOURingParams instance allocated on the specified MemoryStack and initializes all its bits to zero.

public static IOURingParams.Buffer
calloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new IOURingParams.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.

public int

Returns:

the value of the cq_entries field.
cq_entries
()

public IOURingParams
cq_entries(int value)

Sets the specified value to the cq_entries field.

public IOCQRingOffsets

Returns:

a IOCQRingOffsets view of the cq_off field.
cq_off
()

public IOURingParams
cq_off(IOCQRingOffsets value)

Copies the specified IOCQRingOffsets to the cq_off field.

public IOURingParams
cq_off(Consumer<IOCQRingOffsets> consumer)

Passes the cq_off field to the specified Consumer.

protected IOURingParams
create(long
the struct memory address
address
,
ByteBuffer
an optional container buffer, to be referenced strongly by the struct instance.
container
)

Implements abstract org.lwjgl.system.Struct.create.

Similar to the constructor, but returns the exact type of the Struct subclass.
public static IOURingParams
create()

Returns a new IOURingParams instance allocated with BufferUtils.

public static IOURingParams
create(long address)

Returns a new IOURingParams instance for the specified memory address.

public static IOURingParams.Buffer
create(int
the buffer capacity
capacity
)

Returns a new IOURingParams.Buffer instance allocated with BufferUtils.

public static IOURingParams.Buffer
create(long
the memory address
address
,
int
the buffer capacity
capacity
)

Create a IOURingParams.Buffer instance at the specified memory.

public static IOURingParams
createSafe(long address)

Like create, but returns null if address is NULL.

public static IOURingParams.Buffer
createSafe(long address, int capacity)

Like create, but returns null if address is NULL.

public int
features()

filled in by the kernel, which specifies various features supported by current kernel version.

public IOURingParams
features(int value)

Sets the specified value to the features field.

public int
public IOURingParams
flags(int value)

Sets the specified value to the flags field.

public static IOURingParams
malloc()

Returns a new IOURingParams instance allocated with memAlloc.

public static IOURingParams.Buffer
malloc(int
the buffer capacity
capacity
)

Returns a new IOURingParams.Buffer instance allocated with memAlloc.

public static IOURingParams
malloc(MemoryStack
the stack from which to allocate
stack
)

Returns a new IOURingParams instance allocated on the specified MemoryStack.

public static IOURingParams.Buffer
malloc(int
the buffer capacity
capacity
,
MemoryStack
the stack from which to allocate
stack
)

Returns a new IOURingParams.Buffer instance allocated on the specified MemoryStack.

public static int
ncq_entries(long struct)

Unsafe version of cq_entries.

public static void
ncq_entries(long struct, int value)

Unsafe version of cq_entries.

public static IOCQRingOffsets
ncq_off(long struct)

Unsafe version of cq_off.

public static void
ncq_off(long struct, IOCQRingOffsets value)

Unsafe version of cq_off.

public static int
nfeatures(long struct)

Unsafe version of features.

public static void
nfeatures(long struct, int value)

Unsafe version of features.

public static int
nflags(long struct)

Unsafe version of flags.

public static void
nflags(long struct, int value)

Unsafe version of flags.

public static IntBuffer
nresv(long struct)

Unsafe version of resv.

public static int
nresv(long struct, int index)

Unsafe version of resv.

public static void
nresv(long struct, IntBuffer value)

Unsafe version of resv.

public static void
nresv(long struct, int index, int value)

Unsafe version of resv.

public static int
nsq_entries(long struct)

Unsafe version of sq_entries.

public static void
nsq_entries(long struct, int value)

Unsafe version of sq_entries.

public static IOSQRingOffsets
nsq_off(long struct)

Unsafe version of sq_off.

public static void
nsq_off(long struct, IOSQRingOffsets value)

Unsafe version of sq_off.

public static int
nsq_thread_cpu(long struct)

Unsafe version of sq_thread_cpu.

public static void
nsq_thread_cpu(long struct, int value)

Unsafe version of sq_thread_cpu.

public static int
nsq_thread_idle(long struct)

Unsafe version of sq_thread_idle.

public static void
nsq_thread_idle(long struct, int value)

Unsafe version of sq_thread_idle.

public static int
nwq_fd(long struct)

Unsafe version of wq_fd.

public static void
nwq_fd(long struct, int value)

Unsafe version of wq_fd.

public IntBuffer

Returns:

a IntBuffer view of the resv field.
resv
()

public int

Returns:

the value at the specified index of the resv field.
resv
(int index)

public IOURingParams
resv(IntBuffer value)

Copies the specified IntBuffer to the resv field.

public IOURingParams
resv(int index, int value)

Sets the specified value at the specified index of the resv field.

public IOURingParams
set(int sq_entries, int cq_entries, int flags, int sq_thread_cpu, int sq_thread_idle, int features, int wq_fd, IntBuffer resv, IOSQRingOffsets sq_off, IOCQRingOffsets cq_off)

Initializes this struct with the specified values.

public IOURingParams

Returns:

this struct
set
(IOURingParams
the source struct
src
)

Copies the specified struct data to this struct.

public int
sizeof()

Implements abstract org.lwjgl.system.Struct.sizeof.

Returns sizeof(struct).
public int
sq_entries()

the number of submission queue entries allocated

public IOURingParams
sq_entries(int value)

Sets the specified value to the sq_entries field.

public IOSQRingOffsets
sq_off()

The flags field is used by the kernel to communicate state information to the application.

public IOURingParams
sq_off(IOSQRingOffsets value)

Copies the specified IOSQRingOffsets to the sq_off field.

public IOURingParams
sq_off(Consumer<IOSQRingOffsets> consumer)

Passes the sq_off field to the specified Consumer.

public int

Returns:

the value of the sq_thread_cpu field.
sq_thread_cpu
()

public IOURingParams
sq_thread_cpu(int value)

Sets the specified value to the sq_thread_cpu field.

public int

Returns:

the value of the sq_thread_idle field.
sq_thread_idle
()

public IOURingParams
sq_thread_idle(int value)

Sets the specified value to the sq_thread_idle field.

public int

Returns:

the value of the wq_fd field.
wq_fd
()

public IOURingParams
wq_fd(int value)

Sets the specified value to the wq_fd field.

Inherited from org.lwjgl.system.Struct:
__array__array__array__checkContainer__checkMalloc__create__getContainer__getContainer__member__member__member__padding__padding__struct__struct__union__unionclearfreeisNullvalidate