mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:14:14 +08:00
mdbx-windows: more for running under Wine.
Wine unable create mapped-view large tran secton size. More for https://github.com/erthink/libmdbx/issues/83 Change-Id: I93e98d58a827c785f8257cd9cac387a333e59621
This commit is contained in:
parent
fbf55e17cb
commit
6248b67f75
@ -4662,6 +4662,8 @@ static __cold int mdbx_mapresize(MDBX_env *env, const pgno_t used_pgno,
|
|||||||
* the local threads for safe remap.
|
* the local threads for safe remap.
|
||||||
* 2) At least on Windows 10 1803 the entire mapped section is unavailable
|
* 2) At least on Windows 10 1803 the entire mapped section is unavailable
|
||||||
* for short time during NtExtendSection() or VirtualAlloc() execution.
|
* 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! */
|
* THEREFORE LOCAL THREADS SUSPENDING IS ALWAYS REQUIRED! */
|
||||||
array_onstack.limit = ARRAY_LENGTH(array_onstack.handles);
|
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 (txn->mt_flags & MDBX_RDONLY) {
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#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;
|
txn->mt_flags |= MDBX_SHRINK_ALLOWED;
|
||||||
mdbx_srwlock_AcquireShared(&env->me_remap_guard);
|
mdbx_srwlock_AcquireShared(&env->me_remap_guard);
|
||||||
}
|
}
|
||||||
|
@ -1300,7 +1300,8 @@ MDBX_INTERNAL_FUNC int mdbx_mmap(const int flags, mdbx_mmap_t *map,
|
|||||||
if (!NT_SUCCESS(err))
|
if (!NT_SUCCESS(err))
|
||||||
return ntstatus2errcode(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(
|
err = NtMapViewOfSection(
|
||||||
map->section, GetCurrentProcess(), &map->address,
|
map->section, GetCurrentProcess(), &map->address,
|
||||||
/* ZeroBits */ 0,
|
/* ZeroBits */ 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user