mirror of https://git.musl-libc.org/git/musl
Browse Source
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.master
committed by
Rich Felker
2 changed files with 18 additions and 3 deletions
@ -0,0 +1,10 @@ |
|||||
|
#define _GNU_SOURCE 1 |
||||
|
#include <sys/mman.h> |
||||
|
#include "syscall.h" |
||||
|
|
||||
|
int mlock2(const void *addr, size_t len, unsigned flags) |
||||
|
{ |
||||
|
if (flags == 0) |
||||
|
return mlock(addr, len); |
||||
|
return syscall(SYS_mlock2, addr, len, flags); |
||||
|
} |
||||
Loading…
Reference in new issue