io\_uring\_peek\_cqe(3) liburing Manual io\_uring\_peek\_cqe(3)

# [NAME](#NAME)

io\_uring\_peek\_cqe - check if an io\_uring completion event is available

# [SYNOPSIS](#SYNOPSIS)

```
#include <liburing.h>
```

```
int io_uring_peek_cqe(struct io_uring *ring,
                      struct io_uring_cqe **cqe_ptr);
```

```
unsigned io_uring_peek_batch_cqe(struct io_uring *ring,
                                 struct io_uring_cqe **cqe_ptrs,
                                 unsigned count);
```

# [DESCRIPTION](#DESCRIPTION)

The [**io\_uring\_peek\_cqe**(3)](/man/os/liburing/io_uring_peek_cqe.3) function returns an IO completion from the queue belonging to the *ring* param, if one is readily available. On successful return, *cqe\_ptr* param is filled with a valid CQE entry.

This function does not enter the kernel to wait for an event, an event is only returned if it's already available in the CQ ring.

The [**io\_uring\_peek\_batch\_cqe**(3)](/man/os/liburing/io_uring_peek_batch_cqe.3) function returns up to *count* request completions in *cqe\_ptrs* belonging to the *ring* param, if they are readily available. It will not enter the kernel, unless the CQ ring is in an overflow condition. Upon successful return, *cqe\_ptrs* are filled with the number of events indicated by the return value.

# [RETURN VALUE](#RETURN_VALUE)

On success [**io\_uring\_peek\_cqe**(3)](/man/os/liburing/io_uring_peek_cqe.3) returns **0** and the cqe\_ptr parameter is filled in. On success [**io\_uring\_peek\_batch\_cqe**(3)](/man/os/liburing/io_uring_peek_batch_cqe.3) returns the number of completions filled in. On failure, [**io\_uring\_peek\_cqe**(3)](/man/os/liburing/io_uring_peek_cqe.3) may return **-EAGAIN**.

# [SEE ALSO](#SEE_ALSO)

[**io\_uring\_submit**(3)](/man/os/liburing/io_uring_submit.3), [**io\_uring\_wait\_cqes**(3)](/man/os/liburing/io_uring_wait_cqes.3), [**io\_uring\_wait\_cqe**(3)](/man/os/liburing/io_uring_wait_cqe.3)

March 12, 2022 liburing-2.2

---

Document: io_uring_peek_batch_cqe(3) from liburing 2.15-r5 (Chainguard OS)
Source: https://github.com/axboe/liburing.git
