distinguish between mmap / mremap errors

This commit is contained in:
Daniel Micay 2018-10-10 19:05:35 -04:00
parent 2381d973b1
commit 54c78fe1c2

View File

@ -20,7 +20,7 @@ int memory_map_fixed(void *ptr, size_t size) {
void *p = mmap(ptr, size, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED, -1, 0);
if (unlikely(p == MAP_FAILED)) {
if (errno != ENOMEM) {
fatal_error("non-ENOMEM mmap failure");
fatal_error("non-ENOMEM MAP_FIXED mmap failure");
}
return 1;
}
@ -66,7 +66,7 @@ int memory_remap_fixed(void *old, size_t old_size, void *new, size_t new_size) {
void *ptr = mremap(old, old_size, new_size, MREMAP_MAYMOVE|MREMAP_FIXED, new);
if (unlikely(ptr == MAP_FAILED)) {
if (errno != ENOMEM) {
fatal_error("non-ENOMEM mremap failure");
fatal_error("non-ENOMEM MREMAP_FIXED mremap failure");
}
return 1;
}