# UFFDIO_REGISTER

## 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;** /* Size 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 memory region.  The following values may be bitwise ORed to
           set the userfaultfd mode for the specified range:
    
           **UFFDIO_REGISTER_MODE_MISSING**
                  Track page faults on missing pages.  Since Linux 4.3, only
                  private 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
                  userfaultfd 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 invalid.
    
           **EINVAL** There as an incompatible mapping in the specified address
                  range.
    


## STANDARDS



           Linux.
    


## EXAMPLES



           See userfaultfd(2).
    


* * *