1io_uring_register_files(3) liburing Manual io_uring_register_files(3)
2
3
4
6 io_uring_register_files - register file descriptors
7
9 #include <liburing.h>
10
11 int io_uring_register_files(struct io_uring *ring,
12 const int *files,
13 unsigned nr_files);
14
15 int io_uring_register_files_sparse(struct io_uring *ring,
16 unsigned nr_files);
17
19 The io_uring_register_files(3) function registers nr_files number of
20 file descriptors defined by the array files belonging to the ring for
21 subsequent operations.
22
23 The io_uring_register_files_sparse(3) function registers an empty file
24 table of nr_files number of file descriptors. The sparse variant is
25 available in kernels 5.19 and later.
26
27 Registering a file table is a prerequisite for using any request that
28 uses direct descriptors.
29
30 Registered files have less overhead per operation than normal files.
31 This is due to the kernel grabbing a reference count on a file when an
32 operation begins, and dropping it when it's done. When the process file
33 table is shared, for example if the process has ever created any
34 threads, then this cost goes up even more. Using registered files re‐
35 duces the overhead of file reference management across requests that
36 operate on a file.
37
38
40 On success io_uring_register_files(3) and io_uring_regis‐
41 ter_files_sparse(3) return 0. On failure they return -errno.
42
44 io_uring_get_sqe(3), io_uring_unregister_files(3)
45
46
47
48liburing-2.1 November 15, 2021 io_uring_register_files(3)