1 // SPDX-License-Identifier: GPL-2.0
7 #include <sys/resource.h>
9 static int test_limit(void)
15 if (getrlimit(RLIMIT_MEMLOCK, &lims)) {
20 if (mlockall(MCL_ONFAULT | MCL_FUTURE)) {
25 map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE,
26 MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
27 if (map != MAP_FAILED)
28 printf("mmap should have failed, but didn't\n");
31 munmap(map, 2 * lims.rlim_max);
38 int main(int argc, char **argv)