1io_uring_register_ring_fd(3)    liburing Manual   io_uring_register_ring_fd(3)
2
3
4

NAME

6       io_uring_register_ring_fd - register a ring file descriptor
7

SYNOPSIS

9       #include <liburing.h>
10
11       int io_uring_register_ring_fd(struct io_uring *ring);
12

DESCRIPTION

14       io_uring_register_ring_fd(3) registers the file descriptor of the ring.
15
16       Whenever io_uring_enter(2) is called to submit request or wait for com‐
17       pletions, the kernel must grab a reference to the file  descriptor.  If
18       the application using io_uring is threaded, the file table is marked as
19       shared, and the reference grab and put of the file descriptor count  is
20       more expensive than it is for a non-threaded application.
21
22       Similarly to how io_uring allows registration of files, this allow reg‐
23       istration of the ring file descriptor itself. This reduces the overhead
24       of the io_uring_enter(2) system call.
25
26       If  an  application  using  liburing  is  threaded, then an application
27       should call this function to register the ring descriptor when  a  ring
28       is set up. See NOTES for restrictions when a ring is shared.
29
30

NOTES

32       When  the ring descriptor is registered, it is stored internally in the
33       struct io_uring structure. For applications that share a  ring  between
34       threads,  for  example  having  one  thread do submits and another reap
35       events, then this optimization cannot be used as each thread may have a
36       different index for the registered ring fd.
37

RETURN VALUE

39       Returns  1  on  success, indicating that one file descriptor was regis‐
40       tered, or -errno on error.
41

SEE ALSO

43       io_uring_unregister_ring_fd(3), io_uring_register_files(3)
44
45
46
47liburing-2.2                    March 11, 2022    io_uring_register_ring_fd(3)
Impressum