shm: Add mmap+memmove fallback if mremap() does not exist

Some operating systems (e.g. FreeBSD) do not implement mremap.
In that case we can grow the mapping by trying to map adjacent memory.
If that fails we can fall back to creating a new larger mapping and
moving the old memory contents there.

Co-authored-by: Koop Mast <kwm@rainbow-runner.nl>
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
This commit is contained in:
Alex Richardson 2021-03-15 22:25:52 +00:00 committed by Alexander Richardson
parent 54b237a612
commit 5a981ee823
4 changed files with 74 additions and 9 deletions

View file

@ -36,6 +36,7 @@ have_funcs = [
'posix_fallocate',
'prctl',
'memfd_create',
'mremap',
'strndup',
]
foreach f: have_funcs