More changes to compile on macOS (incomplete)

This commit is contained in:
John J. Camilleri
2021-10-12 15:29:29 +02:00
parent f9c6e94672
commit ead1160a75
7 changed files with 49 additions and 16 deletions

View File

@@ -883,8 +883,16 @@ object PgfDB::malloc_internal(size_t bytes)
throw pgf_systemerror(errno, filepath);
}
// OSX mman and mman-win32 do not implement mremap or MREMAP_MAYMOVE
#ifndef MREMAP_MAYMOVE
if (munmap(ms, old_size) == -1)
throw pgf_systemerror(errno);
malloc_state* new_ms =
(malloc_state*) mmap(0, new_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
#else
malloc_state* new_ms =
(malloc_state*) mremap(ms, old_size, new_size, MREMAP_MAYMOVE);
#endif
if (new_ms == MAP_FAILED)
throw pgf_systemerror(errno);