Commit Graph

25 Commits

Author SHA1 Message Date
Jens Axboe 53b4f9af81 examples/io_uring-test: don't error on shorter files
The example currently assumes the file is at least 4*4096 bytes,
and errors when we get 0 reads on EOF. Fix this up.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-20 05:48:24 -06:00
Carter Li 5e95ff2c30 examples/ucontext-cp.c: use IORING_OP_TIMEOUT 2020-06-10 15:54:22 +08:00
Jens Axboe e502435779 Add SPDX license identifiers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-02-11 20:34:12 -07:00
Jens Axboe 4332433754 configure: allow to set host CC
Use ./configure --cc=whatever to set the compiler.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-12-23 21:34:03 -07:00
Jens Axboe 32fcace197 Makefile: quiet down rm
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-12-23 21:33:47 -07:00
Jackie Liu 6a273eaa1a Avoid redefined warning of "SIGSTKSZ"
ucontext-cp.c:24:0: warning: "SIGSTKSZ" redefined
 #define SIGSTKSZ 8192

In file included from /usr/include/signal.h:316:0,
                 from ucontext-cp.c:13:
/usr/include/aarch64-linux-gnu/bits/sigstack.h:30:0: note: this is the location of the previous definition
 #define SIGSTKSZ 16384

Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-11-19 20:35:56 -07:00
Jens Axboe 6bf626224e examples/ucontext-cp.c: get rid of c99 style declarations
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-01 16:08:35 -06:00
Jens Axboe 1cff0db7bc Makefile: handle quiet AR/RANLIB
Also unify across subdirs.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-22 10:10:33 -06:00
Jens Axboe ad551e6470 Makefile: add pretty/quiet CC/LN output
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-21 20:46:00 -06:00
李通洲 a05c7a6c89 examples/ucontext-cp: more complex example to show how ucontext works
Allow multiple files being copied in one command, and print more logs
Also add timeout to indicate that different coroutines run in parallel actually

Signed-off-by: 李通洲 <carter.li@eoitek.com>
2019-09-22 09:48:02 +08:00
James Rouzier e88b74ae6d Generalize Makefiles for examples and test.
Signed-off-by: James Rouzier <rouzier@gmail.com>
2019-09-21 17:16:50 -04:00
Jens Axboe 5109ed3ec7 examples/ucontext-cp: style fixups
No functional changes.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-20 07:13:07 -06:00
李通洲 20b3ce6c52 examples/ucontext-cp: use ucontext with liburing
Coroutines are often used to simplify async programming,
and work great with liburing.
`ucontext` doesn't perform very good, but it's enough for an example.
2019-09-20 17:37:55 +08:00
Jens Axboe b76db3f49d examples/io_uring-cp: handle io_uring_peek_cqe() -EAGAIN
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-08-30 11:09:46 -06:00
Stefan Hajnoczi c31c7ec4bc src/Makefile: keep private headers in <liburing/*.h>
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>
2019-07-24 09:11:44 -06:00
Bart Van Assche 64f89fa146 Makefiles: Support specifying CFLAGS on the command line
This patch makes the liburing build work as expected for e.g. the following
command:

make CFLAGS=-m32

and avoids that the build fails as follows for the above command:

make[1]: Entering directory 'liburing/test'
cc -m32 -o poll poll.c -luring
/usr/bin/ld: cannot find -luring
collect2: error: ld returned 1 exit status
Makefile:18: recipe for target 'poll' failed
make[1]: *** [poll] Error 1
make[1]: Leaving directory 'software/liburing/test'
Makefile:12: recipe for target 'all' failed
make: *** [all] Error 2

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-08 15:25:57 -06:00
Stephen Bates 733223acd6 example/io_uring-test.c: Fix iovecs increment
This example misses an increment though the iovecs array. This causes
the same buffer to be filled from the block device every time. It would
be good to fix this since it is one of the first examples a new-comer to
io_uring is exposed too.

Signed-off-by: Stephen Bates <sbates@raithlin.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-13 03:04:32 -06:00
zhangliguang 4d325561f3 examples/io_uring-cp: fix a NULL pointer dereference
In case malloc fails, the fix returns NULL to avoid NULL pointer
dereference.

Signed-off-by: zhangliguang <zhangliguang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-22 08:46:28 -06:00
Jens Axboe 9511863658 examples/link-cp: improve memory use
Put the data at the end so we don't have to offset the actual buffer.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-15 14:11:10 -06:00
Jens Axboe 5c6e5d2745 examples/link-cp: improvements
Add short read requeue and abort on error.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-15 14:07:52 -06:00
Jens Axboe 7e8902e14c examples/link-cp: fix a few issues
Still need to handle broken chains, must resubmit those.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-14 20:46:12 -06:00
Jens Axboe 1982bfd44d Add chain failure handling test case
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-14 19:08:37 -06:00
Jens Axboe 0ba9503f79 Add link SQE support
Just a basic test case that does various forms of linked nops, and
a sample bare bones copy program using linked reads and writes.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-13 16:16:07 -06:00
Jens Axboe 39e0ebd4fc Rename completion helpers
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>
2019-04-18 08:38:08 -06:00
Jens Axboe 4916320ec3 Separate test cases from examples
Also adds a runtests makefile target.
2019-04-17 11:39:39 -06:00