Back when I was adding nolibc support for liburing, I added new
wrapper functions for io_uring system calls. They are ____sys_io_uring*
functions (with 4 underscores), all defined as an inline function.
I left __sys_uring* functions (with 2 underscores) live in syscall.c
because I thought it might break the user if we delete them. But it
turned out that I was wrong, no user should use these functions
because we don't export them. This situation is reflected in
liburing.map and liburing.h which don't have those functions.
Do these:
1) Delete src/syscall.c.
2) Rename ____sys_io_uring* to __sys_io_uring*.
3) Fix tests that still depend on libc `errno` for checking
__sys_io_uring* functions error code.
to:
1) Reduce the burden of maintaining syscall.c.
2) Simplify the Makefile, no need extra branch to compile syscall.c
with a specific condition.
3) Simplify function naming and kill the confusion of deciding
using __sys_uring* or ____sys_io_uring* when adding a new test that
directly calls them. Because now we always use __sys_io_uring*.
____sys_io_uring* functions no longer exist.
After this patch, __sys_io_uring* functions now return -errno instead
of -1 when fails.
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Link: https://lore.kernel.org/r/20220721090443.733104-1-ammarfaizi2@gnuweeb.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit fixes build for armv8l.
On some systems, the macro `errno` is defined as
`#define errno (*__errno())`
It is clear that `__errno` is a global function on such systems.
The problem is, `io_uring_setup.c` uses `int __errno` as a local
variable, so it shadows the `__errno` function, result in the
following error:
```
CC io_uring_setup
io_uring_setup.c:116:12: error: called object type 'int' is not a function or function pointer
__errno = errno;
^~~~~
/usr/include/errno.h:58:24: note: expanded from macro 'errno'
#define errno (*__errno())
~~~~~~~^
1 error generated.
make[1]: *** [Makefile:163: io_uring_setup] Error 1
make[1]: *** Waiting for unfinished jobs....
```
Fix this by not using `__errno` as local variable name.
Reported-by: Louvian Lyndal <louvianlyndal@gmail.com>
Tested-by: Louvian Lyndal <louvianlyndal@gmail.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gmail.com>
Link: https://lore.kernel.org/r/2d53ef3f50713749511865a7f89e27c5378e316d.1631692342.git.ammarfaizi2@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Rename the io_uring_* system calls to __sys_io_uring_* and make them
locals.
We only have the system calls because they are not in glibc yet, and
it's somewhat confusing that they share the same namespace as the
library functions. With this change, any exported io_uring_* function
is a library function.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
It is not possible to install barrier.h and compat.h into the top-level
/usr/include directly since they are likely to conflict with other
software. io_uring.h could be confused with the system's kernel header
file.
Put liburing headers into <liburing/*.h> so there is no chance of
conflicts or confusion.
Existing applications continue to build successfully since the location
of <liburing.h> is unchanged. In-tree examples and tests require
modification because src/liburing.h is moved to src/include/liburing.h.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
SQPOLL requires root, if the tests are run as a user, we'll get
EPERM instead of EINVAL. Don't fail the test because of that, just
mention it in the log.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
For the IORING_SETUP_SQPOLL|IORING_SETUP_SQ_AFF test case, add_pipe is
not set, and the output is like:
"...flags: IORING_SETUP_SQPOLLIORING_SETUP_SQ_AFF...".
Set add_pipe for IORING_SETUP_SQPOLL flag so that the output is like:
"...flags: IORING_SETUP_SQPOLL|IORING_SETUP_SQ_AFF...".
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Shenghui Wang <shhuiw@foxmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Add tests for io_uring_setup, io_uring_register and io_uring_enter.
The test coverage is nowhere near complete and the reporting is not
uniform. But, it's a start.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>