.expect_failure = should_fail \
}
-/* Returns mmap_min_addr sysctl tunable from procfs */
-static unsigned long long get_mmap_min_addr(void)
-{
- FILE *fp;
- int n_matched;
- static unsigned long long addr;
-
- if (addr)
- return addr;
-
- fp = fopen("/proc/sys/vm/mmap_min_addr", "r");
- if (fp == NULL) {
- ksft_print_msg("Failed to open /proc/sys/vm/mmap_min_addr: %s\n",
- strerror(errno));
- exit(KSFT_SKIP);
- }
-
- n_matched = fscanf(fp, "%llu", &addr);
- if (n_matched != 1) {
- ksft_print_msg("Failed to read /proc/sys/vm/mmap_min_addr: %s\n",
- strerror(errno));
- fclose(fp);
- exit(KSFT_SKIP);
- }
-
- fclose(fp);
- return addr;
-}
-
/*
* Returns false if the requested remap region overlaps with an
* existing mapping (e.g text, stack) else returns true.