linux/include/uapi/linux/userfaultfd.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 *  include/linux/userfaultfd.h
 *
 *  Copyright (C) 2007  Davide Libenzi <[email protected]>
 *  Copyright (C) 2015  Red Hat, Inc.
 *
 */

#ifndef _LINUX_USERFAULTFD_H
#define _LINUX_USERFAULTFD_H

#include <linux/types.h>

/* ioctls for /dev/userfaultfd */
#define USERFAULTFD_IOC
#define USERFAULTFD_IOC_NEW

/*
 * If the UFFDIO_API is upgraded someday, the UFFDIO_UNREGISTER and
 * UFFDIO_WAKE ioctls should be defined as _IOW and not as _IOR.  In
 * userfaultfd.h we assumed the kernel was reading (instead _IOC_READ
 * means the userland is reading).
 */
#define UFFD_API
#define UFFD_API_REGISTER_MODES
#define UFFD_API_FEATURES
#define UFFD_API_IOCTLS
#define UFFD_API_RANGE_IOCTLS
#define UFFD_API_RANGE_IOCTLS_BASIC

/*
 * Valid ioctl command number range with this API is from 0x00 to
 * 0x3F.  UFFDIO_API is the fixed number, everything else can be
 * changed by implementing a different UFFD_API. If sticking to the
 * same UFFD_API more ioctl can be added and userland will be aware of
 * which ioctl the running kernel implements through the ioctl command
 * bitmask written by the UFFDIO_API.
 */
#define _UFFDIO_REGISTER
#define _UFFDIO_UNREGISTER
#define _UFFDIO_WAKE
#define _UFFDIO_COPY
#define _UFFDIO_ZEROPAGE
#define _UFFDIO_MOVE
#define _UFFDIO_WRITEPROTECT
#define _UFFDIO_CONTINUE
#define _UFFDIO_POISON
#define _UFFDIO_API

/* userfaultfd ioctl ids */
#define UFFDIO
#define UFFDIO_API
#define UFFDIO_REGISTER
#define UFFDIO_UNREGISTER
#define UFFDIO_WAKE
#define UFFDIO_COPY
#define UFFDIO_ZEROPAGE
#define UFFDIO_MOVE
#define UFFDIO_WRITEPROTECT
#define UFFDIO_CONTINUE
#define UFFDIO_POISON

/* read() structure */
struct uffd_msg {} __packed;

/*
 * Start at 0x12 and not at 0 to be more strict against bugs.
 */
#define UFFD_EVENT_PAGEFAULT
#define UFFD_EVENT_FORK
#define UFFD_EVENT_REMAP
#define UFFD_EVENT_REMOVE
#define UFFD_EVENT_UNMAP

/* flags for UFFD_EVENT_PAGEFAULT */
#define UFFD_PAGEFAULT_FLAG_WRITE
#define UFFD_PAGEFAULT_FLAG_WP
#define UFFD_PAGEFAULT_FLAG_MINOR

struct uffdio_api {};

struct uffdio_range {};

struct uffdio_register {};

struct uffdio_copy {};

struct uffdio_zeropage {};

struct uffdio_writeprotect {};

struct uffdio_continue {};

struct uffdio_poison {};

struct uffdio_move {};

/*
 * Flags for the userfaultfd(2) system call itself.
 */

/*
 * Create a userfaultfd that can handle page faults only in user mode.
 */
#define UFFD_USER_MODE_ONLY

#endif /* _LINUX_USERFAULTFD_H */