| 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 ioctl_userfaultfd 2 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
ioctl_userfaultfd \- create a file descriptor for handling page faults in user |
| 10 |
space |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ,\~ \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.BR "#include <linux/userfaultfd.h>" " /* Definition of " UFFD* " constants */" |
| 17 |
.B #include <sys/ioctl.h> |
| 18 |
.P |
| 19 |
.BI "int ioctl(int " fd ", int " op ", ...);" |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
Various |
| 23 |
.BR ioctl (2) |
| 24 |
operations can be performed on a userfaultfd object (created by a call to |
| 25 |
.BR userfaultfd (2)) |
| 26 |
using calls of the form: |
| 27 |
.P |
| 28 |
.in +4n |
| 29 |
.EX |
| 30 |
ioctl(fd, op, argp); |
| 31 |
.EE |
| 32 |
.in |
| 33 |
.P |
| 34 |
In the above, |
| 35 |
.I fd |
| 36 |
is a file descriptor referring to a userfaultfd object, |
| 37 |
.I op |
| 38 |
is one of the operations listed below, and |
| 39 |
.I argp |
| 40 |
is a pointer to a data structure that is specific to |
| 41 |
.IR op . |
| 42 |
.P |
| 43 |
The various |
| 44 |
.BR ioctl (2) |
| 45 |
operations are described below. |
| 46 |
The |
| 47 |
.BR UFFDIO_API , |
| 48 |
.BR UFFDIO_REGISTER , |
| 49 |
and |
| 50 |
.B UFFDIO_UNREGISTER |
| 51 |
operations are used to |
| 52 |
.I configure |
| 53 |
userfaultfd behavior. |
| 54 |
These operations allow the caller to choose what features will be enabled and |
| 55 |
what kinds of events will be delivered to the application. |
| 56 |
The remaining operations are |
| 57 |
.I range |
| 58 |
operations. |
| 59 |
These operations enable the calling application to resolve page-fault |
| 60 |
events. |
| 61 |
.\" |
| 62 |
.TP |
| 63 |
.BR UFFDIO_API (2const) |
| 64 |
.TQ |
| 65 |
.BR UFFDIO_REGISTER (2const) |
| 66 |
.TQ |
| 67 |
.BR UFFDIO_UNREGISTER (2const) |
| 68 |
.TQ |
| 69 |
.BR UFFDIO_COPY (2const) |
| 70 |
.TQ |
| 71 |
.BR UFFDIO_MOVE (2const) |
| 72 |
.TQ |
| 73 |
.BR UFFDIO_ZEROPAGE (2const) |
| 74 |
.TQ |
| 75 |
.BR UFFDIO_WAKE (2const) |
| 76 |
.TQ |
| 77 |
.BR UFFDIO_WRITEPROTECT (2const) |
| 78 |
.TQ |
| 79 |
.BR UFFDIO_CONTINUE (2const) |
| 80 |
.TQ |
| 81 |
.BR UFFDIO_POISON (2const) |
| 82 |
.SH RETURN VALUE |
| 83 |
On success, |
| 84 |
0 is returned. |
| 85 |
On error, |
| 86 |
\-1 is returned, and |
| 87 |
.I errno |
| 88 |
is set to indicate the error. |
| 89 |
.SH ERRORS |
| 90 |
The following general errors can occur for all of the |
| 91 |
operations described above: |
| 92 |
.TP |
| 93 |
.B EFAULT |
| 94 |
.I argp |
| 95 |
does not point to a valid memory address. |
| 96 |
.TP |
| 97 |
.B EINVAL |
| 98 |
(For all operations except |
| 99 |
.BR UFFDIO_API .) |
| 100 |
The userfaultfd object has not yet been enabled (via the |
| 101 |
.B UFFDIO_API |
| 102 |
operation). |
| 103 |
.SH STANDARDS |
| 104 |
Linux. |
| 105 |
.SH EXAMPLES |
| 106 |
See |
| 107 |
.BR userfaultfd (2). |
| 108 |
.SH SEE ALSO |
| 109 |
.BR ioctl (2), |
| 110 |
.BR mmap (2), |
| 111 |
.BR userfaultfd (2) |
| 112 |
.P |
| 113 |
.I linux.git/\:Documentation/\:admin\-guide/\:mm/\:userfaultfd.rst |