Skip to content

Instantly share code, notes, and snippets.

@Buggaboo
Created September 6, 2023 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Buggaboo/558bf72aa7c0dc14591e38f12602aa6d to your computer and use it in GitHub Desktop.
Save Buggaboo/558bf72aa7c0dc14591e38f12602aa6d to your computer and use it in GitHub Desktop.
Detect io_uring support on your machine / docker image etc.
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