dwww Home | Manual pages | Find package

UFFDIO_REGISTER(2const)                                 UFFDIO_REGISTER(2const)

NAME
       UFFDIO_REGISTER  -  register a memory address range with the userfaultfd
       object

LIBRARY
       Standard C library (libc, -lc)

SYNOPSIS
       #include <linux/userfaultfd.h>  /* Definition of UFFD* constants */
       #include <sys/ioctl.h>

       int ioctl(int fd, UFFDIO_REGISTER, struct uffdio_register *argp);

       #include <linux/userfaultfd.h>

       struct uffdio_range {
           __u64  start;   /* Start of range */
           __u64  len;     /* Length of range (bytes) */
       };

       struct uffdio_register {
           struct uffdio_range  range;
           __u64                mode;    /* Desired mode of operation (input) */
           __u64                ioctls;  /* Available ioctl()s (output) */
       };

DESCRIPTION
       Register a memory address range with the userfaultfd object.  The  pages
       in the range must be “compatible”.  Please refer to the list of register
       modes below for the compatible memory backends for each mode.

       The   argp->range   field   defines   a   memory   range   starting   at
       argp->range.start and continuing for argp->range.len bytes  that  should
       be handled by the userfaultfd.

       The argp->mode field defines the mode of operation desired for this mem-
       ory  region.   The following values may be bitwise ORed to set the user-
       faultfd mode for the specified range:

       UFFDIO_REGISTER_MODE_MISSING
              Track page faults on missing pages.  Since Linux 4.3,  only  pri-
              vate   anonymous   ranges  are  compatible.   Since  Linux  4.11,
              hugetlbfs and shared memory ranges are also compatible.

       UFFDIO_REGISTER_MODE_WP
              Track page faults on write-protected  pages.   Since  Linux  5.7,
              only private anonymous ranges are compatible.

       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.

       If the operation is successful, the  kernel  modifies  the  argp->ioctls
       bit-mask  field  to indicate which ioctl(2) operations are available for
       the specified range.  This returned bit mask can contain  the  following
       bits:

       1 << _UFFDIO_COPY
              The UFFDIO_COPY operation is supported.

       1 << _UFFDIO_WAKE
              The UFFDIO_WAKE operation is supported.

       1 << _UFFDIO_WRITEPROTECT
              The UFFDIO_WRITEPROTECT operation is supported.

       1 << _UFFDIO_ZEROPAGE
              The UFFDIO_ZEROPAGE operation is supported.

       1 << _UFFDIO_CONTINUE
              The UFFDIO_CONTINUE operation is supported.

       1 << _UFFDIO_POISON
              The UFFDIO_POISON operation is supported.

RETURN VALUE
       On success, 0 is returned.  On error, -1 is returned and errno is set to
       indicate the error.

ERRORS
       EBUSY  A mapping in the specified range is registered with another user-
              faultfd object.

       EFAULT argp  refers  to an address that is outside the calling process's
              accessible address space.

       EINVAL An invalid or unsupported bit was specified in the mode field; or
              the mode field was zero.

       EINVAL There is no mapping in the specified address range.

       EINVAL range.start or range.len is not a multiple  of  the  system  page
              size;  or,  range.len  is zero; or these fields are otherwise in-
              valid.

       EINVAL There as an incompatible mapping in the specified address range.

STANDARDS
       Linux.

HISTORY
       Linux 4.3.

EXAMPLES
       See userfaultfd(2).

SEE ALSO
       ioctl(2),   ioctl_userfaultfd(2),    UFFDIO_UNREGISTER(2const),    user-
       faultfd(2)

       linux.git/Documentation/admin-guide/mm/userfaultfd.rst

Linux man-pages 6.9.1              2024-06-17           UFFDIO_REGISTER(2const)

Generated by dwww version 1.16 on Tue Dec 16 04:34:13 CET 2025.