mdbx: remove obsolete mlock().

Change-Id: I23df282d545eac9dd7bf9df1bd71dedbccc45cfd
This commit is contained in:
Leo Yuriev 2017-07-26 11:48:34 +03:00
parent 4fa4129add
commit 9e473ab6f2
3 changed files with 1 additions and 18 deletions

View File

@ -4219,14 +4219,6 @@ static int __cold mdbx_env_map(MDBX_env *env, size_t usedsize) {
return errno;
#endif
/* Lock meta pages to avoid unexpected write,
* before the data pages would be synchronized. */
if (env->me_flags & MDBX_WRITEMAP) {
rc = mdbx_mlock(&env->me_dxb_mmap, pgno2bytes(env, NUM_METAS));
if (unlikely(rc != MDBX_SUCCESS))
return rc;
}
#ifdef USE_VALGRIND
env->me_valgrind_handle =
VALGRIND_CREATE_BLOCK(env->me_map, env->me_mapsize, "mdbx");

View File

@ -930,14 +930,6 @@ int mdbx_munmap(mdbx_mmap_t *map) {
return MDBX_SUCCESS;
}
int mdbx_mlock(mdbx_mmap_t *map, size_t length) {
#if defined(_WIN32) || defined(_WIN64)
return VirtualLock(map->address, length) ? MDBX_SUCCESS : GetLastError();
#else
return (mlock(map->address, length) == 0) ? MDBX_SUCCESS : errno;
#endif
}
int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t must, size_t limit) {
assert(must <= limit);
#if defined(_WIN32) || defined(_WIN64)

View File

@ -1,4 +1,4 @@
/* https://en.wikipedia.org/wiki/Operating_system_abstraction_layer */
/* https://en.wikipedia.org/wiki/Operating_system_abstraction_layer */
/*
* Copyright 2015-2017 Leonid Yuriev <leo@yuriev.ru>
@ -455,7 +455,6 @@ typedef struct mdbx_mmap_param {
int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t must, size_t limit);
int mdbx_munmap(mdbx_mmap_t *map);
int mdbx_mlock(mdbx_mmap_t *map, size_t length);
int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t current, size_t wanna);
int mdbx_msync(mdbx_mmap_t *map, size_t offset, size_t length, int async);