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 | |
Jens Axboe | 004d564 | 2019-05-22 08:59:12 -0600 | [diff] [blame] | 10 | #ifdef __alpha__ |
| 11 | /* |
| 12 | * alpha is the only exception, all other architectures |
| 13 | * have common numbers for new system calls. |
| 14 | */ |
| 15 | # ifndef __NR_io_uring_setup |
| 16 | # define __NR_io_uring_setup 535 |
| 17 | # endif |
| 18 | # ifndef __NR_io_uring_enter |
| 19 | # define __NR_io_uring_enter 536 |
| 20 | # endif |
| 21 | # ifndef __NR_io_uring_register |
| 22 | # define __NR_io_uring_register 537 |
| 23 | # endif |
| 24 | #else /* !__alpha__ */ |
| 25 | # ifndef __NR_io_uring_setup |
| 26 | # define __NR_io_uring_setup 425 |
| 27 | # endif |
| 28 | # ifndef __NR_io_uring_enter |
| 29 | # define __NR_io_uring_enter 426 |
| 30 | # endif |
| 31 | # ifndef __NR_io_uring_register |
| 32 | # define __NR_io_uring_register 427 |
| 33 | # endif |
Jens Axboe | 21b4aa5 | 2019-03-06 09:03:50 -0700 | [diff] [blame] | 34 | #endif |
| 35 | |
| 36 | int io_uring_register(int fd, unsigned int opcode, void *arg, |
| 37 | unsigned int nr_args) |
| 38 | { |
Jens Axboe | 004d564 | 2019-05-22 08:59:12 -0600 | [diff] [blame] | 39 | return syscall(__NR_io_uring_register, fd, opcode, arg, nr_args); |
Jens Axboe | 21b4aa5 | 2019-03-06 09:03:50 -0700 | [diff] [blame] | 40 | } |
| 41 | |
Jens Axboe | 004d564 | 2019-05-22 08:59:12 -0600 | [diff] [blame] | 42 | int io_uring_setup(unsigned int entries, struct io_uring_params *p) |
Jens Axboe | 21b4aa5 | 2019-03-06 09:03:50 -0700 | [diff] [blame] | 43 | { |
Jens Axboe | 004d564 | 2019-05-22 08:59:12 -0600 | [diff] [blame] | 44 | return syscall(__NR_io_uring_setup, entries, p); |
Jens Axboe | 21b4aa5 | 2019-03-06 09:03:50 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Jens Axboe | 004d564 | 2019-05-22 08:59:12 -0600 | [diff] [blame] | 47 | int io_uring_enter(int fd, unsigned int to_submit, unsigned int min_complete, |
| 48 | unsigned int flags, sigset_t *sig) |
Jens Axboe | 21b4aa5 | 2019-03-06 09:03:50 -0700 | [diff] [blame] | 49 | { |
Jens Axboe | 004d564 | 2019-05-22 08:59:12 -0600 | [diff] [blame] | 50 | return syscall(__NR_io_uring_enter, fd, to_submit, min_complete, |
Jens Axboe | 21b4aa5 | 2019-03-06 09:03:50 -0700 | [diff] [blame] | 51 | flags, sig, _NSIG / 8); |
| 52 | } |