Debian Codegraph @

upstream/debian-trixie/man2/UFFDIO_ZEROPAGE.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_ZEROPAGE 2const 2024-06-17 "Linux man-pages 6.9.1"
9 .SH NAME
10 UFFDIO_ZEROPAGE
11 \-
12 zero out a memory range registered with userfaultfd
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_ZEROPAGE, struct uffdio_zeropage *" argp );
22 .P
23 .B #include <linux/userfaultfd.h>
24 .P
25 .fi
26 .EX
27 .B struct uffdio_zeropage {
28 .B " struct uffdio_range range;"
29 .BR " __u64 mode;" " /* Flags controlling behavior */"
30 .BR " __s64 zeropage;" " /* Number of bytes zeroed */"
31 .B };
32 .EE
33 .SH DESCRIPTION
34 Zero out a memory range registered with userfaultfd.
35 .P
36 The following value may be bitwise ORed in
37 .I mode
38 to change the behavior of the
39 .B UFFDIO_ZEROPAGE
40 operation:
41 .TP
42 .B UFFDIO_ZEROPAGE_MODE_DONTWAKE
43 Do not wake up the thread that waits for page-fault resolution.
44 .P
45 The
46 .I zeropage
47 field is used by the kernel to return the number of bytes
48 that was actually zeroed,
49 or an error in the same manner as
50 .BR UFFDIO_COPY .
51 .\" FIXME Why is the 'zeropage' field used to return error values?
52 .\" This should be explained in the manual page.
53 If the value returned in the
54 .I zeropage
55 field doesn't match the value that was specified in
56 .IR range.len ,
57 the operation fails with the error
58 .BR EAGAIN .
59 The
60 .I zeropage
61 field is output-only;
62 it is not read by the
63 .B UFFDIO_ZEROPAGE
64 operation.
65 .SH RETURN VALUE
66 This
67 .BR ioctl (2)
68 operation returns 0 on success.
69 In this case, the entire area was zeroed.
70 On error, \-1 is returned and
71 .I errno
72 is set to indicate the error.
73 .SH ERRORS
74 .TP
75 .B EAGAIN
76 The number of bytes zeroed (i.e., the value returned in the
77 .I zeropage
78 field)
79 does not equal the value that was specified in the
80 .I range.len
81 field.
82 .TP
83 .B EINVAL
84 Either
85 .I range.start
86 or
87 .I range.len
88 was not a multiple of the system page size; or
89 .I range.len
90 was zero; or the range specified was invalid.
91 .TP
92 .B EINVAL
93 An invalid bit was specified in the
94 .I mode
95 field.
96 .TP
97 .BR ESRCH " (since Linux 4.13)"
98 The faulting process has exited at the time of a
99 .B UFFDIO_ZEROPAGE
100 operation.
101 .SH STANDARDS
102 Linux.
103 .SH HISTORY
104 Linux 4.3.
105 .SH EXAMPLES
106 See
107 .BR userfaultfd (2).
108 .SH SEE ALSO
109 .BR ioctl (2),
110 .BR ioctl_userfaultfd (2),
111 .BR userfaultfd (2)
112 .P
113 .I linux.git/\:Documentation/\:admin\-guide/\:mm/\:userfaultfd.rst