Debian Codegraph @

upstream/debian-trixie/man2/UFFDIO_WRITEPROTECT.2const

raw
1 .\" Copyright 2016, IBM Corporation.
2 .\" Written by Mike Rapoport <[email protected]>
3 .\" Copyright 2016, Michael Kerrisk <[email protected]>
4 .\" Copyright 2024, Alejandro Colomar <[email protected]>
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .TH UFFDIO_WRITEPROTECT 2const 2024-06-17 "Linux man-pages 6.9.1"
9 .SH NAME
10 UFFDIO_WRITEPROTECT
11 \-
12 write-protect or write-unprotect a userfaultfd-registered memory range
13 .SH LIBRARY
14 Standard C library
15 .RI ( libc ", " \-lc )
16 .SH SYNOPSIS
17 .nf
18 .BR "#include <linux/userfaultfd.h>" " /* Definition of " UFFD* " constants */"
19 .B #include <sys/ioctl.h>
20 .P
21 .BI "int ioctl(int " fd ", UFFDIO_WRITEPROTECT, ...);"
22 .P
23 .B #include <linux/userfaultfd.h>
24 .P
25 .fi
26 .EX
27 .B struct uffdio_writeprotect {
28 .BR " struct uffdio_range range;" " /* Range to change write permission*/"
29 .BR " __u64 mode;" " /* Mode to change write permission */"
30 .B };
31 .EE
32 .SH DESCRIPTION
33 Write-protect or write-unprotect a userfaultfd-registered memory range
34 registered with mode
35 .BR UFFDIO_REGISTER_MODE_WP .
36 .P
37 There are two mode bits that are supported in this structure:
38 .TP
39 .B UFFDIO_WRITEPROTECT_MODE_WP
40 When this mode bit is set,
41 the ioctl will be a write-protect operation upon the memory range specified by
42 .IR range .
43 Otherwise it will be a write-unprotect operation upon the specified range,
44 which can be used to resolve a userfaultfd write-protect page fault.
45 .TP
46 .B UFFDIO_WRITEPROTECT_MODE_DONTWAKE
47 When this mode bit is set,
48 do not wake up any thread that waits for
49 page-fault resolution after the operation.
50 This can be specified only if
51 .B UFFDIO_WRITEPROTECT_MODE_WP
52 is not specified.
53 .SH RETURN VALUE
54 On success,
55 0 is returned.
56 On error, \-1 is returned and
57 .I errno
58 is set to indicate the error.
59 .SH ERRORS
60 .TP
61 .B EINVAL
62 The
63 .I start
64 or the
65 .I len
66 field of the
67 .I ufdio_range
68 structure was not a multiple of the system page size; or
69 .I len
70 was zero; or the specified range was otherwise invalid.
71 .TP
72 .B EAGAIN
73 The process was interrupted; retry this call.
74 .TP
75 .B ENOENT
76 The range specified in
77 .I range
78 is not valid.
79 For example, the virtual address does not exist,
80 or not registered with userfaultfd write-protect mode.
81 .TP
82 .B EFAULT
83 Encountered a generic fault during processing.
84 .SH STANDARDS
85 Linux.
86 .SH HISTORY
87 Linux 5.7.
88 .SH EXAMPLES
89 See
90 .BR userfaultfd (2).
91 .SH SEE ALSO
92 .BR ioctl (2),
93 .BR ioctl_userfaultfd (2),
94 .BR userfaultfd (2)
95 .P
96 .I Documentation/admin\-guide/mm/userfaultfd.rst
97 in the Linux kernel source tree