summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-08-30 11:09:46 -0600
committerJens Axboe <axboe@kernel.dk>2019-08-30 11:09:46 -0600
commitb76db3f49d4bae86e299ff8aebfc76996e4c5902 (patch)
tree5c6302a4c70d8ba20960989639246160cd9a7312 /examples
parentebdbb71160e970af187060dc4bf661af2e5b93b5 (diff)
examples/io_uring-cp: handle io_uring_peek_cqe() -EAGAIN
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'examples')
-rw-r--r--examples/io_uring-cp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/io_uring-cp.c b/examples/io_uring-cp.c
index adb7b29..455ca72 100644
--- a/examples/io_uring-cp.c
+++ b/examples/io_uring-cp.c
@@ -168,8 +168,13 @@ static int copy_file(struct io_uring *ring, off_t insize)
if (!got_comp) {
ret = io_uring_wait_cqe(ring, &cqe);
got_comp = 1;
- } else
+ } else {
ret = io_uring_peek_cqe(ring, &cqe);
+ if (ret == -EAGAIN) {
+ cqe = NULL;
+ ret = 0;
+ }
+ }
if (ret < 0) {
fprintf(stderr, "io_uring_peek_cqe: %s\n",
strerror(-ret));