blob: 598b5312072e81899d52319f80ba2d9609a0c0ae [file] [log] [blame]
Jens Axboee5024352020-02-11 20:34:12 -07001/* SPDX-License-Identifier: MIT */
Jens Axboef93c84e2019-01-08 06:51:07 -07002/*
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 Hajnoczic31c7ec2019-07-24 09:24:50 +01008#include "liburing/compat.h"
9#include "liburing/io_uring.h"
Jens Axboe96144ea2019-12-01 11:21:39 -070010#include "syscall.h"
Jens Axboef93c84e2019-01-08 06:51:07 -070011
Dmitry V. Levin375bed72019-05-20 13:14:56 +030012#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 Axboef93c84e2019-01-08 06:51:07 -070036#endif
37
Jens Axboe96144ea2019-12-01 11:21:39 -070038int __sys_io_uring_register(int fd, unsigned opcode, const void *arg,
39 unsigned nr_args)
Jens Axboef93c84e2019-01-08 06:51:07 -070040{
Dmitry V. Levin329ba3d2019-05-20 13:13:42 +030041 return syscall(__NR_io_uring_register, fd, opcode, arg, nr_args);
Jens Axboed5b4ae12019-01-10 14:28:10 -070042}
43
Jens Axboe96144ea2019-12-01 11:21:39 -070044int __sys_io_uring_setup(unsigned entries, struct io_uring_params *p)
Jens Axboed5b4ae12019-01-10 14:28:10 -070045{
Dmitry V. Levin329ba3d2019-05-20 13:13:42 +030046 return syscall(__NR_io_uring_setup, entries, p);
Jens Axboef93c84e2019-01-08 06:51:07 -070047}
48
Jens Axboe96144ea2019-12-01 11:21:39 -070049int __sys_io_uring_enter(int fd, unsigned to_submit, unsigned min_complete,
50 unsigned flags, sigset_t *sig)
Jens Axboef93c84e2019-01-08 06:51:07 -070051{
Dmitry V. Levin329ba3d2019-05-20 13:13:42 +030052 return syscall(__NR_io_uring_enter, fd, to_submit, min_complete,
Jens Axboee377c382019-02-08 11:40:17 -070053 flags, sig, _NSIG / 8);
Jens Axboef93c84e2019-01-08 06:51:07 -070054}