^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Will go away once libc support is there
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <sys/syscall.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <sys/uio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <signal.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "liburing.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifdef __alpha__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * alpha is the only exception, all other architectures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * have common numbers for new system calls.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) # ifndef __NR_io_uring_setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) # define __NR_io_uring_setup 535
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) # ifndef __NR_io_uring_enter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) # define __NR_io_uring_enter 536
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) # ifndef __NR_io_uring_register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) # define __NR_io_uring_register 537
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #else /* !__alpha__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) # ifndef __NR_io_uring_setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) # define __NR_io_uring_setup 425
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) # ifndef __NR_io_uring_enter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) # define __NR_io_uring_enter 426
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) # ifndef __NR_io_uring_register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) # define __NR_io_uring_register 427
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) # endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) int io_uring_register(int fd, unsigned int opcode, void *arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) unsigned int nr_args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) return syscall(__NR_io_uring_register, fd, opcode, arg, nr_args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) int io_uring_setup(unsigned int entries, struct io_uring_params *p)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) return syscall(__NR_io_uring_setup, entries, p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int io_uring_enter(int fd, unsigned int to_submit, unsigned int min_complete,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned int flags, sigset_t *sig)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return syscall(__NR_io_uring_enter, fd, to_submit, min_complete,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) flags, sig, _NSIG / 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }