Repository: netty/netty
File: transport-classes-io_uring/src/main/java/io/netty/channel/uring/Native.java (Java)

Code before:
        return ioUringProbe(ringFd, new int[] { Native.IORING_OP_SOCKET });
    }

    static boolean isIOUringSupportSplice(int ringFd) {
        // IORING_OP_SPLICE Available since 5.7
        return ioUringProbe(ringFd, new int[] { Native.IORING_OP_SPLICE });
    }

    /**
     * check current kernel version whether support io_uring_register_io_wq_worker
     * Available since 5.15.
     * @return true if support io_uring_register_io_wq_worker
     */
    static boolean isRegisterIOWQWorkerSupported(int ringFd) {
        // See https://github.com/torvalds/linux/blob/v5.5/fs/io_uring.c#L5488C10-L5488C16
        int result = ioUringRegisterIoWqMaxWorkers(ringFd, 0, 0);
        if (result >= 0) {
            return true;
        }
        // This is not supported and so will return -EINVAL
        return false;
    }

    static void checkKernelVersion(String kernelVersion) {
        boolean enforceKernelVersion = SystemPropertyUtil.getBoolean(
                "io.netty5.transport.iouring.enforceKernelVersion", true);
        boolean kernelSupported = checkKernelVersion(kernelVersion, 5, 9);
        if (!kernelSupported) {
            if (enforceKernelVersion) {
                throw new UnsupportedOperationException(
                        "you need at least kernel version 5.9, current kernel version: " + kernelVersion);
            } else {
                logger.debug("Detected kernel " + kernelVersion + " does not match minimum version of 5.9, " +
                        "trying to use io_uring anyway");
            }
        }
    }

    private static boolean checkKernelVersion(String kernelVersion, int major, int minor) {
        String[] versionComponents = kernelVersion.split("\\.");
        if (versionComponents.length < 3) {
            return false;
        }
        int nativeMajor;
        try {
            nativeMajor = Integer.parseInt(versionComponents[0]);
        } catch (NumberFormatException e) {
            return false;
        }

        if (nativeMajor < major) {

Review comment (suggestion):
```suggestion
                "io.netty.transport.iouring.enforceKernelVersion", true);
```

Code after:
        return ioUringProbe(ringFd, new int[] { Native.IORING_OP_SOCKET });
    }

    static boolean isIOUringSupportSplice(int ringFd) {
        // IORING_OP_SPLICE Available since 5.7
        return ioUringProbe(ringFd, new int[] { Native.IORING_OP_SPLICE });
    }

    /**
     * check current kernel version whether support io_uring_register_io_wq_worker
     * Available since 5.15.
     * @return true if support io_uring_register_io_wq_worker
     */
    static boolean isRegisterIOWQWorkerSupported(int ringFd) {
        // See https://github.com/torvalds/linux/blob/v5.5/fs/io_uring.c#L5488C10-L5488C16
        int result = ioUringRegisterIoWqMaxWorkers(ringFd, 0, 0);
        if (result >= 0) {
            return true;
        }
        // This is not supported and so will return -EINVAL
        return false;
    }

    static void checkKernelVersion(String kernelVersion) {
        boolean enforceKernelVersion = SystemPropertyUtil.getBoolean(
                "io.netty.transport.iouring.enforceKernelVersion", true);
        boolean kernelSupported = checkKernelVersion(kernelVersion, 5, 9);
        if (!kernelSupported) {
            if (enforceKernelVersion) {
                throw new UnsupportedOperationException(
                        "you need at least kernel version 5.9, current kernel version: " + kernelVersion);
            } else {
                logger.debug("Detected kernel " + kernelVersion + " does not match minimum version of 5.9, " +
                        "trying to use io_uring anyway");
            }
        }
    }

    private static boolean checkKernelVersion(String kernelVersion, int major, int minor) {
        String[] versionComponents = kernelVersion.split("\\.");
        if (versionComponents.length < 3) {
            return false;
        }
        int nativeMajor;
        try {
            nativeMajor = Integer.parseInt(versionComponents[0]);
        } catch (NumberFormatException e) {
            return false;
        }

        if (nativeMajor < major) {