-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow failed MADV_REMOVEs when the only target mappings (if any) are …
…MAP_PRIVATE tcmalloc does this and it's perfectly fine because such MADV_REMOVEs have no effect.
- Loading branch information
1 parent
60e3ddc
commit fa33606
Showing
3 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */ | ||
|
||
#include "util.h" | ||
|
||
int main(void) { | ||
size_t page_size = sysconf(_SC_PAGESIZE); | ||
char* p = | ||
mmap(NULL, page_size*3, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); | ||
test_assert(p != MAP_FAILED); | ||
test_assert(0 == munmap(p + page_size, page_size)); | ||
|
||
test_assert(-1 == madvise(p, page_size, MADV_REMOVE)); | ||
test_assert(errno == EINVAL); | ||
|
||
atomic_puts("EXIT-SUCCESS"); | ||
|
||
return 0; | ||
} |