distinguish between mmap / mremap errors
parent
2381d973b1
commit
54c78fe1c2
4
memory.c
4
memory.c
|
@ -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);
|
void *p = mmap(ptr, size, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED, -1, 0);
|
||||||
if (unlikely(p == MAP_FAILED)) {
|
if (unlikely(p == MAP_FAILED)) {
|
||||||
if (errno != ENOMEM) {
|
if (errno != ENOMEM) {
|
||||||
fatal_error("non-ENOMEM mmap failure");
|
fatal_error("non-ENOMEM MAP_FIXED mmap failure");
|
||||||
}
|
}
|
||||||
return 1;
|
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);
|
void *ptr = mremap(old, old_size, new_size, MREMAP_MAYMOVE|MREMAP_FIXED, new);
|
||||||
if (unlikely(ptr == MAP_FAILED)) {
|
if (unlikely(ptr == MAP_FAILED)) {
|
||||||
if (errno != ENOMEM) {
|
if (errno != ENOMEM) {
|
||||||
fatal_error("non-ENOMEM mremap failure");
|
fatal_error("non-ENOMEM MREMAP_FIXED mremap failure");
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue