diff options
author | George Hazan <ghazan@miranda.im> | 2020-02-24 21:21:38 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-02-24 21:21:38 +0300 |
commit | bd38e9394c12d86aef954d74fd6137498cd41044 (patch) | |
tree | b4f203dd04aa6d2ec700e0eab8396ad2a753b5b4 /libs/libmdbx/src | |
parent | 9de717660e3965fac37428abb0bc9ffaae6f2061 (diff) |
libmdbx: another fix for Wine
Diffstat (limited to 'libs/libmdbx/src')
-rw-r--r-- | libs/libmdbx/src/src/elements/core.c | 9 | ||||
-rw-r--r-- | libs/libmdbx/src/src/elements/osal.c | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libs/libmdbx/src/src/elements/core.c b/libs/libmdbx/src/src/elements/core.c index 9277f94270..eb86fd1448 100644 --- a/libs/libmdbx/src/src/elements/core.c +++ b/libs/libmdbx/src/src/elements/core.c @@ -4662,6 +4662,8 @@ static __cold int mdbx_mapresize(MDBX_env *env, const pgno_t used_pgno, * the local threads for safe remap. * 2) At least on Windows 10 1803 the entire mapped section is unavailable * for short time during NtExtendSection() or VirtualAlloc() execution. + * 3) Under Wine runtime environment on Linux a section extending is not + * supported. Therefore thread suspending is always required. * * THEREFORE LOCAL THREADS SUSPENDING IS ALWAYS REQUIRED! */ array_onstack.limit = ARRAY_LENGTH(array_onstack.handles); @@ -6062,7 +6064,12 @@ static int mdbx_txn_renew0(MDBX_txn *txn, unsigned flags) { } if (txn->mt_flags & MDBX_RDONLY) { #if defined(_WIN32) || defined(_WIN64) - if (size > env->me_dbgeo.lower && env->me_dbgeo.shrink) { + if ((size > env->me_dbgeo.lower && env->me_dbgeo.shrink) || + (mdbx_RunningUnderWine() && + /* under Wine acquisition of remap_guard is always required, + * since Wine don't support section extending, + * i.e. in both cases unmap+map are required. */ + size < env->me_dbgeo.upper && env->me_dbgeo.grow)) { txn->mt_flags |= MDBX_SHRINK_ALLOWED; mdbx_srwlock_AcquireShared(&env->me_remap_guard); } diff --git a/libs/libmdbx/src/src/elements/osal.c b/libs/libmdbx/src/src/elements/osal.c index 50c84a023b..9a4afba89e 100644 --- a/libs/libmdbx/src/src/elements/osal.c +++ b/libs/libmdbx/src/src/elements/osal.c @@ -1303,7 +1303,8 @@ MDBX_INTERNAL_FUNC int mdbx_mmap(const int flags, mdbx_mmap_t *map, if (!NT_SUCCESS(err)) return ntstatus2errcode(err); - SIZE_T ViewSize = (flags & MDBX_RDONLY) ? 0 : limit; + SIZE_T ViewSize = + (flags & MDBX_RDONLY) ? 0 : mdbx_RunningUnderWine() ? size : limit; err = NtMapViewOfSection( map->section, GetCurrentProcess(), &map->address, /* ZeroBits */ 0, |