From 681ba88a0ec1ac2281b9e3664be964c8c1b3e528 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 28 Aug 2019 17:59:40 -0600 Subject: 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 --- src/queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- cgit