Created
September 6, 2023 17:18
-
-
Save Buggaboo/558bf72aa7c0dc14591e38f12602aa6d to your computer and use it in GitHub Desktop.
Detect io_uring support on your machine / docker image etc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Linux command-line: | |
1. uname -r # expect 5 and above | |
2. grep io_uring_setup /proc/kallsyms # expect 2 lines | |
3. gcc test_io_uring.c -o test_io_uring && ./test_io_uring | |
```C | |
// test_io_uring.c | |
#include <stdio.h> | |
#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) { | |
printf("%s", "nope\n"); | |
return -1; | |
} else { | |
printf("%s", "yep\n"); | |
return 0; | |
} | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment