I would like to check whether a Linux machine supports io_uring. How can this be done?
Is there some kernel file that describes support for this, or do all Linux 5.1+ kernels have support?
io_uring doesn’t expose any user-visible features, e.g. as a sysctl; it only exposes new system calls. It is available since kernel 5.1, but support for it can be compiled out, and it might be backported to older kernels in some systems.
The safest way to check for support is therefore to check whether the io_uring system calls are available. If you have /proc/kallsyms, you can look there:
grep io_uring_setup /proc/kallsyms
Another way to check for the system call is to attempt a safe but malformed call, and check whether the resulting error is ENOSYS, for example:
#include <errno.h>
#include <linux/io_uring.h>
#include <stddef.h>
#include <sys/syscall.h>
#include <unistd.h>
int main(int argc, char **argv) {
if (syscall(__NR_io_uring_register, 0, IORING_UNREGISTER_BUFFERS, NULL, 0) && errno == ENOSYS) {
// No io_uring
} else {
// io_uring
}
}
On a kernel supporting io_uring, the available operations vary as new features are introduced with new kernel versions; to determine the supported operations, use io_uring_get_probe.
ENOSYS (which is how it’s supposed to be done).
It's available from Linux 5.1 and upwards and can be enabled during compiling. In Debian and derivatives you can locate the kernel options used during compilation in file /boot/config-{kernel version}-{arch}. In UEFI machines this path may be different.
So type,
grep -i uring /boot/config-$(uname -r)
The output should include CONFIG_IO_URING, y or n, enable or not.
libseccompnot the kernel...