• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: MIT */
2 #define _DEFAULT_SOURCE
3 
4 /*
5  * Will go away once libc support is there
6  */
7 #include <unistd.h>
8 #include <sys/syscall.h>
9 #include <sys/uio.h>
10 #include "liburing/compat.h"
11 #include "liburing/io_uring.h"
12 #include "syscall.h"
13 
14 #ifdef __alpha__
15 /*
16  * alpha is the only exception, all other architectures
17  * have common numbers for new system calls.
18  */
19 # ifndef __NR_io_uring_setup
20 #  define __NR_io_uring_setup		535
21 # endif
22 # ifndef __NR_io_uring_enter
23 #  define __NR_io_uring_enter		536
24 # endif
25 # ifndef __NR_io_uring_register
26 #  define __NR_io_uring_register	537
27 # endif
28 #else /* !__alpha__ */
29 # ifndef __NR_io_uring_setup
30 #  define __NR_io_uring_setup		425
31 # endif
32 # ifndef __NR_io_uring_enter
33 #  define __NR_io_uring_enter		426
34 # endif
35 # ifndef __NR_io_uring_register
36 #  define __NR_io_uring_register	427
37 # endif
38 #endif
39 
__sys_io_uring_register(int fd,unsigned opcode,const void * arg,unsigned nr_args)40 int __sys_io_uring_register(int fd, unsigned opcode, const void *arg,
41 			    unsigned nr_args)
42 {
43 	return syscall(__NR_io_uring_register, fd, opcode, arg, nr_args);
44 }
45 
__sys_io_uring_setup(unsigned entries,struct io_uring_params * p)46 int __sys_io_uring_setup(unsigned entries, struct io_uring_params *p)
47 {
48 	return syscall(__NR_io_uring_setup, entries, p);
49 }
50 
__sys_io_uring_enter2(int fd,unsigned to_submit,unsigned min_complete,unsigned flags,sigset_t * sig,int sz)51 int __sys_io_uring_enter2(int fd, unsigned to_submit, unsigned min_complete,
52 			 unsigned flags, sigset_t *sig, int sz)
53 {
54 	return syscall(__NR_io_uring_enter, fd, to_submit, min_complete,
55 			flags, sig, sz);
56 }
57 
__sys_io_uring_enter(int fd,unsigned to_submit,unsigned min_complete,unsigned flags,sigset_t * sig)58 int __sys_io_uring_enter(int fd, unsigned to_submit, unsigned min_complete,
59 			 unsigned flags, sigset_t *sig)
60 {
61 	return __sys_io_uring_enter2(fd, to_submit, min_complete, flags, sig,
62 					_NSIG / 8);
63 }
64