Skip to content

Commit

Permalink
userfaultfd-sys: expose USERFAULTFD_IOC ioctl number
Browse files Browse the repository at this point in the history
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 <bchalios@amazon.es>
  • Loading branch information
bchalios committed Sep 13, 2023
1 parent 5939721 commit 411eda0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions userfaultfd-sys/src/consts.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ const __u32 _const_UFFDIO_ZEROPAGE = UFFDIO_ZEROPAGE;
#ifdef UFFDIO_WRITEPROTECT
const __u32 _const_UFFDIO_WRITEPROTECT = UFFDIO_WRITEPROTECT;
#endif

#ifdef USERFAULTFD_IOC
const __u32 _const_USERFAULTFD_IOC = USERFAULTFD_IOC;
#endif
6 changes: 6 additions & 0 deletions userfaultfd-sys/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
// userfaultfd-sys has the same exports on all kernels
#define UFFD_USER_MODE_ONLY 1
#endif


#ifndef USERFAULTFD_IOC
// Similarly, the ioctl() for `/dev/userfaultfd` is introduced with Linux 6.1.
#define USERFAULTFD_IOC 0xAA
#endif

0 comments on commit 411eda0

Please sign in to comment.