build: patch lmdb to use F_FULLFSYNC on darwin

This commit is contained in:
Joe Bryan 2021-03-15 15:20:57 -07:00
parent a8437da8c1
commit 027c5d4603
2 changed files with 24 additions and 0 deletions

View File

@ -25,4 +25,15 @@ in {
ldapSupport = false;
brotliSupport = false;
};
lmdb = prev.lmdb.overrideAttrs (attrs: {
patches =
if builtins.currentSystem != "x86_64-darwin"
then
attrs.patches
else
optionalList attrs.patches ++ [
../pkgs/lmdb/darwin-fsync.patch
];
});
}

View File

@ -0,0 +1,13 @@
diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c
index fe65e30..0070215 100644
--- a/libraries/liblmdb/mdb.c
+++ b/libraries/liblmdb/mdb.c
@@ -2526,7 +2526,7 @@ mdb_env_sync(MDB_env *env, int force)
rc = ErrCode();
} else
#endif
- if (MDB_FDATASYNC(env->me_fd))
+ if (fcntl(env->me_fd, F_FULLFSYNC, 0))
rc = ErrCode();
}
}