From 789ff6a9f8ec91729cde7fdcb0568d5d928eeba5 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Sun, 24 Jan 2016 01:19:38 +0000 Subject: [PATCH] add MCL_ONFAULT and MLOCK_ONFAULT mlockall and mlock2 flags they lock faulted pages into memory (useful when a small part of a large mapped file needs efficient access), new in linux v4.4, commit b0f205c2a3082dd9081f9a94e50658c5fa906ff1 MLOCK_* is not in the POSIX reserved namespace for sys/mman.h --- arch/aarch64/bits/mman.h | 1 + arch/arm/bits/mman.h | 1 + arch/i386/bits/mman.h | 1 + arch/microblaze/bits/mman.h | 1 + arch/mips/bits/mman.h | 1 + arch/or1k/bits/mman.h | 1 + arch/powerpc/bits/mman.h | 1 + arch/sh/bits/mman.h | 1 + arch/x32/bits/mman.h | 1 + arch/x86_64/bits/mman.h | 1 + include/sys/mman.h | 1 + 11 files changed, 11 insertions(+) diff --git a/arch/aarch64/bits/mman.h b/arch/aarch64/bits/mman.h index ce5519f2..31ece5bf 100644 --- a/arch/aarch64/bits/mman.h +++ b/arch/aarch64/bits/mman.h @@ -36,6 +36,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/arm/bits/mman.h b/arch/arm/bits/mman.h index cc854aae..ea6f6a78 100644 --- a/arch/arm/bits/mman.h +++ b/arch/arm/bits/mman.h @@ -37,6 +37,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/i386/bits/mman.h b/arch/i386/bits/mman.h index 0f53acb7..0c9022fd 100644 --- a/arch/i386/bits/mman.h +++ b/arch/i386/bits/mman.h @@ -38,6 +38,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/microblaze/bits/mman.h b/arch/microblaze/bits/mman.h index cc854aae..ea6f6a78 100644 --- a/arch/microblaze/bits/mman.h +++ b/arch/microblaze/bits/mman.h @@ -37,6 +37,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/mips/bits/mman.h b/arch/mips/bits/mman.h index 3125fc2b..cb9ac539 100644 --- a/arch/mips/bits/mman.h +++ b/arch/mips/bits/mman.h @@ -37,6 +37,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/or1k/bits/mman.h b/arch/or1k/bits/mman.h index cc854aae..ea6f6a78 100644 --- a/arch/or1k/bits/mman.h +++ b/arch/or1k/bits/mman.h @@ -37,6 +37,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/powerpc/bits/mman.h b/arch/powerpc/bits/mman.h index 779fddec..6581edc5 100644 --- a/arch/powerpc/bits/mman.h +++ b/arch/powerpc/bits/mman.h @@ -38,6 +38,7 @@ #define MCL_CURRENT 0x2000 #define MCL_FUTURE 0x4000 +#define MCL_ONFAULT 0x8000 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/sh/bits/mman.h b/arch/sh/bits/mman.h index f6fc98f0..3a25df1e 100644 --- a/arch/sh/bits/mman.h +++ b/arch/sh/bits/mman.h @@ -38,6 +38,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/x32/bits/mman.h b/arch/x32/bits/mman.h index 846b7eae..f3235f4e 100644 --- a/arch/x32/bits/mman.h +++ b/arch/x32/bits/mman.h @@ -38,6 +38,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/arch/x86_64/bits/mman.h b/arch/x86_64/bits/mman.h index 846b7eae..f3235f4e 100644 --- a/arch/x86_64/bits/mman.h +++ b/arch/x86_64/bits/mman.h @@ -38,6 +38,7 @@ #define MCL_CURRENT 1 #define MCL_FUTURE 2 +#define MCL_ONFAULT 4 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #define MADV_NORMAL 0 diff --git a/include/sys/mman.h b/include/sys/mman.h index 9fc2db51..a1864ec8 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -39,6 +39,7 @@ int remap_file_pages (void *, size_t, int, size_t, int); #endif #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +#define MLOCK_ONFAULT 0x01 int madvise (void *, size_t, int); int mincore (void *, size_t, unsigned char *); #endif -- 2.25.1