18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Will go away once libc support is there 38c2ecf20Sopenharmony_ci */ 48c2ecf20Sopenharmony_ci#include <unistd.h> 58c2ecf20Sopenharmony_ci#include <sys/syscall.h> 68c2ecf20Sopenharmony_ci#include <sys/uio.h> 78c2ecf20Sopenharmony_ci#include <signal.h> 88c2ecf20Sopenharmony_ci#include "liburing.h" 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifdef __alpha__ 118c2ecf20Sopenharmony_ci/* 128c2ecf20Sopenharmony_ci * alpha is the only exception, all other architectures 138c2ecf20Sopenharmony_ci * have common numbers for new system calls. 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci# ifndef __NR_io_uring_setup 168c2ecf20Sopenharmony_ci# define __NR_io_uring_setup 535 178c2ecf20Sopenharmony_ci# endif 188c2ecf20Sopenharmony_ci# ifndef __NR_io_uring_enter 198c2ecf20Sopenharmony_ci# define __NR_io_uring_enter 536 208c2ecf20Sopenharmony_ci# endif 218c2ecf20Sopenharmony_ci# ifndef __NR_io_uring_register 228c2ecf20Sopenharmony_ci# define __NR_io_uring_register 537 238c2ecf20Sopenharmony_ci# endif 248c2ecf20Sopenharmony_ci#else /* !__alpha__ */ 258c2ecf20Sopenharmony_ci# ifndef __NR_io_uring_setup 268c2ecf20Sopenharmony_ci# define __NR_io_uring_setup 425 278c2ecf20Sopenharmony_ci# endif 288c2ecf20Sopenharmony_ci# ifndef __NR_io_uring_enter 298c2ecf20Sopenharmony_ci# define __NR_io_uring_enter 426 308c2ecf20Sopenharmony_ci# endif 318c2ecf20Sopenharmony_ci# ifndef __NR_io_uring_register 328c2ecf20Sopenharmony_ci# define __NR_io_uring_register 427 338c2ecf20Sopenharmony_ci# endif 348c2ecf20Sopenharmony_ci#endif 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciint io_uring_register(int fd, unsigned int opcode, void *arg, 378c2ecf20Sopenharmony_ci unsigned int nr_args) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci return syscall(__NR_io_uring_register, fd, opcode, arg, nr_args); 408c2ecf20Sopenharmony_ci} 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciint io_uring_setup(unsigned int entries, struct io_uring_params *p) 438c2ecf20Sopenharmony_ci{ 448c2ecf20Sopenharmony_ci return syscall(__NR_io_uring_setup, entries, p); 458c2ecf20Sopenharmony_ci} 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciint io_uring_enter(int fd, unsigned int to_submit, unsigned int min_complete, 488c2ecf20Sopenharmony_ci unsigned int flags, sigset_t *sig) 498c2ecf20Sopenharmony_ci{ 508c2ecf20Sopenharmony_ci return syscall(__NR_io_uring_enter, fd, to_submit, min_complete, 518c2ecf20Sopenharmony_ci flags, sig, _NSIG / 8); 528c2ecf20Sopenharmony_ci} 53