diff options
author | Szabolcs Nagy <nsz@port70.net> | 2018-04-28 17:25:41 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-06-20 21:35:45 -0400 |
commit | b64d66d0b04fde0af63c3a292be423736294dca9 (patch) | |
tree | 8235178c05ce2e5de96f16c3ad3b14f3d47b1e18 /include/sys/mman.h | |
parent | 84b25160e7e15e7531533a9a6b22d5431d1b7629 (diff) | |
download | musl-b64d66d0b04fde0af63c3a292be423736294dca9.tar.gz musl-b64d66d0b04fde0af63c3a292be423736294dca9.tar.xz musl-b64d66d0b04fde0af63c3a292be423736294dca9.zip |
add mlock2 linux syscall wrapper
mlock2 syscall was added in linux v4.4 and glibc has api for it. It falls back to mlock in case of flags==0, so that case works even on older kernels. MLOCK_ONFAULT is moved under _GNU_SOURCE following glibc.
Diffstat (limited to 'include/sys/mman.h')
-rw-r--r-- | include/sys/mman.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/sys/mman.h b/include/sys/mman.h index 19dd844e..80e1da75 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -94,6 +94,13 @@ extern "C" { #define MADV_SOFT_OFFLINE 101 #endif +#ifdef _GNU_SOURCE +#define MREMAP_MAYMOVE 1 +#define MREMAP_FIXED 2 + +#define MLOCK_ONFAULT 0x01 +#endif + #include <bits/mman.h> void *mmap (void *, size_t, int, int, int, off_t); @@ -110,14 +117,12 @@ int mlockall (int); int munlockall (void); #ifdef _GNU_SOURCE -#define MREMAP_MAYMOVE 1 -#define MREMAP_FIXED 2 void *mremap (void *, size_t, size_t, int, ...); int remap_file_pages (void *, size_t, int, size_t, int); +int mlock2 (const void *, size_t, unsigned); #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 |