summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-08-28 17:59:40 -0600
committerJens Axboe <axboe@kernel.dk>2019-08-28 17:59:40 -0600
commit681ba88a0ec1ac2281b9e3664be964c8c1b3e528 (patch)
treedd4b6806e6c4703510291696d65d4759aa58f49e /src
parent413ee338d46e4f6f2e5c89627b6279b809d4288a (diff)
Make io_uring_peek_cqe() return -EAGAIN for no CQEs
Currently we return 0 if someone calls io_uring_peek_cqe(), but we really should be returning 0 only if we managed to find a completion entry. Return -EAGAIN to notify the caller that no entries are there. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'src')
-rw-r--r--src/queue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/queue.c b/src/queue.c
index 007733c..203b534 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -23,7 +23,7 @@ static int __io_uring_get_cqe(struct io_uring *ring,
if (*cqe_ptr)
break;
if (!wait)
- break;
+ return -EAGAIN;
ret = io_uring_enter(ring->ring_fd, 0, 1,
IORING_ENTER_GETEVENTS, NULL);
if (ret < 0)