1 // SPDX-License-Identifier: GPL-2.0
7 #include <sys/resource.h>
10 #define MCL_ONFAULT (MCL_FUTURE << 1)
13 static int test_limit(void)
19 if (getrlimit(RLIMIT_MEMLOCK, &lims)) {
24 if (mlockall(MCL_ONFAULT | MCL_FUTURE)) {
29 map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE,
30 MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
31 if (map != MAP_FAILED)
32 printf("mmap should have failed, but didn't\n");
35 munmap(map, 2 * lims.rlim_max);
42 int main(int argc, char **argv)