2019-01-08 06:51:07 -07:00
|
|
|
/*
|
|
|
|
|
* Will go away once libc support is there
|
|
|
|
|
*/
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
|
#include <sys/uio.h>
|
2019-02-08 11:40:17 -07:00
|
|
|
#include <signal.h>
|
2019-01-15 11:14:43 -07:00
|
|
|
#include "compat.h"
|
2019-01-08 06:51:07 -07:00
|
|
|
#include "io_uring.h"
|
|
|
|
|
|
2019-01-23 08:03:41 -07:00
|
|
|
#if defined(__x86_64) || defined(__i386__)
|
2019-01-08 06:51:07 -07:00
|
|
|
#ifndef __NR_sys_io_uring_setup
|
2019-01-23 08:03:41 -07:00
|
|
|
#define __NR_sys_io_uring_setup 425
|
2019-01-08 06:51:07 -07:00
|
|
|
#endif
|
|
|
|
|
#ifndef __NR_sys_io_uring_enter
|
2019-01-23 08:03:41 -07:00
|
|
|
#define __NR_sys_io_uring_enter 426
|
2019-01-10 14:28:10 -07:00
|
|
|
#endif
|
|
|
|
|
#ifndef __NR_sys_io_uring_register
|
2019-01-23 08:03:41 -07:00
|
|
|
#define __NR_sys_io_uring_register 427
|
2019-01-13 11:03:04 -07:00
|
|
|
#endif
|
2019-01-08 06:51:07 -07:00
|
|
|
#else
|
|
|
|
|
#error "Arch not supported yet"
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-01-16 08:41:05 -07:00
|
|
|
int io_uring_register(int fd, unsigned int opcode, void *arg,
|
|
|
|
|
unsigned int nr_args)
|
2019-01-10 14:28:10 -07:00
|
|
|
{
|
2019-01-16 08:41:05 -07:00
|
|
|
return syscall(__NR_sys_io_uring_register, fd, opcode, arg, nr_args);
|
2019-01-10 14:28:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int io_uring_setup(unsigned int entries, struct io_uring_params *p)
|
2019-01-08 06:51:07 -07:00
|
|
|
{
|
2019-01-10 14:28:10 -07:00
|
|
|
return syscall(__NR_sys_io_uring_setup, entries, p);
|
2019-01-08 06:51:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int io_uring_enter(int fd, unsigned int to_submit, unsigned int min_complete,
|
2019-02-08 11:40:17 -07:00
|
|
|
unsigned int flags, sigset_t *sig)
|
2019-01-08 06:51:07 -07:00
|
|
|
{
|
|
|
|
|
return syscall(__NR_sys_io_uring_enter, fd, to_submit, min_complete,
|
2019-02-08 11:40:17 -07:00
|
|
|
flags, sig, _NSIG / 8);
|
2019-01-08 06:51:07 -07:00
|
|
|
}
|