Debian Codegraph @

upstream/debian-unstable/man2/UFFDIO_REGISTER.2const

raw
1 .\" Copyright 2016, International Business Machines Corp.
2 .\" Copyright 2016, Michael Kerrisk <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH UFFDIO_REGISTER 2const 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 UFFDIO_REGISTER
10 \-
11 register a memory address range with the userfaultfd object
12 .SH LIBRARY
13 Standard C library
14 .RI ( libc ,\~ \-lc )
15 .SH SYNOPSIS
16 .nf
17 .BR "#include <linux/userfaultfd.h>" " /* Definition of " UFFD* " constants */"
18 .B #include <sys/ioctl.h>
19 .P
20 .BI "int ioctl(int " fd ", UFFDIO_REGISTER, struct uffdio_register *" argp );
21 .P
22 .B #include <linux/userfaultfd.h>
23 .P
24 .fi
25 .EX
26 .B struct uffdio_range {
27 .BR " __u64 start;" " /* Start of range */"
28 .BR " __u64 len;" " /* Size of range (bytes) */"
29 .B };
30 \&
31 .B struct uffdio_register {
32 .B " struct uffdio_range range;"
33 .BR " __u64 mode;" " /* Desired mode of operation (input) */"
34 .BR " __u64 ioctls;" " /* Available ioctl()s (output) */"
35 .B };
36 .EE
37 .SH DESCRIPTION
38 Register a memory address range with the userfaultfd object.
39 The pages in the range must be \[lq]compatible\[rq].
40 Please refer to the list of register modes below
41 for the compatible memory backends for each mode.
42 .P
43 The
44 .I argp->range
45 field defines a memory range starting at
46 .I argp->range.start
47 and continuing for
48 .I argp->range.len
49 bytes that should be handled by the userfaultfd.
50 .P
51 The
52 .I argp->mode
53 field defines the mode of operation desired for this memory region.
54 The following values may be bitwise ORed to set the userfaultfd mode for
55 the specified range:
56 .TP
57 .B UFFDIO_REGISTER_MODE_MISSING
58 Track page faults on missing pages.
59 Since Linux 4.3,
60 only private anonymous ranges are compatible.
61 Since Linux 4.11,
62 hugetlbfs and shared memory ranges are also compatible.
63 .TP
64 .B UFFDIO_REGISTER_MODE_WP
65 Track page faults on write-protected pages.
66 Since Linux 5.7,
67 only private anonymous ranges are compatible.
68 .TP
69 .B UFFDIO_REGISTER_MODE_MINOR
70 Track minor page faults.
71 Since Linux 5.13,
72 only hugetlbfs ranges are compatible.
73 Since Linux 5.14,
74 compatibility with shmem ranges was added.
75 .P
76 If the operation is successful, the kernel modifies the
77 .I argp->ioctls
78 bit-mask field to indicate which
79 .BR ioctl (2)
80 operations are available for the specified range.
81 This returned bit mask can contain the following bits:
82 .TP
83 .B 1 << _UFFDIO_COPY
84 The
85 .B UFFDIO_COPY
86 operation is supported.
87 .TP
88 .B 1 << _UFFDIO_WAKE
89 The
90 .B UFFDIO_WAKE
91 operation is supported.
92 .TP
93 .B 1 << _UFFDIO_WRITEPROTECT
94 The
95 .B UFFDIO_WRITEPROTECT
96 operation is supported.
97 .TP
98 .B 1 << _UFFDIO_ZEROPAGE
99 The
100 .B UFFDIO_ZEROPAGE
101 operation is supported.
102 .TP
103 .B 1 << _UFFDIO_CONTINUE
104 The
105 .B UFFDIO_CONTINUE
106 operation is supported.
107 .TP
108 .B 1 << _UFFDIO_POISON
109 The
110 .B UFFDIO_POISON
111 operation is supported.
112 .SH RETURN VALUE
113 On success,
114 0 is returned.
115 On error, \-1 is returned and
116 .I errno
117 is set to indicate the error.
118 .SH ERRORS
119 .\" FIXME Is the following error list correct?
120 .\"
121 .TP
122 .B EBUSY
123 A mapping in the specified range is registered with another
124 userfaultfd object.
125 .TP
126 .B EFAULT
127 .I argp
128 refers to an address that is outside the calling process's
129 accessible address space.
130 .TP
131 .B EINVAL
132 An invalid or unsupported bit was specified in the
133 .I mode
134 field;
135 or the
136 .I mode
137 field was zero.
138 .TP
139 .B EINVAL
140 There is no mapping in the specified address range.
141 .TP
142 .B EINVAL
143 .I range.start
144 or
145 .I range.len
146 is not a multiple of the system page size;
147 or,
148 .I range.len
149 is zero;
150 or these fields are otherwise invalid.
151 .TP
152 .B EINVAL
153 There as an incompatible mapping in the specified address range.
154 .\" Mike Rapoport:
155 .\" ENOMEM if the process is exiting and the
156 .\" mm_struct has gone by the time userfault grabs it.
157 .SH STANDARDS
158 Linux.
159 .SH HISTORY
160 Linux 4.3.
161 .SH EXAMPLES
162 See
163 .BR userfaultfd (2).
164 .SH SEE ALSO
165 .BR ioctl (2),
166 .BR ioctl_userfaultfd (2),
167 .BR UFFDIO_UNREGISTER (2const),
168 .BR userfaultfd (2)
169 .P
170 .I linux.git/\:Documentation/\:admin\-guide/\:mm/\:userfaultfd.rst