selftest: split mlock2_ funcs into separate mlock2.h
[cascardo/linux.git] / tools / testing / selftests / vm / mlock2.h
1 #include <syscall.h>
2 #include <errno.h>
3
4 #ifndef MLOCK_ONFAULT
5 #define MLOCK_ONFAULT 1
6 #endif
7
8 #ifndef MCL_ONFAULT
9 #define MCL_ONFAULT (MCL_FUTURE << 1)
10 #endif
11
12 static int mlock2_(void *start, size_t len, int flags)
13 {
14 #ifdef __NR_mlock2
15         return syscall(__NR_mlock2, start, len, flags);
16 #else
17         errno = ENOSYS;
18         return -1;
19 #endif
20 }