diff --git a/doc/notes/3.3.5.md b/doc/notes/3.3.5.md index 7763f34275..ae8ef23442 100644 --- a/doc/notes/3.3.5.md +++ b/doc/notes/3.3.5.md @@ -7,6 +7,7 @@ This build includes the following changes: #### Bindings - libdivide: Updated to 5.1 (up from 5.0) +- liburing: Updated to 2.7 (up from 2.6) - NativeFileDialog: Update to 1.2.1 (up from 1.2.0) - OpenXR: Updated to 1.1.40 (up from 1.0.38) - stb diff --git a/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_liburing_LibURing.c b/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_liburing_LibURing.c index 08e9a9a8e5..cb8ba08cee 100644 --- a/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_liburing_LibURing.c +++ b/modules/lwjgl/core/src/generated/c/linux/org_lwjgl_system_linux_liburing_LibURing.c @@ -623,6 +623,19 @@ JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_ io_uring_prep_connect(sqe, fd, addr, (socklen_t)addrlen); } +JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1bind(JNIEnv *__env, jclass clazz, jlong sqeAddress, jint fd, jlong addrAddress, jint addrlen) { + struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; + struct sockaddr *addr = (struct sockaddr *)(uintptr_t)addrAddress; + UNUSED_PARAMS(__env, clazz) + io_uring_prep_bind(sqe, fd, addr, (socklen_t)addrlen); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1listen(JNIEnv *__env, jclass clazz, jlong sqeAddress, jint fd, jint backlog) { + struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; + UNUSED_PARAMS(__env, clazz) + io_uring_prep_listen(sqe, fd, backlog); +} + JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1files_1update(JNIEnv *__env, jclass clazz, jlong sqeAddress, jlong fdsAddress, jint nr_fds, jint offset) { struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; int *fds = (int *)(uintptr_t)fdsAddress; @@ -690,17 +703,30 @@ JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_ io_uring_prep_statx(sqe, dfd, path, flags, (unsigned int)mask, statxbuf); } -JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1fadvise(JNIEnv *__env, jclass clazz, jlong sqeAddress, jint fd, jint offset, jlong len, jint advice) { +JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1fadvise(JNIEnv *__env, jclass clazz, jlong sqeAddress, jint fd, jlong offset, jint len, jint advice) { + struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; + UNUSED_PARAMS(__env, clazz) + io_uring_prep_fadvise(sqe, fd, (__u64)offset, (__u32)len, advice); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1madvise(JNIEnv *__env, jclass clazz, jlong sqeAddress, jlong addrAddress, jint length, jint advice) { struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; + void *addr = (void *)(uintptr_t)addrAddress; UNUSED_PARAMS(__env, clazz) - io_uring_prep_fadvise(sqe, fd, offset, (off_t)len, advice); + io_uring_prep_madvise(sqe, addr, (__u32)length, advice); } -JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1madvise(JNIEnv *__env, jclass clazz, jlong sqeAddress, jlong addrAddress, jlong length, jint advice) { +JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1fadvise64(JNIEnv *__env, jclass clazz, jlong sqeAddress, jint fd, jlong offset, jint len, jint advice) { + struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; + UNUSED_PARAMS(__env, clazz) + io_uring_prep_fadvise64(sqe, fd, (__u64)offset, (__u32)len, advice); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1madvise64(JNIEnv *__env, jclass clazz, jlong sqeAddress, jlong addrAddress, jlong length, jint advice) { struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; void *addr = (void *)(uintptr_t)addrAddress; UNUSED_PARAMS(__env, clazz) - io_uring_prep_madvise(sqe, addr, (off_t)length, advice); + io_uring_prep_madvise64(sqe, addr, (off_t)length, advice); } JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1send(JNIEnv *__env, jclass clazz, jlong sqeAddress, jint sockfd, jlong bufAddress, jlong len, jint flags) { @@ -710,6 +736,12 @@ JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_ io_uring_prep_send(sqe, sockfd, buf, (size_t)len, flags); } +JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1send_1bundle(JNIEnv *__env, jclass clazz, jlong sqeAddress, jint sockfd, jlong len, jint flags) { + struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; + UNUSED_PARAMS(__env, clazz) + io_uring_prep_send_bundle(sqe, sockfd, (size_t)len, flags); +} + JNIEXPORT void JNICALL Java_org_lwjgl_system_linux_liburing_LibURing_nio_1uring_1prep_1send_1set_1addr(JNIEnv *__env, jclass clazz, jlong sqeAddress, jlong dest_addrAddress, jshort addr_len) { struct io_uring_sqe *sqe = (struct io_uring_sqe *)(uintptr_t)sqeAddress; struct sockaddr const *dest_addr = (struct sockaddr const *)(uintptr_t)dest_addrAddress; diff --git a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/IOURingParams.java b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/IOURingParams.java index aa07f6a02c..315e06659d 100644 --- a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/IOURingParams.java +++ b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/IOURingParams.java @@ -161,7 +161,7 @@ public IOURingParams(ByteBuffer container) { /** @return the value of the {@code sq_thread_idle} field. */ @NativeType("__u32") public int sq_thread_idle() { return nsq_thread_idle(address()); } - /** filled in by the kernel, which specifies various features supported by current kernel version. One or more of:
{@link LibIOURing#IORING_FEAT_SINGLE_MMAP FEAT_SINGLE_MMAP}{@link LibIOURing#IORING_FEAT_NODROP FEAT_NODROP}{@link LibIOURing#IORING_FEAT_SUBMIT_STABLE FEAT_SUBMIT_STABLE}{@link LibIOURing#IORING_FEAT_RW_CUR_POS FEAT_RW_CUR_POS}{@link LibIOURing#IORING_FEAT_CUR_PERSONALITY FEAT_CUR_PERSONALITY}
{@link LibIOURing#IORING_FEAT_FAST_POLL FEAT_FAST_POLL}{@link LibIOURing#IORING_FEAT_POLL_32BITS FEAT_POLL_32BITS}{@link LibIOURing#IORING_FEAT_SQPOLL_NONFIXED FEAT_SQPOLL_NONFIXED}{@link LibIOURing#IORING_FEAT_EXT_ARG FEAT_EXT_ARG}{@link LibIOURing#IORING_FEAT_NATIVE_WORKERS FEAT_NATIVE_WORKERS}
{@link LibIOURing#IORING_FEAT_RSRC_TAGS FEAT_RSRC_TAGS}{@link LibIOURing#IORING_FEAT_CQE_SKIP FEAT_CQE_SKIP}{@link LibIOURing#IORING_FEAT_LINKED_FILE FEAT_LINKED_FILE}{@link LibIOURing#IORING_FEAT_REG_REG_RING FEAT_REG_REG_RING}
*/ + /** filled in by the kernel, which specifies various features supported by current kernel version. One or more of:
{@link LibIOURing#IORING_FEAT_SINGLE_MMAP FEAT_SINGLE_MMAP}{@link LibIOURing#IORING_FEAT_NODROP FEAT_NODROP}{@link LibIOURing#IORING_FEAT_SUBMIT_STABLE FEAT_SUBMIT_STABLE}{@link LibIOURing#IORING_FEAT_RW_CUR_POS FEAT_RW_CUR_POS}{@link LibIOURing#IORING_FEAT_CUR_PERSONALITY FEAT_CUR_PERSONALITY}
{@link LibIOURing#IORING_FEAT_FAST_POLL FEAT_FAST_POLL}{@link LibIOURing#IORING_FEAT_POLL_32BITS FEAT_POLL_32BITS}{@link LibIOURing#IORING_FEAT_SQPOLL_NONFIXED FEAT_SQPOLL_NONFIXED}{@link LibIOURing#IORING_FEAT_EXT_ARG FEAT_EXT_ARG}{@link LibIOURing#IORING_FEAT_NATIVE_WORKERS FEAT_NATIVE_WORKERS}
{@link LibIOURing#IORING_FEAT_RSRC_TAGS FEAT_RSRC_TAGS}{@link LibIOURing#IORING_FEAT_CQE_SKIP FEAT_CQE_SKIP}{@link LibIOURing#IORING_FEAT_LINKED_FILE FEAT_LINKED_FILE}{@link LibIOURing#IORING_FEAT_REG_REG_RING FEAT_REG_REG_RING}{@link LibIOURing#IORING_FEAT_RECVSEND_BUNDLE FEAT_RECVSEND_BUNDLE}
*/ @NativeType("__u32") public int features() { return nfeatures(address()); } /** @return the value of the {@code wq_fd} field. */ diff --git a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/IOURingSQE.java b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/IOURingSQE.java index 35cfe046e3..fd351cfda9 100644 --- a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/IOURingSQE.java +++ b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/IOURingSQE.java @@ -70,6 +70,7 @@ * __u32 waitid_flags; * __u32 futex_flags; * __u32 install_fd_flags; + * __u32 nop_flags; * }; * __u64 {@link #user_data}; * union { @@ -142,6 +143,7 @@ public class IOURingSQE extends Struct implements NativeResource { WAITID_FLAGS, FUTEX_FLAGS, INSTALL_FD_FLAGS, + NOP_FLAGS, USER_DATA, BUF_INDEX, BUF_GROUP, @@ -201,6 +203,7 @@ public class IOURingSQE extends Struct implements NativeResource { __member(4), __member(4), __member(4), + __member(4), __member(4) ), __member(8), @@ -266,19 +269,20 @@ public class IOURingSQE extends Struct implements NativeResource { WAITID_FLAGS = layout.offsetof(37); FUTEX_FLAGS = layout.offsetof(38); INSTALL_FD_FLAGS = layout.offsetof(39); - USER_DATA = layout.offsetof(40); - BUF_INDEX = layout.offsetof(42); - BUF_GROUP = layout.offsetof(43); - PERSONALITY = layout.offsetof(44); - SPLICE_FD_IN = layout.offsetof(46); - FILE_INDEX = layout.offsetof(47); - OPTLEN = layout.offsetof(48); - ADDR_LEN = layout.offsetof(50); - __PAD3 = layout.offsetof(51); - ADDR3 = layout.offsetof(54); - __PAD2 = layout.offsetof(55); - OPTVAL = layout.offsetof(56); - CMD = layout.offsetof(57); + NOP_FLAGS = layout.offsetof(40); + USER_DATA = layout.offsetof(41); + BUF_INDEX = layout.offsetof(43); + BUF_GROUP = layout.offsetof(44); + PERSONALITY = layout.offsetof(45); + SPLICE_FD_IN = layout.offsetof(47); + FILE_INDEX = layout.offsetof(48); + OPTLEN = layout.offsetof(49); + ADDR_LEN = layout.offsetof(51); + __PAD3 = layout.offsetof(52); + ADDR3 = layout.offsetof(55); + __PAD2 = layout.offsetof(56); + OPTVAL = layout.offsetof(57); + CMD = layout.offsetof(58); } protected IOURingSQE(long address, @Nullable ByteBuffer container) { @@ -412,6 +416,9 @@ public IOURingSQE(ByteBuffer container) { /** @return the value of the {@code install_fd_flags} field. */ @NativeType("__u32") public int install_fd_flags() { return ninstall_fd_flags(address()); } + /** @return the value of the {@code nop_flags} field. */ + @NativeType("__u32") + public int nop_flags() { return nnop_flags(address()); } /** an application-supplied value that will be copied into the completion queue entry */ @NativeType("__u64") public long user_data() { return nuser_data(address()); } @@ -535,6 +542,8 @@ public IOURingSQE(ByteBuffer container) { public IOURingSQE futex_flags(@NativeType("__u32") int value) { nfutex_flags(address(), value); return this; } /** Sets the specified value to the {@code install_fd_flags} field. */ public IOURingSQE install_fd_flags(@NativeType("__u32") int value) { ninstall_fd_flags(address(), value); return this; } + /** Sets the specified value to the {@code nop_flags} field. */ + public IOURingSQE nop_flags(@NativeType("__u32") int value) { nnop_flags(address(), value); return this; } /** Sets the specified value to the {@link #user_data} field. */ public IOURingSQE user_data(@NativeType("__u64") long value) { nuser_data(address(), value); return this; } /** Sets the specified value to the {@link #buf_index} field. */ @@ -762,6 +771,8 @@ public static IOURingSQE.Buffer calloc(int capacity, MemoryStack stack) { public static int nfutex_flags(long struct) { return UNSAFE.getInt(null, struct + IOURingSQE.FUTEX_FLAGS); } /** Unsafe version of {@link #install_fd_flags}. */ public static int ninstall_fd_flags(long struct) { return UNSAFE.getInt(null, struct + IOURingSQE.INSTALL_FD_FLAGS); } + /** Unsafe version of {@link #nop_flags}. */ + public static int nnop_flags(long struct) { return UNSAFE.getInt(null, struct + IOURingSQE.NOP_FLAGS); } /** Unsafe version of {@link #user_data}. */ public static long nuser_data(long struct) { return UNSAFE.getLong(null, struct + IOURingSQE.USER_DATA); } /** Unsafe version of {@link #buf_index}. */ @@ -866,6 +877,8 @@ public static byte ncmd(long struct, int index) { public static void nfutex_flags(long struct, int value) { UNSAFE.putInt(null, struct + IOURingSQE.FUTEX_FLAGS, value); } /** Unsafe version of {@link #install_fd_flags(int) install_fd_flags}. */ public static void ninstall_fd_flags(long struct, int value) { UNSAFE.putInt(null, struct + IOURingSQE.INSTALL_FD_FLAGS, value); } + /** Unsafe version of {@link #nop_flags(int) nop_flags}. */ + public static void nnop_flags(long struct, int value) { UNSAFE.putInt(null, struct + IOURingSQE.NOP_FLAGS, value); } /** Unsafe version of {@link #user_data(long) user_data}. */ public static void nuser_data(long struct, long value) { UNSAFE.putLong(null, struct + IOURingSQE.USER_DATA, value); } /** Unsafe version of {@link #buf_index(short) buf_index}. */ @@ -1053,6 +1066,9 @@ protected IOURingSQE getElementFactory() { /** @return the value of the {@code install_fd_flags} field. */ @NativeType("__u32") public int install_fd_flags() { return IOURingSQE.ninstall_fd_flags(address()); } + /** @return the value of the {@code nop_flags} field. */ + @NativeType("__u32") + public int nop_flags() { return IOURingSQE.nnop_flags(address()); } /** @return the value of the {@link IOURingSQE#user_data} field. */ @NativeType("__u64") public long user_data() { return IOURingSQE.nuser_data(address()); } @@ -1172,6 +1188,8 @@ protected IOURingSQE getElementFactory() { public IOURingSQE.Buffer futex_flags(@NativeType("__u32") int value) { IOURingSQE.nfutex_flags(address(), value); return this; } /** Sets the specified value to the {@code install_fd_flags} field. */ public IOURingSQE.Buffer install_fd_flags(@NativeType("__u32") int value) { IOURingSQE.ninstall_fd_flags(address(), value); return this; } + /** Sets the specified value to the {@code nop_flags} field. */ + public IOURingSQE.Buffer nop_flags(@NativeType("__u32") int value) { IOURingSQE.nnop_flags(address(), value); return this; } /** Sets the specified value to the {@link IOURingSQE#user_data} field. */ public IOURingSQE.Buffer user_data(@NativeType("__u64") long value) { IOURingSQE.nuser_data(address(), value); return this; } /** Sets the specified value to the {@link IOURingSQE#buf_index} field. */ diff --git a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/LibIOURing.java b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/LibIOURing.java index 28a6abbc07..36ce647529 100644 --- a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/LibIOURing.java +++ b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/LibIOURing.java @@ -886,6 +886,8 @@ public class LibIOURing { *
  • {@link #IORING_OP_FUTEX_WAITV OP_FUTEX_WAITV}
  • *
  • {@link #IORING_OP_FIXED_FD_INSTALL OP_FIXED_FD_INSTALL}
  • *
  • {@link #IORING_OP_FTRUNCATE OP_FTRUNCATE}
  • + *
  • {@link #IORING_OP_BIND OP_BIND}
  • + *
  • {@link #IORING_OP_LISTEN OP_LISTEN}
  • *
  • {@link #IORING_OP_LAST OP_LAST}
  • * */ @@ -946,7 +948,9 @@ public class LibIOURing { IORING_OP_FUTEX_WAITV = 53, IORING_OP_FIXED_FD_INSTALL = 54, IORING_OP_FTRUNCATE = 55, - IORING_OP_LAST = 56; + IORING_OP_BIND = 56, + IORING_OP_LISTEN = 57, + IORING_OP_LAST = 58; public static final int IORING_URING_CMD_FIXED = 1 << 0; @@ -1065,19 +1069,44 @@ public class LibIOURing { *

    Sets {@link #IORING_CQE_F_MORE CQE_F_MORE} if the handler will continue to report CQEs on behalf of the same SQE.

    * *
  • {@link #IORING_RECVSEND_FIXED_BUF RECVSEND_FIXED_BUF} - Use registered buffers, the index is stored in the {@code buf_index} field.
  • - *
  • {@link #IORING_SEND_ZC_REPORT_USAGE SEND_ZC_REPORT_USAGE}
  • + *
  • {@link #IORING_SEND_ZC_REPORT_USAGE SEND_ZC_REPORT_USAGE} - + * If set, {@code SEND[MSG]_ZC} should report the zerocopy usage in {@code cqe.res} for the {@link #IORING_CQE_F_NOTIF CQE_F_NOTIF} cqe. + * + *

    0 is reported if zerocopy was actually possible. {@link #IORING_NOTIF_USAGE_ZC_COPIED NOTIF_USAGE_ZC_COPIED} if data was copied (at least partially).

    + *
  • + *
  • {@link #IORING_RECVSEND_BUNDLE RECVSEND_BUNDLE} - + * Used with {@link #IOSQE_BUFFER_SELECT}. + * + *

    If set, send wil grab as many buffers from the buffer group ID given and send them all. The completion result will be the number of buffers send, + * with the starting buffer ID in {@code cqe->flags} as per usual for provided buffer usage. The buffers will be contigious from the starting buffer + * ID.

    + *
  • * */ public static final int IORING_RECVSEND_POLL_FIRST = 1 << 0, IORING_RECV_MULTISHOT = 1 << 1, IORING_RECVSEND_FIXED_BUF = 1 << 2, - IORING_SEND_ZC_REPORT_USAGE = 1 << 3; + IORING_SEND_ZC_REPORT_USAGE = 1 << 3, + IORING_RECVSEND_BUNDLE = 1 << 4; public static final int IORING_NOTIF_USAGE_ZC_COPIED = 1 << 31; - /** Accept flags stored in {@code sqe->ioprio} */ - public static final int IORING_ACCEPT_MULTISHOT = 1 << 0; + /** + * Accept flags stored in {@code sqe->ioprio} + * + *
    Enum values:
    + * + *
      + *
    • {@link #IORING_ACCEPT_MULTISHOT ACCEPT_MULTISHOT}
    • + *
    • {@link #IORING_ACCEPT_DONTWAIT ACCEPT_DONTWAIT}
    • + *
    • {@link #IORING_ACCEPT_POLL_FIRST ACCEPT_POLL_FIRST}
    • + *
    + */ + public static final int + IORING_ACCEPT_MULTISHOT = 1 << 0, + IORING_ACCEPT_DONTWAIT = 1 << 1, + IORING_ACCEPT_POLL_FIRST = 1 << 2; /** * {@link #IORING_OP_MSG_RING OP_MSG_RING} command types, stored in {@code sqe->addr} @@ -1118,6 +1147,17 @@ public class LibIOURing { */ public static final int IORING_FIXED_FD_NO_CLOEXEC = 1 << 0; + /** + * {@link #IORING_OP_NOP OP_NOP} flags ({@code sqe->nop_flags}) + * + *
    Enum values:
    + * + *
      + *
    • {@link #IORING_NOP_INJECT_RESULT NOP_INJECT_RESULT} - Inject result from {@code sqe->result}.
    • + *
    + */ + public static final int IORING_NOP_INJECT_RESULT = 1 << 0; + /** * {@code cqe->flags} * @@ -1331,6 +1371,7 @@ public class LibIOURing { *

    Available since kernel 5.17.

    * *
  • {@link #IORING_FEAT_REG_REG_RING FEAT_REG_REG_RING}
  • + *
  • {@link #IORING_FEAT_RECVSEND_BUNDLE FEAT_RECVSEND_BUNDLE}
  • * */ public static final int @@ -1347,7 +1388,8 @@ public class LibIOURing { IORING_FEAT_RSRC_TAGS = 1 << 10, IORING_FEAT_CQE_SKIP = 1 << 11, IORING_FEAT_LINKED_FILE = 1 << 12, - IORING_FEAT_REG_REG_RING = 1 << 13; + IORING_FEAT_REG_REG_RING = 1 << 13, + IORING_FEAT_RECVSEND_BUNDLE = 1 << 14; /** * {@link #io_uring_register register} {@code opcodes} and arguments diff --git a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/LibURing.java b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/LibURing.java index 30d71c9009..a22d0cc375 100644 --- a/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/LibURing.java +++ b/modules/lwjgl/core/src/generated/java/org/lwjgl/system/linux/liburing/LibURing.java @@ -1286,6 +1286,22 @@ public static void io_uring_prep_connect(@NativeType("struct io_uring_sqe *") IO nio_uring_prep_connect(sqe.address(), fd, addr.address(), addrlen); } + // --- [ io_uring_prep_bind ] --- + + public static native void nio_uring_prep_bind(long sqe, int fd, long addr, int addrlen); + + public static void io_uring_prep_bind(@NativeType("struct io_uring_sqe *") IOURingSQE sqe, int fd, @NativeType("struct sockaddr *") Sockaddr addr, @NativeType("socklen_t") int addrlen) { + nio_uring_prep_bind(sqe.address(), fd, addr.address(), addrlen); + } + + // --- [ io_uring_prep_listen ] --- + + public static native void nio_uring_prep_listen(long sqe, int fd, int backlog); + + public static void io_uring_prep_listen(@NativeType("struct io_uring_sqe *") IOURingSQE sqe, int fd, int backlog) { + nio_uring_prep_listen(sqe.address(), fd, backlog); + } + // --- [ io_uring_prep_files_update ] --- public static native void nio_uring_prep_files_update(long sqe, long fds, int nr_fds, int offset); @@ -1440,20 +1456,36 @@ public static void io_uring_prep_statx(@NativeType("struct io_uring_sqe *") IOUR // --- [ io_uring_prep_fadvise ] --- - public static native void nio_uring_prep_fadvise(long sqe, int fd, int offset, long len, int advice); + public static native void nio_uring_prep_fadvise(long sqe, int fd, long offset, int len, int advice); - public static void io_uring_prep_fadvise(@NativeType("struct io_uring_sqe *") IOURingSQE sqe, int fd, int offset, @NativeType("off_t") long len, int advice) { + public static void io_uring_prep_fadvise(@NativeType("struct io_uring_sqe *") IOURingSQE sqe, int fd, @NativeType("__u64") long offset, @NativeType("__u32") int len, int advice) { nio_uring_prep_fadvise(sqe.address(), fd, offset, len, advice); } // --- [ io_uring_prep_madvise ] --- - public static native void nio_uring_prep_madvise(long sqe, long addr, long length, int advice); + public static native void nio_uring_prep_madvise(long sqe, long addr, int length, int advice); public static void io_uring_prep_madvise(@NativeType("struct io_uring_sqe *") IOURingSQE sqe, @NativeType("void *") ByteBuffer addr, int advice) { nio_uring_prep_madvise(sqe.address(), memAddress(addr), addr.remaining(), advice); } + // --- [ io_uring_prep_fadvise64 ] --- + + public static native void nio_uring_prep_fadvise64(long sqe, int fd, long offset, int len, int advice); + + public static void io_uring_prep_fadvise64(@NativeType("struct io_uring_sqe *") IOURingSQE sqe, int fd, @NativeType("__u64") long offset, @NativeType("__u32") int len, int advice) { + nio_uring_prep_fadvise64(sqe.address(), fd, offset, len, advice); + } + + // --- [ io_uring_prep_madvise64 ] --- + + public static native void nio_uring_prep_madvise64(long sqe, long addr, long length, int advice); + + public static void io_uring_prep_madvise64(@NativeType("struct io_uring_sqe *") IOURingSQE sqe, @NativeType("void *") ByteBuffer addr, int advice) { + nio_uring_prep_madvise64(sqe.address(), memAddress(addr), addr.remaining(), advice); + } + // --- [ io_uring_prep_send ] --- public static native void nio_uring_prep_send(long sqe, int sockfd, long buf, long len, int flags); @@ -1462,6 +1494,14 @@ public static void io_uring_prep_send(@NativeType("struct io_uring_sqe *") IOURi nio_uring_prep_send(sqe.address(), sockfd, memAddress(buf), buf.remaining(), flags); } + // --- [ io_uring_prep_send_bundle ] --- + + public static native void nio_uring_prep_send_bundle(long sqe, int sockfd, long len, int flags); + + public static void io_uring_prep_send_bundle(@NativeType("struct io_uring_sqe *") IOURingSQE sqe, int sockfd, @NativeType("size_t") long len, int flags) { + nio_uring_prep_send_bundle(sqe.address(), sockfd, len, flags); + } + // --- [ io_uring_prep_send_set_addr ] --- public static native void nio_uring_prep_send_set_addr(long sqe, long dest_addr, short addr_len); diff --git a/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing.h b/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing.h index 7d04aec13a..1092f3b10b 100644 --- a/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing.h +++ b/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing.h @@ -375,7 +375,7 @@ IOURINGINLINE void __io_uring_set_target_fixed_file(struct io_uring_sqe *sqe, sqe->file_index = file_index + 1; } -IOURINGINLINE void io_uring_initialize_sqe(struct io_uring_sqe *sqe) +IOURINGINLINE void io_uring_initialize_sqe(struct io_uring_sqe *sqe) { sqe->flags = 0; sqe->ioprio = 0; @@ -669,6 +669,19 @@ IOURINGINLINE void io_uring_prep_connect(struct io_uring_sqe *sqe, int fd, io_uring_prep_rw(IORING_OP_CONNECT, sqe, fd, addr, 0, addrlen); } +IOURINGINLINE void io_uring_prep_bind(struct io_uring_sqe *sqe, int fd, + struct sockaddr *addr, + socklen_t addrlen) +{ + io_uring_prep_rw(IORING_OP_BIND, sqe, fd, addr, 0, addrlen); +} + +IOURINGINLINE void io_uring_prep_listen(struct io_uring_sqe *sqe, int fd, + int backlog) +{ + io_uring_prep_rw(IORING_OP_LISTEN, sqe, fd, 0, backlog, 0); +} + IOURINGINLINE void io_uring_prep_files_update(struct io_uring_sqe *sqe, int *fds, unsigned nr_fds, int offset) @@ -731,6 +744,7 @@ IOURINGINLINE void io_uring_prep_read_multishot(struct io_uring_sqe *sqe, io_uring_prep_rw(IORING_OP_READ_MULTISHOT, sqe, fd, NULL, nbytes, offset); sqe->buf_group = buf_group; + sqe->flags = IOSQE_BUFFER_SELECT; } IOURINGINLINE void io_uring_prep_write(struct io_uring_sqe *sqe, int fd, @@ -751,19 +765,34 @@ IOURINGINLINE void io_uring_prep_statx(struct io_uring_sqe *sqe, int dfd, } IOURINGINLINE void io_uring_prep_fadvise(struct io_uring_sqe *sqe, int fd, - __u64 offset, off_t len, int advice) + __u64 offset, __u32 len, int advice) { io_uring_prep_rw(IORING_OP_FADVISE, sqe, fd, NULL, (__u32) len, offset); sqe->fadvise_advice = (__u32) advice; } IOURINGINLINE void io_uring_prep_madvise(struct io_uring_sqe *sqe, void *addr, - off_t length, int advice) + __u32 length, int advice) { io_uring_prep_rw(IORING_OP_MADVISE, sqe, -1, addr, (__u32) length, 0); sqe->fadvise_advice = (__u32) advice; } +IOURINGINLINE void io_uring_prep_fadvise64(struct io_uring_sqe *sqe, int fd, + __u64 offset, off_t len, int advice) +{ + io_uring_prep_rw(IORING_OP_FADVISE, sqe, fd, NULL, 0, offset); + sqe->addr = len; + sqe->fadvise_advice = (__u32) advice; +} + +IOURINGINLINE void io_uring_prep_madvise64(struct io_uring_sqe *sqe, void *addr, + off_t length, int advice) +{ + io_uring_prep_rw(IORING_OP_MADVISE, sqe, -1, addr, 0, length); + sqe->fadvise_advice = (__u32) advice; +} + IOURINGINLINE void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd, const void *buf, size_t len, int flags) { @@ -771,6 +800,13 @@ IOURINGINLINE void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd, sqe->msg_flags = (__u32) flags; } +IOURINGINLINE void io_uring_prep_send_bundle(struct io_uring_sqe *sqe, + int sockfd, size_t len, int flags) +{ + io_uring_prep_send(sqe, sockfd, NULL, len, flags); + sqe->ioprio |= IORING_RECVSEND_BUNDLE; +} + IOURINGINLINE void io_uring_prep_send_set_addr(struct io_uring_sqe *sqe, const struct sockaddr *dest_addr, __u16 addr_len) diff --git a/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h b/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h index bde11991bf..01c36a83f3 100644 --- a/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h +++ b/modules/lwjgl/core/src/main/c/linux/liburing/include/liburing/io_uring.h @@ -72,6 +72,7 @@ struct io_uring_sqe { __u32 waitid_flags; __u32 futex_flags; __u32 install_fd_flags; + __u32 nop_flags; }; __u64 user_data; /* data to be passed back at completion time */ /* pack this to avoid bogus arm OABI complaints */ @@ -256,6 +257,8 @@ enum io_uring_op { IORING_OP_FUTEX_WAITV, IORING_OP_FIXED_FD_INSTALL, IORING_OP_FTRUNCATE, + IORING_OP_BIND, + IORING_OP_LISTEN, /* this goes last, obviously */ IORING_OP_LAST, @@ -314,7 +317,7 @@ enum io_uring_op { * ASYNC_CANCEL flags. * * IORING_ASYNC_CANCEL_ALL Cancel all requests that match the given key - * IORING_ASYNC_CANCEL_FD Key off 'fd' for cancelation rather than the + * IORING_ASYNC_CANCEL_FD Key off 'fd' for cancelation rather than the * request 'user_data' * IORING_ASYNC_CANCEL_ANY Match any request * IORING_ASYNC_CANCEL_FD_FIXED 'fd' passed in is a fixed descriptor @@ -346,11 +349,20 @@ enum io_uring_op { * 0 is reported if zerocopy was actually possible. * IORING_NOTIF_USAGE_ZC_COPIED if data was copied * (at least partially). + * + * IORING_RECVSEND_BUNDLE Used with IOSQE_BUFFER_SELECT. If set, send wil + * grab as many buffers from the buffer group ID + * given and send them all. The completion result + * will be the number of buffers send, with the + * starting buffer ID in cqe->flags as per usual + * for provided buffer usage. The buffers will be + * contigious from the starting buffer ID. */ #define IORING_RECVSEND_POLL_FIRST (1U << 0) #define IORING_RECV_MULTISHOT (1U << 1) #define IORING_RECVSEND_FIXED_BUF (1U << 2) #define IORING_SEND_ZC_REPORT_USAGE (1U << 3) +#define IORING_RECVSEND_BUNDLE (1U << 4) /* * cqe.res for IORING_CQE_F_NOTIF if @@ -365,6 +377,8 @@ enum io_uring_op { * accept flags stored in sqe->ioprio */ #define IORING_ACCEPT_MULTISHOT (1U << 0) +#define IORING_ACCEPT_DONTWAIT (1U << 1) +#define IORING_ACCEPT_POLL_FIRST (1U << 2) /* * IORING_OP_MSG_RING command types, stored in sqe->addr @@ -391,11 +405,18 @@ enum { */ #define IORING_FIXED_FD_NO_CLOEXEC (1U << 0) +/* + * IORING_OP_NOP flags (sqe->nop_flags) + * + * IORING_NOP_INJECT_RESULT Inject result from sqe->result + */ +#define IORING_NOP_INJECT_RESULT (1U << 0) + /* * IO completion data structure (Completion Queue Entry) */ struct io_uring_cqe { - __u64 user_data; /* sqe->data submission passed back */ + __u64 user_data; /* sqe->user_data value passed back */ __s32 res; /* result code for this event */ __u32 flags; @@ -517,6 +538,7 @@ struct io_uring_params { #define IORING_FEAT_CQE_SKIP (1U << 11) #define IORING_FEAT_LINKED_FILE (1U << 12) #define IORING_FEAT_REG_REG_RING (1U << 13) +#define IORING_FEAT_RECVSEND_BUNDLE (1U << 14) /* * io_uring_register(2) opcodes and arguments diff --git a/modules/lwjgl/core/src/main/c/linux/liburing/setup.c b/modules/lwjgl/core/src/main/c/linux/liburing/setup.c index ab01ec615c..1997d2536f 100644 --- a/modules/lwjgl/core/src/main/c/linux/liburing/setup.c +++ b/modules/lwjgl/core/src/main/c/linux/liburing/setup.c @@ -199,6 +199,8 @@ __cold int io_uring_ring_dontfork(struct io_uring *ring) /* FIXME */ static size_t huge_page_size = 2 * 1024 * 1024; +#define KRING_SIZE 64 + /* * Returns negative for error, or number of bytes used in the buffer on success */ @@ -208,7 +210,7 @@ static int io_uring_alloc_huge(unsigned entries, struct io_uring_params *p, { unsigned long page_size = get_page_size(); unsigned sq_entries, cq_entries; - size_t ring_mem, sqes_mem; + size_t ring_mem, sqes_mem, cqes_mem; unsigned long mem_used = 0; void *ptr; int ret; @@ -217,14 +219,18 @@ static int io_uring_alloc_huge(unsigned entries, struct io_uring_params *p, if (ret) return ret; + ring_mem = KRING_SIZE; + sqes_mem = sq_entries * sizeof(struct io_uring_sqe); sqes_mem = (sqes_mem + page_size - 1) & ~(page_size - 1); - ring_mem = cq_entries * sizeof(struct io_uring_cqe); - if (p->flags & IORING_SETUP_CQE32) - ring_mem *= 2; if (!(p->flags & IORING_SETUP_NO_SQARRAY)) - ring_mem += sq_entries * sizeof(unsigned); - mem_used = sqes_mem + ring_mem; + sqes_mem += sq_entries * sizeof(unsigned); + + cqes_mem = cq_entries * sizeof(struct io_uring_cqe); + if (p->flags & IORING_SETUP_CQE32) + cqes_mem *= 2; + ring_mem += sqes_mem + cqes_mem; + mem_used = ring_mem; mem_used = (mem_used + page_size - 1) & ~(page_size - 1); /* @@ -498,8 +504,6 @@ static size_t npages(size_t size, long page_size) return __fls((int) size); } -#define KRING_SIZE 320 - static size_t rings_size(struct io_uring_params *p, unsigned entries, unsigned cq_entries, long page_size) { diff --git a/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/liburingTypes.kt b/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/liburingTypes.kt index 1d71e99298..eff266c746 100644 --- a/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/liburingTypes.kt +++ b/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/liburingTypes.kt @@ -72,6 +72,7 @@ val io_uring_sqe = struct(Module.CORE_LINUX_LIBURING, "IOURingSQE", nativeName = __u32("waitid_flags", "") __u32("futex_flags", "") __u32("install_fd_flags", "") + __u32("nop_flags", "") } __u64("user_data", "an application-supplied value that will be copied into the completion queue entry") union { diff --git a/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/templates/io_uring.kt b/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/templates/io_uring.kt index 3425c0458c..5b80094025 100644 --- a/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/templates/io_uring.kt +++ b/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/templates/io_uring.kt @@ -992,6 +992,8 @@ if (flags & IORING_SQ_NEED_WAKEUP) "OP_FUTEX_WAITV".enumByte, "OP_FIXED_FD_INSTALL".enumByte, "OP_FTRUNCATE".enumByte, + "OP_BIND".enumByte, + "OP_LISTEN".enumByte, "OP_LAST".enumByte ) @@ -1107,7 +1109,24 @@ if (flags & IORING_SQ_NEED_WAKEUP) "1 << 1" ), "RECVSEND_FIXED_BUF".enum("Use registered buffers, the index is stored in the {@code buf_index} field.", "1 << 2"), - "SEND_ZC_REPORT_USAGE".enum("", "1 << 3") + "SEND_ZC_REPORT_USAGE".enum( + """ + If set, {@code SEND[MSG]_ZC} should report the zerocopy usage in {@code cqe.res} for the #CQE_F_NOTIF cqe. + + 0 is reported if zerocopy was actually possible. #NOTIF_USAGE_ZC_COPIED if data was copied (at least partially). + """, + "1 << 3" + ), + "RECVSEND_BUNDLE".enum( + """ + Used with #IOSQE_BUFFER_SELECT. + + If set, send wil grab as many buffers from the buffer group ID given and send them all. The completion result will be the number of buffers send, + with the starting buffer ID in {@code cqe->flags} as per usual for provided buffer usage. The buffers will be contigious from the starting buffer + ID. + """, + "1 << 4" + ) ) IntConstant("", "NOTIF_USAGE_ZC_COPIED".."1 << 31") @@ -1115,7 +1134,9 @@ if (flags & IORING_SQ_NEED_WAKEUP) EnumConstant( "Accept flags stored in {@code sqe->ioprio}", - "ACCEPT_MULTISHOT".enum("", "1 << 0") + "ACCEPT_MULTISHOT".enum("", "1 << 0"), + "ACCEPT_DONTWAIT".enum("", "1 << 1"), + "ACCEPT_POLL_FIRST".enum("", "1 << 2") ) EnumConstant( @@ -1138,6 +1159,12 @@ if (flags & IORING_SQ_NEED_WAKEUP) "FIXED_FD_NO_CLOEXEC".enum("Don't mark the fd as {@code O_CLOEXEC}.", "1 << 0") ) + EnumConstant( + "#OP_NOP flags ({@code sqe->nop_flags})", + + "NOP_INJECT_RESULT".enum("Inject result from {@code sqe->result}.", "1 << 0") + ) + EnumConstant( "{@code cqe->flags}", @@ -1375,7 +1402,8 @@ int io_uring_enter(unsigned int fd, unsigned int to_submit, """, "1 << 12" ), - "FEAT_REG_REG_RING".enum("", "1 << 13") + "FEAT_REG_REG_RING".enum("", "1 << 13"), + "FEAT_RECVSEND_BUNDLE".enum("", "1 << 14") ) EnumConstant( diff --git a/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/templates/liburing.kt b/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/templates/liburing.kt index eb274a6138..74711c1d60 100644 --- a/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/templates/liburing.kt +++ b/modules/lwjgl/core/src/templates/kotlin/core/linux/liburing/templates/liburing.kt @@ -1207,6 +1207,25 @@ struct io_uring_buf { socklen_t("addrlen", "") ) + void( + "prep_bind", + "", + + io_uring_sqe.p("sqe", ""), + int("fd", ""), + sockaddr.p("addr", ""), + socklen_t("addrlen", "") + ) + + void( + "prep_listen", + "", + + io_uring_sqe.p("sqe", ""), + int("fd", ""), + int("backlog", "") + ) + void( "prep_files_update", "", @@ -1344,8 +1363,8 @@ struct io_uring_buf { io_uring_sqe.p("sqe", ""), int("fd", ""), - int("offset", ""), - off_t("len", ""), + __u64("offset", ""), + __u32("len", ""), int("advice", "") // TODO: ) @@ -1353,6 +1372,27 @@ struct io_uring_buf { "prep_madvise", "", + io_uring_sqe.p("sqe", ""), + void.p("addr", ""), + AutoSize("addr")..__u32("length", ""), + int("advice", "") // TODO: + ) + + void( + "prep_fadvise64", + "", + + io_uring_sqe.p("sqe", ""), + int("fd", ""), + __u64("offset", ""), + __u32("len", ""), + int("advice", "") // TODO: + ) + + void( + "prep_madvise64", + "", + io_uring_sqe.p("sqe", ""), void.p("addr", ""), AutoSize("addr")..off_t("length", ""), @@ -1370,6 +1410,16 @@ struct io_uring_buf { int("flags", "") ) + void( + "prep_send_bundle", + "", + + io_uring_sqe.p("sqe", ""), + int("sockfd", ""), + size_t("len", ""), + int("flags", "") + ) + void( "prep_send_set_addr", "", diff --git a/modules/lwjgl/libdivide/src/generated/java/org/lwjgl/util/libdivide/LibDivide.java b/modules/lwjgl/libdivide/src/generated/java/org/lwjgl/util/libdivide/LibDivide.java index 9e7d25f7bd..a8513f32a1 100644 --- a/modules/lwjgl/libdivide/src/generated/java/org/lwjgl/util/libdivide/LibDivide.java +++ b/modules/lwjgl/libdivide/src/generated/java/org/lwjgl/util/libdivide/LibDivide.java @@ -28,7 +28,7 @@ public class LibDivide { /** Library version. */ public static final int LIBDIVIDE_VERSION_MAJOR = 5, - LIBDIVIDE_VERSION_MINOR = 0; + LIBDIVIDE_VERSION_MINOR = 1; /** *
    Enum values: