From f80171e07950e93f1dc86af9327c2e998e2fad4b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 11 Mar 2013 06:04:54 -0700 Subject: [PATCH] Check for MADV_RANDOM Android supports madvise but not posix_madvise --- libraries/liblmdb/mdb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 5eed96f356..1d361a7bb1 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2871,8 +2871,14 @@ mdb_env_open2(MDB_env *env) return ErrCode(); } /* Turn off readahead. It's harmful when the DB is larger than RAM. */ +#ifdef MADV_RANDOM + madvise(env->me_map, env->me_mapsize, MADV_RANDOM); +#else +#ifdef POSIX_MADV_RANDOM posix_madvise(env->me_map, env->me_mapsize, POSIX_MADV_RANDOM); -#endif +#endif /* POSIX_MADV_RANDOM */ +#endif /* MADV_RANDOM */ +#endif /* _WIN32 */ if (newenv) { if (flags & MDB_FIXEDMAP) -- 2.39.5