Kernel expects the tail to start at 0, so provide an API to init the
ring appropriately.
Signed-off-by: Dylan Yudaken <dylany@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Without the mask parameter, it's not feasible to use this API without
knowing where the tail is and performing some arithmetic
Signed-off-by: Dylan Yudaken <dylany@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Start inserting at tail + offset passed in, this is more natural than
having to index the buffer from the application.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This test assumes that the only valid flag being set for a send/recv
is IORING_CQE_F_BUFFER. But that isn't necessarily true, so check
specifically for whether this is a provided buffer return before checking
the buffer group ID.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Pass in a long iov (larger than on-stack cache) to test that it's
allocated correctly, and copied well if inline execution failed with
-EAGAIN.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
If we don't have PROVIDE_BUFFERS, then ensure we free the ring, and
(more importantly) up the mutex so we don't hang.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This is especially important as we're now running two tests, and we
don't want to leave one lingering and interfering.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
We need to check the return values from io_uring_queue_init() and
recv_prep() or we will be passing a NULL sqe to io_uring_get_sqe(),
or a NULL cge to io_uring_wait_cqe().
Signed-off-by: Guillem Jover <guillem@hadrons.org>
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>
We may never get the data from the socket read, and this requires
someone to SIGINT the test. Let's quit after 1 second if we haven't
received anything. If the test is actually hung, the alive worker
detection will catch it.
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>
Fix the warnings reported when building liburing as follows:
make CFLAGS=-m32
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>