Jens Axboe | e502435 | 2020-02-11 20:34:12 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: MIT */ |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Will go away once libc support is there |
| 4 | */ |
| 5 | #include <unistd.h> |
| 6 | #include <sys/syscall.h> |
| 7 | #include <sys/uio.h> |
Stefan Hajnoczi | c31c7ec | 2019-07-24 09:24:50 +0100 | [diff] [blame] | 8 | #include "liburing/compat.h" |
| 9 | #include "liburing/io_uring.h" |
Jens Axboe | 96144ea | 2019-12-01 11:21:39 -0700 | [diff] [blame] | 10 | #include "syscall.h" |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 11 | |
Dmitry V. Levin | 375bed7 | 2019-05-20 13:14:56 +0300 | [diff] [blame] | 12 | #ifdef __alpha__ |
| 13 | /* |
| 14 | * alpha is the only exception, all other architectures |
| 15 | * have common numbers for new system calls. |
| 16 | */ |
| 17 | # ifndef __NR_io_uring_setup |
| 18 | # define __NR_io_uring_setup 535 |
| 19 | # endif |
| 20 | # ifndef __NR_io_uring_enter |
| 21 | # define __NR_io_uring_enter 536 |
| 22 | # endif |
| 23 | # ifndef __NR_io_uring_register |
| 24 | # define __NR_io_uring_register 537 |
| 25 | # endif |
| 26 | #else /* !__alpha__ */ |
| 27 | # ifndef __NR_io_uring_setup |
| 28 | # define __NR_io_uring_setup 425 |
| 29 | # endif |
| 30 | # ifndef __NR_io_uring_enter |
| 31 | # define __NR_io_uring_enter 426 |
| 32 | # endif |
| 33 | # ifndef __NR_io_uring_register |
| 34 | # define __NR_io_uring_register 427 |
| 35 | # endif |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 36 | #endif |
| 37 | |
Jens Axboe | 96144ea | 2019-12-01 11:21:39 -0700 | [diff] [blame] | 38 | int __sys_io_uring_register(int fd, unsigned opcode, const void *arg, |
| 39 | unsigned nr_args) |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 40 | { |
Dmitry V. Levin | 329ba3d | 2019-05-20 13:13:42 +0300 | [diff] [blame] | 41 | return syscall(__NR_io_uring_register, fd, opcode, arg, nr_args); |
Jens Axboe | d5b4ae1 | 2019-01-10 14:28:10 -0700 | [diff] [blame] | 42 | } |
| 43 | |
Jens Axboe | 96144ea | 2019-12-01 11:21:39 -0700 | [diff] [blame] | 44 | int __sys_io_uring_setup(unsigned entries, struct io_uring_params *p) |
Jens Axboe | d5b4ae1 | 2019-01-10 14:28:10 -0700 | [diff] [blame] | 45 | { |
Dmitry V. Levin | 329ba3d | 2019-05-20 13:13:42 +0300 | [diff] [blame] | 46 | return syscall(__NR_io_uring_setup, entries, p); |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 47 | } |
| 48 | |
Jens Axboe | 96144ea | 2019-12-01 11:21:39 -0700 | [diff] [blame] | 49 | int __sys_io_uring_enter(int fd, unsigned to_submit, unsigned min_complete, |
| 50 | unsigned flags, sigset_t *sig) |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 51 | { |
Dmitry V. Levin | 329ba3d | 2019-05-20 13:13:42 +0300 | [diff] [blame] | 52 | return syscall(__NR_io_uring_enter, fd, to_submit, min_complete, |
Jens Axboe | e377c38 | 2019-02-08 11:40:17 -0700 | [diff] [blame] | 53 | flags, sig, _NSIG / 8); |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 54 | } |