summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/libmdbx/src/CMakeLists.dist-minimal2
-rw-r--r--libs/libmdbx/src/CMakeLists.txt2
-rw-r--r--libs/libmdbx/src/README.md22
-rw-r--r--libs/libmdbx/src/cmake/compiler.cmake14
-rw-r--r--libs/libmdbx/src/mdbx.h8
-rw-r--r--libs/libmdbx/src/src/elements/config.h6
-rw-r--r--libs/libmdbx/src/src/elements/core.c4
-rw-r--r--libs/libmdbx/src/src/elements/defs.h16
-rw-r--r--libs/libmdbx/src/src/elements/lck-windows.c64
-rw-r--r--libs/libmdbx/src/src/elements/osal.c89
-rw-r--r--libs/libmdbx/src/src/elements/osal.h11
-rw-r--r--libs/libmdbx/src/src/elements/version.c6
-rw-r--r--libs/libmdbx/src/src/man1/mdbx_chk.12
-rw-r--r--libs/libmdbx/src/src/man1/mdbx_copy.12
-rw-r--r--libs/libmdbx/src/src/man1/mdbx_dump.12
-rw-r--r--libs/libmdbx/src/src/man1/mdbx_load.12
-rw-r--r--libs/libmdbx/src/src/man1/mdbx_stat.12
17 files changed, 128 insertions, 126 deletions
diff --git a/libs/libmdbx/src/CMakeLists.dist-minimal b/libs/libmdbx/src/CMakeLists.dist-minimal
index fa330a9878..fdcd41d308 100644
--- a/libs/libmdbx/src/CMakeLists.dist-minimal
+++ b/libs/libmdbx/src/CMakeLists.dist-minimal
@@ -25,7 +25,7 @@
##
## libmdbx = { Revised and extended descendant of Symas LMDB. }
-## Please see README.md at https://github.com/leo-yuriev/libmdbx
+## Please see README.md at https://github.com/erthink/libmdbx
##
## Libmdbx is superior to LMDB in terms of features and reliability,
## not inferior in performance. libmdbx works on Linux, FreeBSD, MacOS X
diff --git a/libs/libmdbx/src/CMakeLists.txt b/libs/libmdbx/src/CMakeLists.txt
index e642f31a98..e67cdbe92a 100644
--- a/libs/libmdbx/src/CMakeLists.txt
+++ b/libs/libmdbx/src/CMakeLists.txt
@@ -14,7 +14,7 @@
##
## libmdbx = { Revised and extended descendant of Symas LMDB. }
-## Please see README.md at https://github.com/leo-yuriev/libmdbx
+## Please see README.md at https://github.com/erthink/libmdbx
##
## Libmdbx is superior to LMDB in terms of features and reliability,
## not inferior in performance. libmdbx works on Linux, FreeBSD, MacOS X
diff --git a/libs/libmdbx/src/README.md b/libs/libmdbx/src/README.md
index d5c24f5545..4cbea049c2 100644
--- a/libs/libmdbx/src/README.md
+++ b/libs/libmdbx/src/README.md
@@ -49,8 +49,8 @@ _MithrilDB_ is rightly relevant name.
> revolution is to provide a clearer and robust API, add more features and
> new valuable properties of database.
-[![Build Status](https://travis-ci.org/leo-yuriev/libmdbx.svg?branch=master)](https://travis-ci.org/leo-yuriev/libmdbx)
-[![Build status](https://ci.appveyor.com/api/projects/status/ue94mlopn50dqiqg/branch/master?svg=true)](https://ci.appveyor.com/project/leo-yuriev/libmdbx/branch/master)
+[![Build Status](https://travis-ci.org/erthink/libmdbx.svg?branch=master)](https://travis-ci.org/erthink/libmdbx)
+[![Build status](https://ci.appveyor.com/api/projects/status/ue94mlopn50dqiqg/branch/master?svg=true)](https://ci.appveyor.com/project/erthink/libmdbx/branch/master)
[![Coverity Scan Status](https://scan.coverity.com/projects/12915/badge.svg)](https://scan.coverity.com/projects/reopen-libmdbx)
*The Future will (be) [Positive](https://www.ptsecurity.com). Всё будет хорошо.*
@@ -268,12 +268,12 @@ named mutexes are used.
### History
At first the development was carried out within the
-[ReOpenLDAP](https://github.com/leo-yuriev/ReOpenLDAP) project. About a
+[ReOpenLDAP](https://github.com/erthink/ReOpenLDAP) project. About a
year later _libmdbx_ was separated into standalone project, which was
[presented at Highload++ 2015
conference](http://www.highload.ru/2015/abstracts/1831.html).
-Since 2017 _libmdbx_ is used in [Fast Positive Tables](https://github.com/leo-yuriev/libfpta),
+Since 2017 _libmdbx_ is used in [Fast Positive Tables](https://github.com/erthink/libfpta),
and development is funded by [Positive Technologies](https://www.ptsecurity.com).
### Acknowledgments
@@ -445,7 +445,7 @@ Here showed sum of performance metrics in 3 benchmarks:
2. Performance gap is too high to compare in any meaningful way.
-![Comparison #1: Integral Performance](https://raw.githubusercontent.com/wiki/leo-yuriev/libmdbx/img/perf-slide-1.png)
+![Comparison #1: Integral Performance](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-1.png)
--------------------------------------------------------------------------------
@@ -454,7 +454,7 @@ Here showed sum of performance metrics in 3 benchmarks:
Summary performance with concurrent read/search queries in 1-2-4-8
threads on 4 CPU cores machine.
-![Comparison #2: Read Scalability](https://raw.githubusercontent.com/wiki/leo-yuriev/libmdbx/img/perf-slide-2.png)
+![Comparison #2: Read Scalability](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-2.png)
--------------------------------------------------------------------------------
@@ -476,7 +476,7 @@ In the benchmark each transaction contains combined CRUD operations (2
inserts, 1 read, 1 update, 1 delete). Benchmark starts on empty database
and after full run the database contains 10,000 small key-value records.
-![Comparison #3: Sync-write mode](https://raw.githubusercontent.com/wiki/leo-yuriev/libmdbx/img/perf-slide-3.png)
+![Comparison #3: Sync-write mode](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-3.png)
--------------------------------------------------------------------------------
@@ -503,7 +503,7 @@ and after full run the database contains 100,000 small key-value
records.
-![Comparison #4: Lazy-write mode](https://raw.githubusercontent.com/wiki/leo-yuriev/libmdbx/img/perf-slide-4.png)
+![Comparison #4: Lazy-write mode](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-4.png)
--------------------------------------------------------------------------------
@@ -527,7 +527,7 @@ In the benchmark each transaction contains combined CRUD operations (2
inserts, 1 read, 1 update, 1 delete). Benchmark starts on empty database
and after full run the database contains 10,000 small key-value records.
-![Comparison #5: Async-write mode](https://raw.githubusercontent.com/wiki/leo-yuriev/libmdbx/img/perf-slide-5.png)
+![Comparison #5: Async-write mode](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-5.png)
--------------------------------------------------------------------------------
@@ -551,8 +551,8 @@ All benchmark data is gathered by
[getrusage()](http://man7.org/linux/man-pages/man2/getrusage.2.html)
syscall and by scanning data directory.
-![Comparison #6: Cost comparison](https://raw.githubusercontent.com/wiki/leo-yuriev/libmdbx/img/perf-slide-6.png)
+![Comparison #6: Cost comparison](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-6.png)
--------------------------------------------------------------------------------
-### The [repository now only mirrored on the Github](https://abf.io/erthink/libmdbx) due to illegal discriminatory restrictions for Russian Crimea and for sovereign crimeans.
+#### This is a mirror of the origin repository that was moved to [abf.io](https://abf.io/erthink/) because of discriminatory restrictions for Russian Crimea.
diff --git a/libs/libmdbx/src/cmake/compiler.cmake b/libs/libmdbx/src/cmake/compiler.cmake
index 7936244f69..93c2c9f18b 100644
--- a/libs/libmdbx/src/cmake/compiler.cmake
+++ b/libs/libmdbx/src/cmake/compiler.cmake
@@ -214,14 +214,6 @@ else()
check_compiler_flag("-Ominimal" CC_HAS_OMINIMAL)
check_compiler_flag("-ffunction-sections -fdata-sections" CC_HAS_SECTIONS)
check_compiler_flag("-ffast-math" CC_HAS_FASTMATH)
-
- # Check for an omp support
- set(CMAKE_REQUIRED_FLAGS "-fopenmp -Werror")
- check_cxx_source_compiles("int main(void) {
- #pragma omp parallel
- return 0;
- }" HAVE_OPENMP)
- set(CMAKE_REQUIRED_FLAGS "")
endif()
# Check for LTO support by GCC
@@ -367,7 +359,7 @@ if(CMAKE_COMPILER_IS_CLANG)
set(CMAKE_CLANG_NM ${CMAKE_NM})
endif()
if (NOT CMAKE_CLANG_RANLIB)
- set(CMAKE_CLANG_RANLIB ${CMAKE_RANLIB })
+ set(CMAKE_CLANG_RANLIB ${CMAKE_RANLIB})
endif()
message(STATUS "Assume Link-Time Optimization by CLANG/LLVM is available via ${CMAKE_TOOLCHAIN_FILE}")
else()
@@ -534,10 +526,6 @@ macro(setup_compile_flags)
endif()
endif()
- if(HAVE_OPENMP)
- add_compile_flags("C;CXX" "-fopenmp")
- endif()
-
if (ENABLE_ASAN)
add_compile_flags("C;CXX" -fsanitize=address)
endif()
diff --git a/libs/libmdbx/src/mdbx.h b/libs/libmdbx/src/mdbx.h
index 8c9c865129..a832448943 100644
--- a/libs/libmdbx/src/mdbx.h
+++ b/libs/libmdbx/src/mdbx.h
@@ -628,8 +628,8 @@ typedef pthread_t mdbx_tid_t;
#ifndef __dll_export
#if defined(_WIN32) || defined(__CYGWIN__)
-#if defined(__GNUC__) || __has_attribute(dllexport)
-#define __dll_export __attribute__((dllexport))
+#if defined(__GNUC__) || __has_attribute(__dllexport__)
+#define __dll_export __attribute__((__dllexport__))
#elif defined(_MSC_VER)
#define __dll_export __declspec(dllexport)
#else
@@ -644,8 +644,8 @@ typedef pthread_t mdbx_tid_t;
#ifndef __dll_import
#if defined(_WIN32) || defined(__CYGWIN__)
-#if defined(__GNUC__) || __has_attribute(dllimport)
-#define __dll_import __attribute__((dllimport))
+#if defined(__GNUC__) || __has_attribute(__dllimport__)
+#define __dll_import __attribute__((__dllimport__))
#elif defined(_MSC_VER)
#define __dll_import __declspec(dllimport)
#else
diff --git a/libs/libmdbx/src/src/elements/config.h b/libs/libmdbx/src/src/elements/config.h
index fcd035b093..38813164bf 100644
--- a/libs/libmdbx/src/src/elements/config.h
+++ b/libs/libmdbx/src/src/elements/config.h
@@ -45,12 +45,12 @@
#endif
/* Build Info */
-#define MDBX_BUILD_TIMESTAMP "2020-01-21T15:55:59Z"
+#define MDBX_BUILD_TIMESTAMP "2020-02-21T09:26:28Z"
#define MDBX_BUILD_TARGET "x86_64-Windows"
/* #undef MDBX_BUILD_CONFIG */
-#define MDBX_BUILD_COMPILER "MSVC-19.24.28315.0"
+#define MDBX_BUILD_COMPILER "MSVC-19.24.28316.0"
#define MDBX_BUILD_FLAGS "LIBMDBX_EXPORTS"
-#define MDBX_BUILD_SOURCERY 425d81103531494ef1989854f912bed8cbcb3acfa86c50ce374995c7edf1eb16_v0_6_0_1_g32db811
+#define MDBX_BUILD_SOURCERY 0e8083ca08c70e6b3897c7ce4a313edce5ac635ec38248f6d6bb18c475e1ce94_v0_6_0_38_g9bdac28
/* *INDENT-ON* */
/* clang-format on */
diff --git a/libs/libmdbx/src/src/elements/core.c b/libs/libmdbx/src/src/elements/core.c
index 306ce6bc3b..ce940ae902 100644
--- a/libs/libmdbx/src/src/elements/core.c
+++ b/libs/libmdbx/src/src/elements/core.c
@@ -4890,7 +4890,7 @@ __hot static int mdbx_page_alloc(MDBX_cursor *mc, const unsigned num,
flags &= ~(MDBX_ALLOC_GC | MDBX_COALESCE | MDBX_LIFORECLAIM);
} else if (unlikely(txn->mt_dbs[FREE_DBI].md_entries == 0)) {
/* avoid (recursive) search inside empty tree and while tree is updating,
- * https://github.com/leo-yuriev/libmdbx/issues/31 */
+ * https://github.com/erthink/libmdbx/issues/31 */
flags &= ~MDBX_ALLOC_GC;
}
}
@@ -9932,7 +9932,7 @@ int __cold mdbx_env_open(MDBX_env *env, const char *pathname, unsigned flags,
} else {
#if MDBX_MMAP_INCOHERENT_FILE_WRITE
/* Temporary `workaround` for OpenBSD kernel's flaw.
- * See https://github.com/leo-yuriev/libmdbx/issues/67 */
+ * See https://github.com/erthink/libmdbx/issues/67 */
if ((flags & MDBX_WRITEMAP) == 0) {
if (flags & MDBX_ACCEDE)
flags |= MDBX_WRITEMAP;
diff --git a/libs/libmdbx/src/src/elements/defs.h b/libs/libmdbx/src/src/elements/defs.h
index dfbde2ea61..b2710eede8 100644
--- a/libs/libmdbx/src/src/elements/defs.h
+++ b/libs/libmdbx/src/src/elements/defs.h
@@ -118,10 +118,8 @@
# define __noinline __attribute__((__noinline__))
# elif defined(_MSC_VER)
# define __noinline __declspec(noinline)
-# elif defined(__SUNPRO_C) || defined(__sun) || defined(sun)
-# define __noinline inline
-# elif !defined(__INTEL_COMPILER)
-# define __noinline /* FIXME ? */
+# else
+# define __noinline
# endif
#endif /* __noinline */
@@ -164,7 +162,7 @@
#endif /* __unreachable */
#ifndef __prefetch
-# if defined(__GNUC__) || defined(__clang__)
+# if defined(__GNUC__) || defined(__clang__) || __has_builtin(__builtin_prefetch)
# define __prefetch(ptr) __builtin_prefetch(ptr)
# else
# define __prefetch(ptr) __noop(ptr)
@@ -237,15 +235,13 @@
#ifndef __optimize
# if defined(__OPTIMIZE__)
-# if defined(__clang__) && !__has_attribute(__optimize__)
-# define __optimize(ops)
-# elif defined(__GNUC__) || __has_attribute(__optimize__)
+# if (defined(__GNUC__) && !defined(__clang__)) || __has_attribute(__optimize__)
# define __optimize(ops) __attribute__((__optimize__(ops)))
# else
# define __optimize(ops)
# endif
# else
-# define __optimize(ops)
+# define __optimize(ops)
# endif
#endif /* __optimize */
@@ -312,7 +308,7 @@
#ifndef __printf_args
# if defined(__GNUC__) || __has_attribute(__format__)
# define __printf_args(format_index, first_arg) \
- __attribute__((__format__(printf, format_index, first_arg)))
+ __attribute__((__format__(__printf__, format_index, first_arg)))
# else
# define __printf_args(format_index, first_arg)
# endif
diff --git a/libs/libmdbx/src/src/elements/lck-windows.c b/libs/libmdbx/src/src/elements/lck-windows.c
index 977457de37..2d4c7d1a94 100644
--- a/libs/libmdbx/src/src/elements/lck-windows.c
+++ b/libs/libmdbx/src/src/elements/lck-windows.c
@@ -717,6 +717,7 @@ static uint64_t WINAPI stub_GetTickCount64(void) {
/*----------------------------------------------------------------------------*/
#ifndef MDBX_ALLOY
+MDBX_NtExtendSection mdbx_NtExtendSection;
MDBX_GetFileInformationByHandleEx mdbx_GetFileInformationByHandleEx;
MDBX_GetVolumeInformationByHandleW mdbx_GetVolumeInformationByHandleW;
MDBX_GetFinalPathNameByHandleW mdbx_GetFinalPathNameByHandleW;
@@ -732,7 +733,47 @@ MDBX_ReclaimVirtualMemory mdbx_ReclaimVirtualMemory;
#endif /* MDBX_ALLOY */
static void mdbx_winnt_import(void) {
+ const HINSTANCE hNtdll = GetModuleHandleA("ntdll.dll");
+
+#define GET_PROC_ADDR(dll, ENTRY) \
+ mdbx_##ENTRY = (MDBX_##ENTRY)GetProcAddress(dll, #ENTRY)
+
+ if (GetProcAddress(hNtdll, "wine_get_version")) {
+ assert(mdbx_RunningUnderWine());
+ } else {
+ GET_PROC_ADDR(hNtdll, NtFsControlFile);
+ GET_PROC_ADDR(hNtdll, NtExtendSection);
+ assert(!mdbx_RunningUnderWine());
+ }
+
const HINSTANCE hKernel32dll = GetModuleHandleA("kernel32.dll");
+ GET_PROC_ADDR(hKernel32dll, GetFileInformationByHandleEx);
+ GET_PROC_ADDR(hKernel32dll, SetFileInformationByHandle);
+ GET_PROC_ADDR(hKernel32dll, GetTickCount64);
+ if (!mdbx_GetTickCount64)
+ mdbx_GetTickCount64 = stub_GetTickCount64;
+ if (!mdbx_RunningUnderWine()) {
+ GET_PROC_ADDR(hKernel32dll, GetVolumeInformationByHandleW);
+ GET_PROC_ADDR(hKernel32dll, GetFinalPathNameByHandleW);
+ GET_PROC_ADDR(hKernel32dll, PrefetchVirtualMemory);
+ }
+
+#if 0 /* LY: unused for now */
+ if (!mdbx_RunningUnderWine()) {
+ GET_PROC_ADDR(hKernel32dll, DiscardVirtualMemory);
+ GET_PROC_ADDR(hKernel32dll, OfferVirtualMemory);
+ GET_PROC_ADDR(hKernel32dll, ReclaimVirtualMemory);
+ }
+ if (!mdbx_DiscardVirtualMemory)
+ mdbx_DiscardVirtualMemory = stub_DiscardVirtualMemory;
+ if (!mdbx_OfferVirtualMemory)
+ mdbx_OfferVirtualMemory = stub_OfferVirtualMemory;
+ if (!mdbx_ReclaimVirtualMemory)
+ mdbx_ReclaimVirtualMemory = stub_ReclaimVirtualMemory;
+#endif /* unused for now */
+
+#undef GET_PROC_ADDR
+
const MDBX_srwlock_function init =
(MDBX_srwlock_function)GetProcAddress(hKernel32dll, "InitializeSRWLock");
if (init != NULL) {
@@ -752,27 +793,4 @@ static void mdbx_winnt_import(void) {
mdbx_srwlock_AcquireExclusive = stub_srwlock_AcquireExclusive;
mdbx_srwlock_ReleaseExclusive = stub_srwlock_ReleaseExclusive;
}
-
-#define GET_KERNEL32_PROC(ENTRY) \
- mdbx_##ENTRY = (MDBX_##ENTRY)GetProcAddress(hKernel32dll, #ENTRY)
- GET_KERNEL32_PROC(GetFileInformationByHandleEx);
- GET_KERNEL32_PROC(GetVolumeInformationByHandleW);
- GET_KERNEL32_PROC(GetFinalPathNameByHandleW);
- GET_KERNEL32_PROC(SetFileInformationByHandle);
- GET_KERNEL32_PROC(PrefetchVirtualMemory);
- GET_KERNEL32_PROC(GetTickCount64);
- if (!mdbx_GetTickCount64)
- mdbx_GetTickCount64 = stub_GetTickCount64;
-#if 0 /* LY: unused for now */
- GET_KERNEL32_PROC(DiscardVirtualMemory);
- if (!mdbx_DiscardVirtualMemory)
- mdbx_DiscardVirtualMemory = stub_DiscardVirtualMemory;
- GET_KERNEL32_PROC(OfferVirtualMemory);
- GET_KERNEL32_PROC(ReclaimVirtualMemory);
-#endif /* unused for now */
-#undef GET_KERNEL32_PROC
-
- const HINSTANCE hNtdll = GetModuleHandleA("ntdll.dll");
- mdbx_NtFsControlFile =
- (MDBX_NtFsControlFile)GetProcAddress(hNtdll, "NtFsControlFile");
}
diff --git a/libs/libmdbx/src/src/elements/osal.c b/libs/libmdbx/src/src/elements/osal.c
index 7d93c0ccee..50c84a023b 100644
--- a/libs/libmdbx/src/src/elements/osal.c
+++ b/libs/libmdbx/src/src/elements/osal.c
@@ -67,23 +67,6 @@ typedef struct _SECTION_BASIC_INFORMATION {
LARGE_INTEGER SectionSize;
} SECTION_BASIC_INFORMATION, *PSECTION_BASIC_INFORMATION;
-typedef enum _SECTION_INFORMATION_CLASS {
- SectionBasicInformation,
- SectionImageInformation,
- SectionRelocationInformation, // name:wow64:whNtQuerySection_SectionRelocationInformation
- MaxSectionInfoClass
-} SECTION_INFORMATION_CLASS;
-
-extern NTSTATUS NTAPI NtQuerySection(
- IN HANDLE SectionHandle, IN SECTION_INFORMATION_CLASS InformationClass,
- OUT PVOID InformationBuffer, IN ULONG InformationBufferSize,
- OUT PULONG ResultLength OPTIONAL);
-
-extern NTSTATUS NTAPI NtExtendSection(IN HANDLE SectionHandle,
- IN PLARGE_INTEGER NewSectionSize);
-
-typedef enum _SECTION_INHERIT { ViewShare = 1, ViewUnmap = 2 } SECTION_INHERIT;
-
extern NTSTATUS NTAPI NtMapViewOfSection(
IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress,
IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize,
@@ -1005,6 +988,9 @@ static int mdbx_check_fs_local(mdbx_filehandle_t handle, int flags) {
return 0;
#if defined(_WIN32) || defined(_WIN64)
+ if (mdbx_RunningUnderWine() && !(flags & MDBX_EXCLUSIVE))
+ return ERROR_NOT_CAPABLE /* workaround for Wine */;
+
if (GetFileType(handle) != FILE_TYPE_DISK)
return ERROR_FILE_OFFLINE;
@@ -1419,8 +1405,10 @@ MDBX_INTERNAL_FUNC int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t size,
if (!(flags & MDBX_RDONLY) && limit == map->limit && size > map->current) {
/* growth rw-section */
+ if (!mdbx_NtExtendSection)
+ return ERROR_CALL_NOT_IMPLEMENTED /* workaround for Wine */;
SectionSize.QuadPart = size;
- status = NtExtendSection(map->section, &SectionSize);
+ status = mdbx_NtExtendSection(map->section, &SectionSize);
if (!NT_SUCCESS(status))
return ntstatus2errcode(status);
map->current = size;
@@ -1810,18 +1798,18 @@ static uint64_t windows_bootime(void) {
return 0;
}
-typedef LSTATUS (APIENTRY *pfnRegGetValueW)(HKEY, LPCWSTR, LPCWSTR, DWORD, LPDWORD, PVOID, LPDWORD);
-static pfnRegGetValueW fnRegGetValueW = nullptr;
+typedef LSTATUS (APIENTRY *pfnRegGetValueA)(HKEY, LPCSTR, LPCSTR, DWORD, LPDWORD, PVOID, LPDWORD);
+static pfnRegGetValueA fnRegGetValueA = nullptr;
-static LSTATUS APIENTRY stubRegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
+static LSTATUS APIENTRY stubRegGetValueA(HKEY hkey, LPCSTR lpSubKey, LPCSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
{
HKEY tmp;
- LSTATUS rc = RegOpenKeyW(hkey, lpSubKey, &tmp);
+ LSTATUS rc = RegOpenKeyA(hkey, lpSubKey, &tmp);
if (rc != 0)
return rc;
DWORD dwType = (dwFlags == RRF_RT_ANY) ? REG_SZ : REG_DWORD;
- rc = RegQueryValueExW(tmp, lpValue, 0, &dwType, pvData, pcbData);
+ rc = RegQueryValueExA(tmp, lpValue, 0, &dwType, pvData, pcbData);
if (rc != 0 && dwFlags == RRF_RT_DWORD) {
rc = 0;
*(DWORD *)pvData = 0xBABAEBA;
@@ -1831,25 +1819,26 @@ static LSTATUS APIENTRY stubRegGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lp
return rc;
}
-static LSTATUS mdbx_RegGetValue(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue,
+static LSTATUS mdbx_RegGetValue(HKEY hkey, LPCSTR lpSubKey, LPCSTR lpValue,
DWORD dwFlags, LPDWORD pdwType, PVOID pvData,
LPDWORD pcbData) {
- if (fnRegGetValueW == nullptr) {
- fnRegGetValueW = (pfnRegGetValueW)GetProcAddress(GetModuleHandleA("advapi32.dll"), "RegGetValueW");
- if (fnRegGetValueW == nullptr)
- fnRegGetValueW = stubRegGetValueW;
+ if (fnRegGetValueA == nullptr) {
+ fnRegGetValueA = (pfnRegGetValueA)GetProcAddress(GetModuleHandleA("advapi32.dll"), "RegGetValueA");
+ if (fnRegGetValueA == nullptr)
+ fnRegGetValueA = stubRegGetValueA;
}
- LSTATUS rc = fnRegGetValueW(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);
+ LSTATUS rc =
+ fnRegGetValueA(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);
if (rc != ERROR_FILE_NOT_FOUND)
return rc;
- rc = fnRegGetValueW(hkey, lpSubKey, lpValue,
+ rc = fnRegGetValueA(hkey, lpSubKey, lpValue,
dwFlags | 0x00010000 /* RRF_SUBKEY_WOW6464KEY */, pdwType,
pvData, pcbData);
if (rc != ERROR_FILE_NOT_FOUND)
return rc;
- return fnRegGetValueW(hkey, lpSubKey, lpValue,
+ return fnRegGetValueA(hkey, lpSubKey, lpValue,
dwFlags | 0x00020000 /* RRF_SUBKEY_WOW6432KEY */, pdwType,
pvData, pcbData);
}
@@ -1962,30 +1951,30 @@ __cold MDBX_INTERNAL_FUNC bin128_t mdbx_osal_bootid(void) {
char DigitalProductId[248];
} buf;
- static const wchar_t HKLM_MicrosoftCryptography[] =
- L"SOFTWARE\\Microsoft\\Cryptography";
+ static const char HKLM_MicrosoftCryptography[] =
+ "SOFTWARE\\Microsoft\\Cryptography";
DWORD len = sizeof(buf);
/* Windows is madness and must die */
if (mdbx_RegGetValue(HKEY_LOCAL_MACHINE, HKLM_MicrosoftCryptography,
- L"MachineGuid", RRF_RT_ANY, NULL, &buf.MachineGuid,
+ "MachineGuid", RRF_RT_ANY, NULL, &buf.MachineGuid,
&len) == ERROR_SUCCESS &&
len > 42 && len < sizeof(buf))
got_machineid = bootid_parse_uuid(&bin, &buf.MachineGuid, len);
if (!got_machineid) {
/* again, Windows is madness */
- static const wchar_t HKLM_WindowsNT[] =
- L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
- static const wchar_t HKLM_WindowsNT_DPK[] =
- L"SOFTWARE\\Microsoft\\Windows "
- L"NT\\CurrentVersion\\DefaultProductKey";
- static const wchar_t HKLM_WindowsNT_DPK2[] =
- L"SOFTWARE\\Microsoft\\Windows "
- L"NT\\CurrentVersion\\DefaultProductKey2";
+ static const char HKLM_WindowsNT[] =
+ "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
+ static const char HKLM_WindowsNT_DPK[] =
+ "SOFTWARE\\Microsoft\\Windows "
+ "NT\\CurrentVersion\\DefaultProductKey";
+ static const char HKLM_WindowsNT_DPK2[] =
+ "SOFTWARE\\Microsoft\\Windows "
+ "NT\\CurrentVersion\\DefaultProductKey2";
len = sizeof(buf);
if (mdbx_RegGetValue(HKEY_LOCAL_MACHINE, HKLM_WindowsNT,
- L"DigitalProductId", RRF_RT_ANY, NULL,
+ "DigitalProductId", RRF_RT_ANY, NULL,
&buf.DigitalProductId, &len) == ERROR_SUCCESS &&
len > 42 && len < sizeof(buf)) {
bootid_collect(&bin, &buf.DigitalProductId, len);
@@ -1993,7 +1982,7 @@ __cold MDBX_INTERNAL_FUNC bin128_t mdbx_osal_bootid(void) {
}
len = sizeof(buf);
if (mdbx_RegGetValue(HKEY_LOCAL_MACHINE, HKLM_WindowsNT_DPK,
- L"DigitalProductId", RRF_RT_ANY, NULL,
+ "DigitalProductId", RRF_RT_ANY, NULL,
&buf.DigitalProductId, &len) == ERROR_SUCCESS &&
len > 42 && len < sizeof(buf)) {
bootid_collect(&bin, &buf.DigitalProductId, len);
@@ -2001,7 +1990,7 @@ __cold MDBX_INTERNAL_FUNC bin128_t mdbx_osal_bootid(void) {
}
len = sizeof(buf);
if (mdbx_RegGetValue(HKEY_LOCAL_MACHINE, HKLM_WindowsNT_DPK2,
- L"DigitalProductId", RRF_RT_ANY, NULL,
+ "DigitalProductId", RRF_RT_ANY, NULL,
&buf.DigitalProductId, &len) == ERROR_SUCCESS &&
len > 42 && len < sizeof(buf)) {
bootid_collect(&bin, &buf.DigitalProductId, len);
@@ -2009,11 +1998,11 @@ __cold MDBX_INTERNAL_FUNC bin128_t mdbx_osal_bootid(void) {
}
}
- static const wchar_t HKLM_PrefetcherParams[] =
- L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory "
- L"Management\\PrefetchParameters";
+ static const char HKLM_PrefetcherParams[] =
+ "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory "
+ "Management\\PrefetchParameters";
len = sizeof(buf);
- if (mdbx_RegGetValue(HKEY_LOCAL_MACHINE, HKLM_PrefetcherParams, L"BootId",
+ if (mdbx_RegGetValue(HKEY_LOCAL_MACHINE, HKLM_PrefetcherParams, "BootId",
RRF_RT_DWORD, NULL, &buf.BootId,
&len) == ERROR_SUCCESS &&
len > 1 && len < sizeof(buf)) {
@@ -2022,7 +2011,7 @@ __cold MDBX_INTERNAL_FUNC bin128_t mdbx_osal_bootid(void) {
}
len = sizeof(buf);
- if (mdbx_RegGetValue(HKEY_LOCAL_MACHINE, HKLM_PrefetcherParams, L"BaseTime",
+ if (mdbx_RegGetValue(HKEY_LOCAL_MACHINE, HKLM_PrefetcherParams, "BaseTime",
RRF_RT_DWORD, NULL, &buf.BaseTime,
&len) == ERROR_SUCCESS &&
len >= sizeof(buf.BaseTime) && buf.BaseTime) {
diff --git a/libs/libmdbx/src/src/elements/osal.h b/libs/libmdbx/src/src/elements/osal.h
index e7adec72a7..6e423e98dd 100644
--- a/libs/libmdbx/src/src/elements/osal.h
+++ b/libs/libmdbx/src/src/elements/osal.h
@@ -764,6 +764,7 @@ MDBX_INTERNAL_FUNC int mdbx_rpid_clear(MDBX_env *env);
MDBX_INTERNAL_FUNC int mdbx_rpid_check(MDBX_env *env, uint32_t pid);
#if defined(_WIN32) || defined(_WIN64)
+
typedef union MDBX_srwlock {
struct {
long volatile readerCount;
@@ -853,6 +854,16 @@ typedef DWORD(WINAPI *MDBX_OfferVirtualMemory(
MDBX_INTERNAL_VAR MDBX_OfferVirtualMemory mdbx_OfferVirtualMemory;
#endif /* unused for now */
+typedef enum _SECTION_INHERIT { ViewShare = 1, ViewUnmap = 2 } SECTION_INHERIT;
+
+typedef NTSTATUS(NTAPI *MDBX_NtExtendSection)(IN HANDLE SectionHandle,
+ IN PLARGE_INTEGER NewSectionSize);
+MDBX_INTERNAL_VAR MDBX_NtExtendSection mdbx_NtExtendSection;
+
+static __inline bool mdbx_RunningUnderWine(void) {
+ return !mdbx_NtExtendSection;
+}
+
#endif /* Windows */
/*----------------------------------------------------------------------------*/
diff --git a/libs/libmdbx/src/src/elements/version.c b/libs/libmdbx/src/src/elements/version.c
index 408fde08db..e025e48256 100644
--- a/libs/libmdbx/src/src/elements/version.c
+++ b/libs/libmdbx/src/src/elements/version.c
@@ -26,9 +26,9 @@ __dll_export
0,
6,
0,
- 1891,
- {"2020-01-21T18:43:16+03:00", "0ff4c585e913972e7f611a07c979716d3b89ffab", "32db811545ca84f9d554eb5d453d131357f03f81",
- "v0.6.0-1-g32db811"},
+ 1928,
+ {"2020-02-21T12:24:09+03:00", "f6d01d420c4be39a034e0f88e422330aa2db06f4", "9bdac2851b64d4e2636f0568066e53115acebe03",
+ "v0.6.0-38-g9bdac28"},
sourcery};
__dll_export
diff --git a/libs/libmdbx/src/src/man1/mdbx_chk.1 b/libs/libmdbx/src/src/man1/mdbx_chk.1
index 5ae24c9d09..4cd0a3a838 100644
--- a/libs/libmdbx/src/src/man1/mdbx_chk.1
+++ b/libs/libmdbx/src/src/man1/mdbx_chk.1
@@ -84,4 +84,4 @@ if no quiet mode was requested.
.BR mdbx_dump (1),
.BR mdbx_load (1)
.SH AUTHOR
-Leonid Yuriev <https://github.com/leo-yuriev>
+Leonid Yuriev <https://github.com/erthink>
diff --git a/libs/libmdbx/src/src/man1/mdbx_copy.1 b/libs/libmdbx/src/src/man1/mdbx_copy.1
index ca8f597a22..863a58add5 100644
--- a/libs/libmdbx/src/src/man1/mdbx_copy.1
+++ b/libs/libmdbx/src/src/man1/mdbx_copy.1
@@ -63,4 +63,4 @@ free during copying cannot be reused until the copy is done.
.BR mdbx_load (1)
.SH AUTHOR
Howard Chu of Symas Corporation <http://www.symas.com>,
-Leonid Yuriev <https://github.com/leo-yuriev>
+Leonid Yuriev <https://github.com/erthink>
diff --git a/libs/libmdbx/src/src/man1/mdbx_dump.1 b/libs/libmdbx/src/src/man1/mdbx_dump.1
index b95260026c..7cf708ab94 100644
--- a/libs/libmdbx/src/src/man1/mdbx_dump.1
+++ b/libs/libmdbx/src/src/man1/mdbx_dump.1
@@ -88,4 +88,4 @@ utility to load the database using the correct comparison functions.
.BR mdbx_stat (1)
.SH AUTHOR
Howard Chu of Symas Corporation <http://www.symas.com>,
-Leonid Yuriev <https://github.com/leo-yuriev>
+Leonid Yuriev <https://github.com/erthink>
diff --git a/libs/libmdbx/src/src/man1/mdbx_load.1 b/libs/libmdbx/src/src/man1/mdbx_load.1
index 5a13e0ec88..473f9303ef 100644
--- a/libs/libmdbx/src/src/man1/mdbx_load.1
+++ b/libs/libmdbx/src/src/man1/mdbx_load.1
@@ -99,4 +99,4 @@ a diagnostic message being written to standard error.
.BR mdbx_copy (1)
.SH AUTHOR
Howard Chu of Symas Corporation <http://www.symas.com>,
-Leonid Yuriev <https://github.com/leo-yuriev>
+Leonid Yuriev <https://github.com/erthink>
diff --git a/libs/libmdbx/src/src/man1/mdbx_stat.1 b/libs/libmdbx/src/src/man1/mdbx_stat.1
index b312d97a69..80969bb3f1 100644
--- a/libs/libmdbx/src/src/man1/mdbx_stat.1
+++ b/libs/libmdbx/src/src/man1/mdbx_stat.1
@@ -72,4 +72,4 @@ a diagnostic message being written to standard error.
.BR mdbx_load (1)
.SH AUTHOR
Howard Chu of Symas Corporation <http://www.symas.com>,
-Leonid Yuriev <https://github.com/leo-yuriev>
+Leonid Yuriev <https://github.com/erthink>