Debian Codegraph @

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