Skip to content

Commit 411eda0

Browse files
committed
userfaultfd-sys: expose USERFAULTFD_IOC ioctl number
Expose the USERFAULTFD_IOC ioctl number for `/dev/userfaultfd` device. This device is only present on kernels >= 6.1, but we expose it unconditionally so that userfaultfd-sys has the same exports for all kernels. Signed-off-by: Babis Chalios <[email protected]>
1 parent 5939721 commit 411eda0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

userfaultfd-sys/src/consts.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,7 @@ const __u32 _const_UFFDIO_ZEROPAGE = UFFDIO_ZEROPAGE;
6969
#ifdef UFFDIO_WRITEPROTECT
7070
const __u32 _const_UFFDIO_WRITEPROTECT = UFFDIO_WRITEPROTECT;
7171
#endif
72+
73+
#ifdef USERFAULTFD_IOC
74+
const __u32 _const_USERFAULTFD_IOC = USERFAULTFD_IOC;
75+
#endif

userfaultfd-sys/wrapper.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@
44
// userfaultfd-sys has the same exports on all kernels
55
#define UFFD_USER_MODE_ONLY 1
66
#endif
7+
8+
9+
#ifndef USERFAULTFD_IOC
10+
// Similarly, the ioctl() for `/dev/userfaultfd` is introduced with Linux 6.1.
11+
#define USERFAULTFD_IOC 0xAA
12+
#endif

0 commit comments

Comments
 (0)