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