Jens Axboe | 21b4aa5 | 2019-03-06 09:03:50 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Will go away once libc support is there |
| 3 | */ |
| 4 | #include <unistd.h> |
| 5 | #include <sys/syscall.h> |
| 6 | #include <sys/uio.h> |
| 7 | #include <signal.h> |
| 8 | #include "liburing.h" |
| 9 | |
| 10 | #if defined(__x86_64) || defined(__i386__) |
| 11 | #ifndef __NR_sys_io_uring_setup |
| 12 | #define __NR_sys_io_uring_setup 425 |
| 13 | #endif |
| 14 | #ifndef __NR_sys_io_uring_enter |
| 15 | #define __NR_sys_io_uring_enter 426 |
| 16 | #endif |
| 17 | #ifndef __NR_sys_io_uring_register |
| 18 | #define __NR_sys_io_uring_register 427 |
| 19 | #endif |
| 20 | #else |
| 21 | #error "Arch not supported yet" |
| 22 | #endif |
| 23 | |
| 24 | int io_uring_register(int fd, unsigned int opcode, void *arg, |
| 25 | unsigned int nr_args) |
| 26 | { |
| 27 | return syscall(__NR_sys_io_uring_register, fd, opcode, arg, nr_args); |
| 28 | } |
| 29 | |
| 30 | int io_uring_setup(unsigned entries, struct io_uring_params *p) |
| 31 | { |
| 32 | return syscall(__NR_sys_io_uring_setup, entries, p); |
| 33 | } |
| 34 | |
| 35 | int io_uring_enter(unsigned fd, unsigned to_submit, unsigned min_complete, |
| 36 | unsigned flags, sigset_t *sig) |
| 37 | { |
| 38 | return syscall(__NR_sys_io_uring_enter, fd, to_submit, min_complete, |
| 39 | flags, sig, _NSIG / 8); |
| 40 | } |