From ac93f2dd10537cc3c344a1d44d2914e4343b4085 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Mon, 18 Oct 2021 13:54:13 +0200 Subject: [PATCH] Don't call msync in PgfDB::sync on macOS --- src/runtime/c/pgf/db.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/db.cxx b/src/runtime/c/pgf/db.cxx index 6e0e80d5f..4450c29fc 100644 --- a/src/runtime/c/pgf/db.cxx +++ b/src/runtime/c/pgf/db.cxx @@ -1077,7 +1077,13 @@ void PgfDB::sync() size_t size = ms->top + chunksize(ptr(ms,ms->top)) + sizeof(size_t); - int res = msync((void *) ms, size, MS_SYNC | MS_INVALIDATE); + int res; +#ifndef MREMAP_MAYMOVE + if (current_db->fd < 0) { + res = 0; + } else +#endif + res = msync((void *) ms, size, MS_SYNC | MS_INVALIDATE); if (res != 0) throw pgf_systemerror(errno); }