io\_uring\_register\_eventfd(3) liburing Manual io\_uring\_register\_eventfd(3)

# [NAME](#NAME)

io\_uring\_register\_eventfd - register an eventfd with a ring

# [SYNOPSIS](#SYNOPSIS)

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

```
int io_uring_register_eventfd(struct io_uring *ring,
                              int fd);
```

```
int io_uring_register_eventfd_async(struct io_uring *ring,
                                    int fd);
```

```
int io_uring_unregister_eventfd(struct io_uring *ring);
```

# [DESCRIPTION](#DESCRIPTION)

[**io\_uring\_register\_eventfd**(3)](/man/os/liburing/io_uring_register_eventfd.3) registers the eventfd file descriptor *fd* with the ring identified by *ring*.

Whenever completions are posted to the CQ ring, an eventfd notification is generated with the registered eventfd descriptor. If [**io\_uring\_register\_eventfd\_async**(3)](/man/os/liburing/io_uring_register_eventfd_async.3) is used, only events that completed out-of-line will trigger a notification.

If notifications are no longer desired, [**io\_uring\_unregister\_eventfd**(3)](/man/os/liburing/io_uring_unregister_eventfd.3) may be called to remove the eventfd registration. No eventfd argument is needed, as a ring can only have a single eventfd registered.

# [NOTES](#NOTES)

While io\_uring generally takes care to avoid spurious events, they can occur. Similarly, batched completions of CQEs may only trigger a single eventfd notification even if multiple CQEs are posted. The application should make no assumptions on number of events being available having a direct correlation to eventfd notifications posted. An eventfd notification must thus only be treated as a hint to check the CQ ring for completions.

# [RETURN VALUE](#RETURN_VALUE)

Returns 0 on success, or **-errno** on error.

# [SEE ALSO](#SEE_ALSO)

[**eventfd**(2)](/man/os/liburing/eventfd.2)

April 16, 2022 liburing-2.2

---

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