From 29de655bc42e9eecaafcb5a65177a8fae801b154 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 11 Nov 2011 12:49:11 -0800 Subject: [PATCH] Add MDB_FDATASYNC to allow override to fsync if needed. --- libraries/libmdb/mdb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 320b1eabd8..fd7f7fa195 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -200,6 +200,13 @@ #ifndef MDB_DSYNC # define MDB_DSYNC O_DSYNC #endif +#endif + +/** Function for flushing the data of a file. Define this to fsync + * if fdatasync() is not supported. + */ +#ifndef MDB_FDATASYNC +# define MDB_FDATASYNC fdatasync #endif /** A page number in the database. @@ -1283,7 +1290,7 @@ mdb_env_sync(MDB_env *env, int force) { int rc = 0; if (force || !F_ISSET(env->me_flags, MDB_NOSYNC)) { - if (fdatasync(env->me_fd)) + if (MDB_FDATASYNC(env->me_fd)) rc = ErrCode(); } return rc; -- 2.39.5