#include <sys/mman.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <sys/time.h> #include <sys/resource.h> #ifndef MCL_ONFAULT #define MCL_ONFAULT (MCL_FUTURE << 1) #endif
static int test_limit(void) { int ret = 1; struct rlimit lims; void *map; if (getrlimit(RLIMIT_MEMLOCK, &lims)) { perror("getrlimit"); return ret; } if (mlockall(MCL_CURRENT | MCL_ONFAULT | MCL_FUTURE)) { perror("mlockall"); return ret; } map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0); if (map != MAP_FAILED) printf("mmap should have failed, but didn't\n"); else { ret = 0; munmap(map, 2 * lims.rlim_max); } munlockall(); return ret; }Contributors
Person | Tokens | Prop | Commits | CommitProp | |
eric b munson | eric b munson | 124 | 100.00% | 1 | 100.00% |
Total | 124 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
eric b munson | eric b munson | 26 | 100.00% | 1 | 100.00% |
Total | 26 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
eric b munson | eric b munson | 177 | 100.00% | 1 | 100.00% |
Total | 177 | 100.00% | 1 | 100.00% |