2 * include/linux/userfaultfd.h
4 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
5 * Copyright (C) 2015 Red Hat, Inc.
9 #ifndef _LINUX_USERFAULTFD_H
10 #define _LINUX_USERFAULTFD_H
12 #include <linux/types.h>
14 #define UFFD_API ((__u64)0xAA)
15 /* FIXME: add "|UFFD_FEATURE_WP" to UFFD_API_FEATURES after implementing it */
16 #define UFFD_API_FEATURES (UFFD_FEATURE_WRITE_BIT)
17 #define UFFD_API_IOCTLS \
18 ((__u64)1 << _UFFDIO_REGISTER | \
19 (__u64)1 << _UFFDIO_UNREGISTER | \
20 (__u64)1 << _UFFDIO_API)
21 #define UFFD_API_RANGE_IOCTLS \
22 ((__u64)1 << _UFFDIO_WAKE)
25 * Valid ioctl command number range with this API is from 0x00 to
26 * 0x3F. UFFDIO_API is the fixed number, everything else can be
27 * changed by implementing a different UFFD_API. If sticking to the
28 * same UFFD_API more ioctl can be added and userland will be aware of
29 * which ioctl the running kernel implements through the ioctl command
30 * bitmask written by the UFFDIO_API.
32 #define _UFFDIO_REGISTER (0x00)
33 #define _UFFDIO_UNREGISTER (0x01)
34 #define _UFFDIO_WAKE (0x02)
35 #define _UFFDIO_API (0x3F)
37 /* userfaultfd ioctl ids */
39 #define UFFDIO_API _IOWR(UFFDIO, _UFFDIO_API, \
41 #define UFFDIO_REGISTER _IOWR(UFFDIO, _UFFDIO_REGISTER, \
42 struct uffdio_register)
43 #define UFFDIO_UNREGISTER _IOR(UFFDIO, _UFFDIO_UNREGISTER, \
45 #define UFFDIO_WAKE _IOR(UFFDIO, _UFFDIO_WAKE, \
49 * Valid bits below PAGE_SHIFT in the userfault address read through
52 #define UFFD_BIT_WRITE (1<<0) /* this was a write fault, MISSING or WP */
53 #define UFFD_BIT_WP (1<<1) /* handle_userfault() reason VM_UFFD_WP */
54 #define UFFD_BITS 2 /* two above bits used for UFFD_BIT_* mask */
57 * Features reported in uffdio_api.features field
59 #define UFFD_FEATURE_WRITE_BIT (1<<0) /* Corresponds to UFFD_BIT_WRITE */
60 #define UFFD_FEATURE_WP_BIT (1<<1) /* Corresponds to UFFD_BIT_WP */
63 /* userland asks for an API number */
66 /* kernel answers below with the available features for the API */
76 struct uffdio_register
{
77 struct uffdio_range range
;
78 #define UFFDIO_REGISTER_MODE_MISSING ((__u64)1<<0)
79 #define UFFDIO_REGISTER_MODE_WP ((__u64)1<<1)
83 * kernel answers which ioctl commands are available for the
84 * range, keep at the end as the last 8 bytes aren't read.
89 #endif /* _LINUX_USERFAULTFD_H */
This page took 0.052985 seconds and 5 git commands to generate.