Silences the following:
* Error due to no definition for `mode_t` in `liburing.h`
* Warning due to use of non-portable `#include <sys/poll.h>` and `#include <sys/signal.h>`
* Warning due to incorrect `printf` format specifier in `test/io_uring_register.c`
* Error due to missing declaration for `strcpy` in `test/sendmsg_fs_cve.c`
* Error due to missing declaration for `strerror` in `test/shutdown.c`
Signed-off-by: Mahdi Rakhshandehroo <mahdi.rakhshandehroo@gmail.com>
This is a start, still some to go. The goal here is to ensure that we
use stderr consistently for errors, and include the error value as well.
Right now folks copy/paste test cases (which they should), but that
also means they should be doing the right thing so we don't keep adding
test cases that just use stdout for errors, or don't include the error
value.
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>
We have io_uring_get_sqe() on the submission side, yet the completion
side is named _completion. Rename as follows:
io_uring_get_completion() io_uring_peek_cqe()
iO_uring_wait_completion() io_uring_wait_cqe()
This better tells the user what the _get variant does by calling it
_peek instead, and we move to using _cqe() as the postfix instead
of _completion.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
There's a failure case where an application gets a cqe entry, but
the kernel can then overwrite it before the application is done
reading it. This can happen since the io_uring_{get,wait}_completion()
interface both returns a CQE pointer AND increments the ring index.
If the kernel reuses this entry before the applications is done reading
it, the contents may be corrupted.
Remove the CQ head increment from the CQE retrieval, and put it into
a separate helper, io_uring_cqe_seen(). The application must call this
helper when it got a new CQE entry through one of the above calls, and
it's now done reading it.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Just setup one ring in the child process, and poll for when the
read side of the pipe is readable. From the parent, write something
to the pipe.
If nothing happens within 1 second, fail the test.
Signed-off-by: Jens Axboe <axboe@kernel.dk>