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.
@@ -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)
