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

NAME

6       io_uring_register_files - register file descriptors
7

SYNOPSIS

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_tags(struct io_uring *ring,
16                                        const int *files,
17                                        const __u64 *tags,
18                                        unsigned nr);
19
20       int io_uring_register_files_sparse(struct io_uring *ring,
21                                          unsigned nr_files);
22
23       int io_uring_register_files_update(struct io_uring *ring,
24                                          unsigned off,
25                                          const int *files,
26                                          unsigned nr_files);
27
28       int io_uring_register_files_update_tag(struct io_uring *ring,
29                                          unsigned off,
30                                          const int *files,
31                                          const __u64 *tags,
32                                          unsigned nr_files);
33

DESCRIPTION

35       The  io_uring_register_files(3)  function  registers nr_files number of
36       file descriptors defined by the array files belonging to the  ring  for
37       subsequent operations.
38
39       The io_uring_register_files_tags(3) function behaves the same as io_ur‐
40       ing_register_files(3) function but additionally takes  tags  parameter.
41       See IORING_REGISTER_BUFFERS2 for the resource tagging description.
42
43       The  io_uring_register_files_sparse(3) function registers an empty file
44       table of nr_files number of file descriptors. These files must  be  up‐
45       dated  before use, using eg io_uring_register_files_update_tag(3).  The
46       sparse variant is available in kernels 5.19 and later.
47
48       Registering a file table is a prerequisite for using any  request  that
49       uses direct descriptors.
50
51       Registered  files  have  less overhead per operation than normal files.
52       This is due to the kernel grabbing a reference count on a file when  an
53       operation begins, and dropping it when it's done. When the process file
54       table is shared, for example  if  the  process  has  ever  created  any
55       threads,  then  this cost goes up even more. Using registered files re‐
56       duces the overhead of file reference management  across  requests  that
57       operate on a file.
58
59       The  io_uring_register_files_update(3) function updates existing regis‐
60       tered files. The off is offset on which to start  the  update  nr_files
61       number of files defined by the array files belonging to the ring.
62
63       The  io_uring_register_files_update_tag(3) function behaves the same as
64       io_uring_register_files_update(3) function but additionally takes  tags
65       parameter.  See  IORING_REGISTER_BUFFERS2  for the resource tagging de‐
66       scription.
67
68

RETURN VALUE

70       On success io_uring_register_files(3),  io_uring_register_files_tags(3)
71       and   io_uring_register_files_sparse(3)   return   0.   io_uring_regis‐
72       ter_files_update(3)  and  io_uring_register_files_update_tag(3)  return
73       number of files updated.  On failure they return -errno.
74

SEE ALSO

76       io_uring_register(2), io_uring_get_sqe(3), io_uring_unregister_files(3)
77
78
79
80liburing-2.1                   November 15, 2021    io_uring_register_files(3)
Impressum