io_uring_register_files(3) — Linux manual page

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | SEE ALSO | COLOPHON

io_uring_register_files(3)   liburing Manual  io_uring_register_files(3)

NAME         top

       io_uring_register_files - register file descriptors

SYNOPSIS         top

       #include <liburing.h>

       int io_uring_register_files(struct io_uring *ring,
                                   const int *files,
                                   unsigned nr_files);

       int io_uring_register_files_sparse(struct io_uring *ring,
                                   unsigned nr_files);

DESCRIPTION         top

       The io_uring_register_files(3) function registers nr_files number
       of file descriptors defined by the array files belonging to the
       ring for subsequent operations.

       The io_uring_register_files_sparse(3) function registers an empty
       file table of nr_files number of file descriptors. The sparse
       variant is available in kernels 5.19 and later.

       Registering a file table is a prerequisite for using any request
       that uses direct descriptors.

       Registered files have less overhead per operation than normal
       files. This is due to the kernel grabbing a reference count on a
       file when an operation begins, and dropping it when it's done.
       When the process file table is shared, for example if the process
       has ever created any threads, then this cost goes up even more.
       Using registered files reduces the overhead of file reference
       management across requests that operate on a file.

RETURN VALUE         top

       On success io_uring_register_files(3) and
       io_uring_register_files_sparse(3) return 0. On failure they
       return -errno.

SEE ALSO         top

       io_uring_get_sqe(3), io_uring_unregister_files(3)

COLOPHON         top

       This page is part of the liburing (A library for io_uring)
       project.  Information about the project can be found at 
       ⟨https://github.com/axboe/liburing⟩.  If you have a bug report for
       this manual page, send it to io-uring@vger.kernel.org.  This page
       was obtained from the project's upstream Git repository
       ⟨https://github.com/axboe/liburing⟩ on 2022-12-17.  (At that
       time, the date of the most recent commit that was found in the
       repository was 2022-12-12.)  If you discover any rendering
       problems in this HTML version of the page, or you believe there
       is a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to
       man-pages@man7.org

liburing-2.1                November 15, 2021 io_uring_register_files(3)

Pages that refer to this page: io_uring_prep_accept(3)io_uring_prep_accept_direct(3)io_uring_prep_multishot_accept(3)io_uring_prep_multishot_accept_direct(3)io_uring_prep_openat2(3)io_uring_prep_openat2_direct(3)io_uring_prep_openat(3)io_uring_prep_openat_direct(3)io_uring_prep_socket(3)io_uring_prep_socket_direct(3)io_uring_prep_socket_direct_alloc(3)io_uring_register_file_alloc_range(3)io_uring_register_files(3)io_uring_register_files_sparse(3)io_uring_register_ring_fd(3)io_uring_unregister_files(3)io_uring_unregister_ring_fd(3)