From f81374a9ce1f086f9cd3f1dc7b43b9052186d607 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sat, 31 Aug 2019 17:10:04 +0300 Subject: [PATCH] mdbx-build: amalgamation. Change-Id: Ic32de6ee119df2bc12136b882f4f7cabaa1314a9 --- Makefile => GNUmakefile | 29 +-- dll.vcxproj | 223 ----------------------- libmdbx.files | 22 ++- libmdbx.includes | 2 +- mdbx.sln | 97 ---------- src/alloy.c | 38 ++++ src/{mdbx.c => elements/core.c} | 20 +- src/{ => elements}/defs.h | 8 + src/{bits.h => elements/internals.h} | 48 +++-- src/{ => elements}/lck-linux.c | 25 ++- src/{ => elements}/lck-posix.c | 20 +- src/{ => elements}/lck-windows.c | 32 ++-- src/{ => elements}/ntdll.def | 0 src/{ => elements}/osal.c | 96 ++++++---- src/{ => elements}/osal.h | 151 ++++++++------- src/{version.c => elements/version.c.in} | 2 +- src/tools/mdbx_chk.c | 2 +- src/tools/mdbx_chk.vcxproj | 166 ----------------- src/tools/mdbx_copy.c | 2 +- src/tools/mdbx_copy.vcxproj | 166 ----------------- src/tools/mdbx_dump.c | 2 +- src/tools/mdbx_dump.vcxproj | 166 ----------------- src/tools/mdbx_load.c | 2 +- src/tools/mdbx_load.vcxproj | 166 ----------------- src/tools/mdbx_stat.c | 2 +- src/tools/mdbx_stat.vcxproj | 166 ----------------- test/base.h | 6 +- test/test.vcxproj | 209 --------------------- 28 files changed, 296 insertions(+), 1572 deletions(-) rename Makefile => GNUmakefile (92%) delete mode 100644 dll.vcxproj delete mode 100644 mdbx.sln create mode 100644 src/alloy.c rename src/{mdbx.c => elements/core.c} (99%) rename src/{ => elements}/defs.h (98%) rename src/{bits.h => elements/internals.h} (97%) rename src/{ => elements}/lck-linux.c (95%) rename src/{ => elements}/lck-posix.c (95%) rename src/{ => elements}/lck-windows.c (96%) rename src/{ => elements}/ntdll.def (100%) rename src/{ => elements}/osal.c (91%) rename src/{ => elements}/osal.h (86%) rename src/{version.c => elements/version.c.in} (97%) delete mode 100644 src/tools/mdbx_chk.vcxproj delete mode 100644 src/tools/mdbx_copy.vcxproj delete mode 100644 src/tools/mdbx_dump.vcxproj delete mode 100644 src/tools/mdbx_load.vcxproj delete mode 100644 src/tools/mdbx_stat.vcxproj delete mode 100644 test/test.vcxproj diff --git a/Makefile b/GNUmakefile similarity index 92% rename from Makefile rename to GNUmakefile index 2d261bc7..aa640cbf 100644 --- a/Makefile +++ b/GNUmakefile @@ -47,18 +47,10 @@ NN ?= 25000000 ifdef MSVC UNAME := Windows - LCK_IMPL := windows TEST_OSAL := windows TEST_ITER := 42 else UNAME := $(shell uname -s 2>/dev/null || echo Unknown) - define uname2lck - case "$(UNAME)" in - Linux) echo linux;; - CYGWIN*|MINGW*|MSYS*|Windows*) echo windows;; - *) echo posix;; - esac - endef define uname2osal case "$(UNAME)" in CYGWIN*|MINGW*|MSYS*|Windows*) echo windows;; @@ -78,7 +70,6 @@ else *) echo so;; esac endef - LCK_IMPL := $(shell $(uname2lck)) TEST_OSAL := $(shell $(uname2osal)) TEST_ITER := $(shell $(uname2titer)) SO_SUFFIX := $(shell $(uname2suffix)) @@ -90,9 +81,7 @@ TOOLS := mdbx_stat mdbx_copy mdbx_dump mdbx_load mdbx_chk MANPAGES := mdbx_stat.1 mdbx_copy.1 mdbx_dump.1 mdbx_load.1 SHELL := /bin/bash -CORE_SRC := src/lck-$(LCK_IMPL).c $(filter-out $(wildcard src/lck-*.c), $(wildcard src/*.c)) -CORE_INC := $(wildcard src/*.h) -CORE_OBJ := $(patsubst %.c,%.o,$(CORE_SRC)) +ALLOY_DEPS := $(wildcard src/elements/*) TEST_SRC := test/osal-$(TEST_OSAL).cc $(filter-out $(wildcard test/osal-*.cc), $(wildcard test/*.cc)) TEST_INC := $(wildcard test/*.h) TEST_OBJ := $(patsubst %.cc,%.o,$(TEST_SRC)) @@ -136,25 +125,21 @@ check-fault: all rm -f $(TESTDB) $(TESTLOG) && (set -o pipefail; ./mdbx_test --pathname=$(TESTDB) --inject-writefault=42 --dump-config --dont-cleanup-after basic | tee -a $(TESTLOG) | tail -n 42) \ ; ./mdbx_chk -vvnw $(TESTDB) && ([ ! -e $(TESTDB)-copy ] || ./mdbx_chk -vvn $(TESTDB)-copy) -define core-rule -$(patsubst %.c,%.o,$(1)): $(1) $(CORE_INC) mdbx.h Makefile - $(CC) $(CFLAGS) -c $(1) -o $$@ - -endef -$(foreach file,$(CORE_SRC),$(eval $(call core-rule,$(file)))) +libmdbx.o: src/alloy.c $(ALLOY_DEPS) $(lastword $(MAKEFILE_LIST)) + $(CC) $(CFLAGS) -c src/alloy.c -o $@ define test-rule -$(patsubst %.cc,%.o,$(1)): $(1) $(TEST_INC) mdbx.h Makefile +$(patsubst %.cc,%.o,$(1)): $(1) $(TEST_INC) mdbx.h $(lastword $(MAKEFILE_LIST)) $(CXX) $(CXXFLAGS) -c $(1) -o $$@ endef $(foreach file,$(TEST_SRC),$(eval $(call test-rule,$(file)))) -libmdbx.a: $(CORE_OBJ) +libmdbx.a: libmdbx.o $(AR) rs $@ $? -libmdbx.$(SO_SUFFIX): $(CORE_OBJ) - $(CC) $(CFLAGS) -save-temps $^ -pthread -shared $(LDFLAGS) -o $@ +libmdbx.$(SO_SUFFIX): libmdbx.o + $(CC) $(CFLAGS) $^ -pthread -shared $(LDFLAGS) -o $@ mdbx_%: src/tools/mdbx_%.c libmdbx.a $(CC) $(CFLAGS) $^ $(EXE_LDFLAGS) -o $@ diff --git a/dll.vcxproj b/dll.vcxproj deleted file mode 100644 index 5464c158..00000000 --- a/dll.vcxproj +++ /dev/null @@ -1,223 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {6D19209B-ECE7-4B9C-941C-0AA2B484F199} - Win32Proj - 8.1 - - - - DynamicLibrary - true - v140 - MultiByte - - - DynamicLibrary - false - v140 - true - MultiByte - - - DynamicLibrary - true - v140 - MultiByte - - - DynamicLibrary - false - v140 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - true - mdbx - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - PreLinkEvent - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - mdbx - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - PreLinkEvent - - - true - mdbx - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - PreLinkEvent - - - false - mdbx - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - PreLinkEvent - - - - WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;MDBX_AVOID_CRT;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - EnableAllWarnings - ProgramDatabase - Disabled - true - true - - - MachineX86 - true - Windows - ntdll.lib;$(IntermediateOutputPath)mdbx_ntdll_extra.lib;kernel32.lib;advapi32.lib;%(AdditionalDependencies) - - - Generate fake-library mdbx_ntdll_extra.lib for $(PlatformTarget) - $(IntermediateOutputPath)mdbx_ntdll_extra.lib - $(ProjectDir)src/ntdll.def - lib.exe /def:%(Inputs) /out:%(Outputs) /machine:$(PlatformTarget) - - - - - WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;MDBX_AVOID_CRT;%(PreprocessorDefinitions) - MultiThreadedDLL - EnableAllWarnings - ProgramDatabase - true - Full - AnySuitable - true - Size - true - true - true - false - All - - - MachineX86 - true - Windows - true - true - UseLinkTimeCodeGeneration - ntdll.lib;$(IntermediateOutputPath)mdbx_ntdll_extra.lib;kernel32.lib;advapi32.lib;%(AdditionalDependencies) - true - - - Generate fake-library mdbx_ntdll_extra.lib for $(PlatformTarget) - $(IntermediateOutputPath)mdbx_ntdll_extra.lib - $(ProjectDir)src/ntdll.def - lib.exe /def:%(Inputs) /out:%(Outputs) /machine:$(PlatformTarget) - - - - - ProgramDatabase - - - - - EnableAllWarnings - WIN64;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;MDBX_AVOID_CRT;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - true - true - - - ntdll.lib;$(IntermediateOutputPath)mdbx_ntdll_extra.lib;kernel32.lib;advapi32.lib;%(AdditionalDependencies) - - - Generate fake-library mdbx_ntdll_extra.lib for $(PlatformTarget) - $(IntermediateOutputPath)mdbx_ntdll_extra.lib - $(ProjectDir)src/ntdll.def - lib.exe /def:%(Inputs) /out:%(Outputs) /machine:$(PlatformTarget) - - - - - WIN64;NDEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;MDBX_BUILD_DLL;MDBX_AVOID_CRT;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Full - AnySuitable - true - Size - true - true - EnableAllWarnings - true - false - All - - - UseLinkTimeCodeGeneration - ntdll.lib;$(IntermediateOutputPath)mdbx_ntdll_extra.lib;kernel32.lib;advapi32.lib;%(AdditionalDependencies) - true - - - Generate fake-library mdbx_ntdll_extra.lib for $(PlatformTarget) - $(IntermediateOutputPath)mdbx_ntdll_extra.lib - $(ProjectDir)src/ntdll.def - lib.exe /def:%(Inputs) /out:%(Outputs) /machine:$(PlatformTarget) - - - - - - - - - - - - - - - - - - diff --git a/libmdbx.files b/libmdbx.files index cdea405b..1f004f76 100644 --- a/libmdbx.files +++ b/libmdbx.files @@ -1,19 +1,21 @@ AUTHORS CMakeLists.txt LICENSE -Makefile +GNUmakefile README-RU.md README.md TODO.md mdbx.h -src/bits.h -src/defs.h -src/lck-linux.c -src/lck-posix.c -src/lck-windows.c -src/mdbx.c -src/osal.c -src/osal.h +src/alloy.c +src/elements/data.c +src/elements/internals.h +src/elements/defs.h +src/elements/lck-linux.c +src/elements/lck-posix.c +src/elements/lck-windows.c +src/elements/core.c +src/elements/osal.c +src/elements/osal.h src/tools/CMakeLists.txt src/tools/mdbx_chk.c src/tools/mdbx_copy.1 @@ -26,7 +28,7 @@ src/tools/mdbx_stat.1 src/tools/mdbx_stat.c src/tools/wingetopt.c src/tools/wingetopt.h -src/version.c +src/elements/version.c.in test/CMakeLists.txt test/actor.cc test/append.cc diff --git a/libmdbx.includes b/libmdbx.includes index eb512a01..d6bbcc94 100644 --- a/libmdbx.includes +++ b/libmdbx.includes @@ -1,4 +1,4 @@ . -src +src/elements src/tools test diff --git a/mdbx.sln b/mdbx.sln deleted file mode 100644 index f1462ab8..00000000 --- a/mdbx.sln +++ /dev/null @@ -1,97 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dll", "dll.vcxproj", "{6D19209B-ECE7-4B9C-941C-0AA2B484F199}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{0A147F9F-22D5-44E6-B389-218CFFB0C524}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mdbx_load", "src\tools\mdbx_load.vcxproj", "{15030120-5F7F-48F9-ABE5-DFC814F2A4BB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mdbx_dump", "src\tools\mdbx_dump.vcxproj", "{15030120-5F7F-48F9-ABE5-DFC814F2A4BC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mdbx_copy", "src\tools\mdbx_copy.vcxproj", "{15030120-5F7F-48F9-ABE5-DFC814F2A4BD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mdbx_chk", "src\tools\mdbx_chk.vcxproj", "{15030120-5F7F-48F9-ABE5-DFC814F2A4BE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mdbx_stat", "src\tools\mdbx_stat.vcxproj", "{15030120-5F7F-48F9-ABE5-DFC814F2A4BF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}.Debug|x64.ActiveCfg = Debug|x64 - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}.Debug|x64.Build.0 = Debug|x64 - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}.Debug|x86.ActiveCfg = Debug|Win32 - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}.Debug|x86.Build.0 = Debug|Win32 - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}.Release|x64.ActiveCfg = Release|x64 - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}.Release|x64.Build.0 = Release|x64 - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}.Release|x86.ActiveCfg = Release|Win32 - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31}.Release|x86.Build.0 = Release|Win32 - {6D19209B-ECE7-4B9C-941C-0AA2B484F199}.Debug|x64.ActiveCfg = Debug|x64 - {6D19209B-ECE7-4B9C-941C-0AA2B484F199}.Debug|x64.Build.0 = Debug|x64 - {6D19209B-ECE7-4B9C-941C-0AA2B484F199}.Debug|x86.ActiveCfg = Debug|Win32 - {6D19209B-ECE7-4B9C-941C-0AA2B484F199}.Debug|x86.Build.0 = Debug|Win32 - {6D19209B-ECE7-4B9C-941C-0AA2B484F199}.Release|x64.ActiveCfg = Release|x64 - {6D19209B-ECE7-4B9C-941C-0AA2B484F199}.Release|x64.Build.0 = Release|x64 - {6D19209B-ECE7-4B9C-941C-0AA2B484F199}.Release|x86.ActiveCfg = Release|Win32 - {6D19209B-ECE7-4B9C-941C-0AA2B484F199}.Release|x86.Build.0 = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB}.Debug|x64.ActiveCfg = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB}.Debug|x64.Build.0 = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB}.Debug|x86.ActiveCfg = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB}.Debug|x86.Build.0 = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB}.Release|x64.ActiveCfg = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB}.Release|x64.Build.0 = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB}.Release|x86.ActiveCfg = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB}.Release|x86.Build.0 = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC}.Debug|x64.ActiveCfg = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC}.Debug|x64.Build.0 = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC}.Debug|x86.ActiveCfg = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC}.Debug|x86.Build.0 = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC}.Release|x64.ActiveCfg = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC}.Release|x64.Build.0 = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC}.Release|x86.ActiveCfg = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC}.Release|x86.Build.0 = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD}.Debug|x64.ActiveCfg = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD}.Debug|x64.Build.0 = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD}.Debug|x86.ActiveCfg = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD}.Debug|x86.Build.0 = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD}.Release|x64.ActiveCfg = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD}.Release|x64.Build.0 = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD}.Release|x86.ActiveCfg = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD}.Release|x86.Build.0 = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE}.Debug|x64.ActiveCfg = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE}.Debug|x64.Build.0 = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE}.Debug|x86.ActiveCfg = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE}.Debug|x86.Build.0 = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE}.Release|x64.ActiveCfg = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE}.Release|x64.Build.0 = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE}.Release|x86.ActiveCfg = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE}.Release|x86.Build.0 = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF}.Debug|x64.ActiveCfg = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF}.Debug|x64.Build.0 = Debug|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF}.Debug|x86.ActiveCfg = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF}.Debug|x86.Build.0 = Debug|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF}.Release|x64.ActiveCfg = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF}.Release|x64.Build.0 = Release|x64 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF}.Release|x86.ActiveCfg = Release|Win32 - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB} = {0A147F9F-22D5-44E6-B389-218CFFB0C524} - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC} = {0A147F9F-22D5-44E6-B389-218CFFB0C524} - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD} = {0A147F9F-22D5-44E6-B389-218CFFB0C524} - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE} = {0A147F9F-22D5-44E6-B389-218CFFB0C524} - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF} = {0A147F9F-22D5-44E6-B389-218CFFB0C524} - EndGlobalSection -EndGlobal diff --git a/src/alloy.c b/src/alloy.c new file mode 100644 index 00000000..a4bfc36c --- /dev/null +++ b/src/alloy.c @@ -0,0 +1,38 @@ +/* + * Copyright 2015-2019 Leonid Yuriev + * and other libmdbx authors: please see AUTHORS file. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . */ + +#define MDBX_ALLOY 1 /* Amalgamated build */ + +/* Turn off formatters to avoid reordering the #includes */ +/* *INDENT-OFF* */ +/* clang-format off */ + +#include "elements/internals.h" /* must be included fisrt */ +#include "../mdbx.h" +#include "elements/defs.h" +#include "elements/osal.h" + +#if defined(__linux__) || defined(__gnu_linux__) +#include "elements/lck-linux.c" +#elif defined(_WIN32) || defined(_WIN64) +#include "elements/lck-windows.c" +#else +#include "elements/lck-posix.c" +#endif + +#include "elements/osal.c" +#include "elements/core.c" +#include "elements/version.c.in" + +/* *INDENT-ON* */ +/* clang-format on */ diff --git a/src/mdbx.c b/src/elements/core.c similarity index 99% rename from src/mdbx.c rename to src/elements/core.c index 098a9d12..bbffedf7 100644 --- a/src/mdbx.c +++ b/src/elements/core.c @@ -35,7 +35,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "./bits.h" +#include "./internals.h" /*----------------------------------------------------------------------------*/ /* Internal inlines */ @@ -1288,22 +1288,10 @@ static int __must_check_result mdbx_dpl_append(MDBX_DPL dl, pgno_t pgno, /*----------------------------------------------------------------------------*/ -int mdbx_runtime_flags = MDBX_DBG_PRINT -#if MDBX_DEBUG - | MDBX_DBG_ASSERT -#endif -#if MDBX_DEBUG > 1 - | MDBX_DBG_TRACE -#endif -#if MDBX_DEBUG > 2 - | MDBX_DBG_AUDIT -#endif -#if MDBX_DEBUG > 3 - | MDBX_DBG_EXTRA -#endif - ; - +#ifndef MDBX_ALLOY +int mdbx_runtime_flags = MDBX_RUNTIME_FLAGS_INIT; MDBX_debug_func *mdbx_debug_logger; +#endif /* MDBX_ALLOY */ static int mdbx_page_alloc(MDBX_cursor *mc, unsigned num, MDBX_page **mp, int flags); diff --git a/src/defs.h b/src/elements/defs.h similarity index 98% rename from src/defs.h rename to src/elements/defs.h index 622f1c13..ba2a1484 100644 --- a/src/defs.h +++ b/src/elements/defs.h @@ -133,6 +133,14 @@ # endif #endif /* __must_check_result */ +#ifndef __maybe_unused +# if defined(__GNUC__) || __has_attribute(__unused__) +# define __maybe_unused __attribute__((__unused__)) +# else +# define __maybe_unused +# endif +#endif /* __maybe_unused */ + #ifndef __deprecated # if defined(__GNUC__) || __has_attribute(__deprecated__) # define __deprecated __attribute__((__deprecated__)) diff --git a/src/bits.h b/src/elements/internals.h similarity index 97% rename from src/bits.h rename to src/elements/internals.h index eee9adfa..c7d50ef7 100644 --- a/src/bits.h +++ b/src/elements/internals.h @@ -35,6 +35,16 @@ #define MDBX_OSX_SPEED_INSTEADOF_DURABILITY MDBX_OSX_WANNA_DURABILITY #endif +#ifdef MDBX_ALLOY +/* Amalgamated build */ +#define MDBX_INTERNAL_FUNC static +#define MDBX_INTERNAL_VAR static +#else +/* Non-amalgamated build */ +#define MDBX_INTERNAL_FUNC +#define MDBX_INTERNAL_VAR extern +#endif /* MDBX_ALLOY */ + /*----------------------------------------------------------------------------*/ /* Should be defined before any includes */ @@ -72,7 +82,7 @@ #pragma warning(disable : 4366) /* the result of the unary '&' operator may be unaligned */ #endif /* _MSC_VER (warnings) */ -#include "../mdbx.h" +#include "../../mdbx.h" #include "./defs.h" #if defined(__GNUC__) && !__GNUC_PREREQ(4,2) @@ -876,16 +886,21 @@ typedef struct MDBX_ntxn { /*----------------------------------------------------------------------------*/ /* Debug and Logging stuff */ +#define MDBX_RUNTIME_FLAGS_INIT \ + (MDBX_DBG_PRINT | ((MDBX_DEBUG) > 0) * MDBX_DBG_ASSERT | \ + ((MDBX_DEBUG) > 1) * MDBX_DBG_AUDIT | ((MDBX_DEBUG) > 2) * MDBX_DBG_TRACE | \ + ((MDBX_DEBUG) > 3) * MDBX_DBG_EXTRA) + #ifndef mdbx_runtime_flags /* avoid override from tools */ -extern int mdbx_runtime_flags; +MDBX_INTERNAL_VAR int mdbx_runtime_flags; #endif -extern MDBX_debug_func *mdbx_debug_logger; -extern txnid_t mdbx_debug_edge; +MDBX_INTERNAL_VAR MDBX_debug_func *mdbx_debug_logger; -void mdbx_debug_log(int type, const char *function, int line, const char *fmt, - ...) __printf_args(4, 5); +MDBX_INTERNAL_FUNC void mdbx_debug_log(int type, const char *function, int line, + const char *fmt, ...) + __printf_args(4, 5); -void mdbx_panic(const char *fmt, ...) __printf_args(1, 2); +MDBX_INTERNAL_FUNC void mdbx_panic(const char *fmt, ...) __printf_args(1, 2); #if MDBX_DEBUG @@ -906,8 +921,8 @@ void mdbx_panic(const char *fmt, ...) __printf_args(1, 2); #endif /* NDEBUG */ #endif /* MDBX_DEBUG */ -LIBMDBX_API void mdbx_assert_fail(const MDBX_env *env, const char *msg, - const char *func, int line); +MDBX_INTERNAL_FUNC void mdbx_assert_fail(const MDBX_env *env, const char *msg, + const char *func, int line); #define mdbx_print(fmt, ...) \ mdbx_debug_log(MDBX_DBG_PRINT, NULL, 0, fmt, ##__VA_ARGS__) @@ -1014,14 +1029,15 @@ LIBMDBX_API void mdbx_assert_fail(const MDBX_env *env, const char *msg, /*----------------------------------------------------------------------------*/ /* Internal prototypes */ -int mdbx_reader_check0(MDBX_env *env, int rlocked, int *dead); -int mdbx_rthc_alloc(mdbx_thread_key_t *key, MDBX_reader *begin, - MDBX_reader *end); -void mdbx_rthc_remove(const mdbx_thread_key_t key); +MDBX_INTERNAL_FUNC int mdbx_reader_check0(MDBX_env *env, int rlocked, + int *dead); +MDBX_INTERNAL_FUNC int mdbx_rthc_alloc(mdbx_thread_key_t *key, + MDBX_reader *begin, MDBX_reader *end); +MDBX_INTERNAL_FUNC void mdbx_rthc_remove(const mdbx_thread_key_t key); -void mdbx_rthc_global_init(void); -void mdbx_rthc_global_dtor(void); -void mdbx_rthc_thread_dtor(void *ptr); +MDBX_INTERNAL_FUNC void mdbx_rthc_global_init(void); +MDBX_INTERNAL_FUNC void mdbx_rthc_global_dtor(void); +MDBX_INTERNAL_FUNC void mdbx_rthc_thread_dtor(void *ptr); #define MDBX_IS_ERROR(rc) \ ((rc) != MDBX_RESULT_TRUE && (rc) != MDBX_RESULT_FALSE) diff --git a/src/lck-linux.c b/src/elements/lck-linux.c similarity index 95% rename from src/lck-linux.c rename to src/elements/lck-linux.c index 3178b09c..04d2a62a 100644 --- a/src/lck-linux.c +++ b/src/elements/lck-linux.c @@ -18,7 +18,7 @@ by flock() and fcntl()." #endif -#include "./bits.h" +#include "./internals.h" #include /* Some platforms define the EOWNERDEAD error code @@ -40,7 +40,10 @@ /*----------------------------------------------------------------------------*/ /* global constructor/destructor */ +#ifndef MDBX_ALLOY uint32_t mdbx_linux_kernel_version; +#endif /* MDBX_ALLOY */ + static __cold __attribute__((__constructor__)) void mdbx_global_constructor(void) { struct utsname buffer; @@ -183,24 +186,24 @@ static __inline int mdbx_lck_shared(int lfd) { return mdbx_lck_op(lfd, op_setlkw, F_RDLCK, 0, 1); } -int mdbx_lck_downgrade(MDBX_env *env, bool complete) { +MDBX_INTERNAL_FUNC int mdbx_lck_downgrade(MDBX_env *env, bool complete) { assert(env->me_lfd != INVALID_HANDLE_VALUE); return complete ? mdbx_lck_shared(env->me_lfd) : MDBX_SUCCESS; } -int mdbx_rpid_set(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rpid_set(MDBX_env *env) { assert(env->me_lfd != INVALID_HANDLE_VALUE); assert(env->me_pid > 0); return mdbx_lck_op(env->me_lfd, op_setlk, F_WRLCK, env->me_pid, 1); } -int mdbx_rpid_clear(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rpid_clear(MDBX_env *env) { assert(env->me_lfd != INVALID_HANDLE_VALUE); assert(env->me_pid > 0); return mdbx_lck_op(env->me_lfd, op_setlkw, F_UNLCK, env->me_pid, 1); } -int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid) { +MDBX_INTERNAL_FUNC int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid) { assert(env->me_lfd != INVALID_HANDLE_VALUE); assert(pid > 0); return mdbx_lck_op(env->me_lfd, op_getlk, F_WRLCK, pid, 1); @@ -211,7 +214,8 @@ int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid) { static int mdbx_mutex_failed(MDBX_env *env, pthread_mutex_t *mutex, const int rc); -int __cold mdbx_lck_init(MDBX_env *env, int global_uniqueness_flag) { +MDBX_INTERNAL_FUNC int __cold mdbx_lck_init(MDBX_env *env, + int global_uniqueness_flag) { if (global_uniqueness_flag == MDBX_RESULT_FALSE) return MDBX_SUCCESS; @@ -257,7 +261,8 @@ bailout: return rc; } -int __cold mdbx_lck_destroy(MDBX_env *env, MDBX_env *inprocess_neighbor) { +MDBX_INTERNAL_FUNC int __cold mdbx_lck_destroy(MDBX_env *env, + MDBX_env *inprocess_neighbor) { if (env->me_lfd != INVALID_HANDLE_VALUE && !inprocess_neighbor && env->me_lck && /* try get exclusive access */ mdbx_lck_exclusive(env->me_lfd, false) == @@ -347,14 +352,14 @@ static int mdbx_robust_unlock(MDBX_env *env, pthread_mutex_t *mutex) { return rc; } -int mdbx_rdt_lock(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rdt_lock(MDBX_env *env) { mdbx_trace(">>"); int rc = mdbx_robust_lock(env, &env->me_lck->mti_rmutex); mdbx_trace("<< rc %d", rc); return rc; } -void mdbx_rdt_unlock(MDBX_env *env) { +MDBX_INTERNAL_FUNC void mdbx_rdt_unlock(MDBX_env *env) { mdbx_trace(">>"); int rc = mdbx_robust_unlock(env, &env->me_lck->mti_rmutex); mdbx_trace("<< rc %d", rc); @@ -404,7 +409,7 @@ static int __cold internal_seize_lck(int lfd) { return rc; } -int __cold mdbx_lck_seize(MDBX_env *env) { +MDBX_INTERNAL_FUNC int __cold mdbx_lck_seize(MDBX_env *env) { assert(env->me_fd != INVALID_HANDLE_VALUE); if (unlikely(op_setlk == 0)) choice_fcntl(); diff --git a/src/lck-posix.c b/src/elements/lck-posix.c similarity index 95% rename from src/lck-posix.c rename to src/elements/lck-posix.c index 14284575..a821aac5 100644 --- a/src/lck-posix.c +++ b/src/elements/lck-posix.c @@ -12,7 +12,7 @@ * . */ -#include "./bits.h" +#include "./internals.h" /* Some platforms define the EOWNERDEAD error code * even though they don't support Robust Mutexes. @@ -112,26 +112,26 @@ static int mdbx_lck_op(mdbx_filehandle_t fd, int cmd, short lck, off_t offset, } } -int mdbx_rpid_set(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rpid_set(MDBX_env *env) { assert(env->me_lfd != INVALID_HANDLE_VALUE); assert(env->me_pid > 0 && env->me_pid <= PID_T_MAX); return mdbx_lck_op(env->me_lfd, OP_SETLK, F_WRLCK, env->me_pid, 1); } -int mdbx_rpid_clear(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rpid_clear(MDBX_env *env) { assert(env->me_lfd != INVALID_HANDLE_VALUE); assert(env->me_pid > 0 && env->me_pid <= PID_T_MAX); return mdbx_lck_op(env->me_lfd, OP_SETLKW, F_UNLCK, env->me_pid, 1); } -int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid) { +MDBX_INTERNAL_FUNC int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid) { assert(env->me_lfd != INVALID_HANDLE_VALUE); assert(pid > 0 && pid <= PID_T_MAX); assert(PID_T_MAX < OFF_T_MAX); return mdbx_lck_op(env->me_lfd, OP_GETLK, F_WRLCK, pid, 1); } -int __cold mdbx_lck_seize(MDBX_env *env) { +MDBX_INTERNAL_FUNC int __cold mdbx_lck_seize(MDBX_env *env) { assert(env->me_fd != INVALID_HANDLE_VALUE); assert(env->me_pid > 0 && env->me_pid <= PID_T_MAX); @@ -229,7 +229,8 @@ bailout: static int mdbx_mutex_failed(MDBX_env *env, pthread_mutex_t *mutex, const int rc); -int __cold mdbx_lck_init(MDBX_env *env, int global_uniqueness_flag) { +MDBX_INTERNAL_FUNC int __cold mdbx_lck_init(MDBX_env *env, + int global_uniqueness_flag) { if (global_uniqueness_flag == MDBX_RESULT_FALSE) return MDBX_SUCCESS; @@ -270,7 +271,8 @@ bailout: return rc; } -int __cold mdbx_lck_destroy(MDBX_env *env, MDBX_env *inprocess_neighbor) { +MDBX_INTERNAL_FUNC int __cold mdbx_lck_destroy(MDBX_env *env, + MDBX_env *inprocess_neighbor) { /* File locks would be released (by kernel) while the file-descriptors * will be closed. But to avoid false-positive EDEADLK from the kernel, * locks should be released here explicitly with properly order. */ @@ -358,14 +360,14 @@ static int mdbx_robust_unlock(MDBX_env *env, pthread_mutex_t *mutex) { return rc; } -int mdbx_rdt_lock(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rdt_lock(MDBX_env *env) { mdbx_trace(">>"); int rc = mdbx_robust_lock(env, &env->me_lck->mti_rmutex); mdbx_trace("<< rc %d", rc); return rc; } -void mdbx_rdt_unlock(MDBX_env *env) { +MDBX_INTERNAL_FUNC void mdbx_rdt_unlock(MDBX_env *env) { mdbx_trace(">>"); int rc = mdbx_robust_unlock(env, &env->me_lck->mti_rmutex); mdbx_trace("<< rc %d", rc); diff --git a/src/lck-windows.c b/src/elements/lck-windows.c similarity index 96% rename from src/lck-windows.c rename to src/elements/lck-windows.c index 69e31e81..412bdb7e 100644 --- a/src/lck-windows.c +++ b/src/elements/lck-windows.c @@ -12,7 +12,7 @@ * . */ -#include "./bits.h" +#include "./internals.h" /* PREAMBLE FOR WINDOWS: * @@ -183,7 +183,7 @@ void mdbx_txn_unlock(MDBX_env *env) { #define LCK_LOWER LCK_LO_OFFSET, LCK_LO_LEN #define LCK_UPPER LCK_UP_OFFSET, LCK_UP_LEN -int mdbx_rdt_lock(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rdt_lock(MDBX_env *env) { mdbx_srwlock_AcquireShared(&env->me_remap_guard); if (env->me_lfd == INVALID_HANDLE_VALUE) return MDBX_SUCCESS; /* readonly database in readonly filesystem */ @@ -198,7 +198,7 @@ int mdbx_rdt_lock(MDBX_env *env) { return rc; } -void mdbx_rdt_unlock(MDBX_env *env) { +MDBX_INTERNAL_FUNC void mdbx_rdt_unlock(MDBX_env *env) { if (env->me_lfd != INVALID_HANDLE_VALUE) { /* transite from S-E (locked) to S-? (used), e.g. unlock upper-part */ if ((env->me_flags & MDBX_EXCLUSIVE) == 0 && @@ -245,8 +245,8 @@ static int suspend_and_append(mdbx_handle_array_t **array, return MDBX_SUCCESS; } -int mdbx_suspend_threads_before_remap(MDBX_env *env, - mdbx_handle_array_t **array) { +MDBX_INTERNAL_FUNC int +mdbx_suspend_threads_before_remap(MDBX_env *env, mdbx_handle_array_t **array) { const mdbx_pid_t CurrentTid = GetCurrentThreadId(); int rc; if (env->me_lck) { @@ -320,7 +320,8 @@ int mdbx_suspend_threads_before_remap(MDBX_env *env, return MDBX_SUCCESS; } -int mdbx_resume_threads_after_remap(mdbx_handle_array_t *array) { +MDBX_INTERNAL_FUNC int +mdbx_resume_threads_after_remap(mdbx_handle_array_t *array) { int rc = MDBX_SUCCESS; for (unsigned i = 0; i < array->count; ++i) { const HANDLE hThread = array->handles[i]; @@ -398,13 +399,15 @@ static void lck_unlock(MDBX_env *env) { } } -int mdbx_lck_init(MDBX_env *env, int global_uniqueness_flag) { +MDBX_INTERNAL_FUNC int mdbx_lck_init(MDBX_env *env, + int global_uniqueness_flag) { (void)env; (void)global_uniqueness_flag; return MDBX_SUCCESS; } -int mdbx_lck_destroy(MDBX_env *env, MDBX_env *inprocess_neighbor) { +MDBX_INTERNAL_FUNC int mdbx_lck_destroy(MDBX_env *env, + MDBX_env *inprocess_neighbor) { (void)inprocess_neighbor; lck_unlock(env); return MDBX_SUCCESS; @@ -462,7 +465,7 @@ static int internal_seize_lck(HANDLE lfd) { return rc; } -int mdbx_lck_seize(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_lck_seize(MDBX_env *env) { int rc; assert(env->me_fd != INVALID_HANDLE_VALUE); @@ -508,7 +511,7 @@ int mdbx_lck_seize(MDBX_env *env) { return rc; } -int mdbx_lck_downgrade(MDBX_env *env, bool complete) { +MDBX_INTERNAL_FUNC int mdbx_lck_downgrade(MDBX_env *env, bool complete) { /* Transite from exclusive state (E-?) to used (S-?) */ assert(env->me_fd != INVALID_HANDLE_VALUE); assert(env->me_lfd != INVALID_HANDLE_VALUE); @@ -550,12 +553,12 @@ int mdbx_lck_downgrade(MDBX_env *env, bool complete) { /*----------------------------------------------------------------------------*/ /* reader checking (by pid) */ -int mdbx_rpid_set(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rpid_set(MDBX_env *env) { (void)env; return MDBX_SUCCESS; } -int mdbx_rpid_clear(MDBX_env *env) { +MDBX_INTERNAL_FUNC int mdbx_rpid_clear(MDBX_env *env) { (void)env; return MDBX_SUCCESS; } @@ -566,7 +569,7 @@ int mdbx_rpid_clear(MDBX_env *env) { * MDBX_RESULT_TRUE, if pid is live (unable to acquire lock) * MDBX_RESULT_FALSE, if pid is dead (lock acquired) * or otherwise the errcode. */ -int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid) { +MDBX_INTERNAL_FUNC int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid) { (void)env; HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid); int rc; @@ -678,7 +681,7 @@ static DWORD WINAPI stub_DiscardVirtualMemory(PVOID VirtualAddress, } /*----------------------------------------------------------------------------*/ - +#ifndef MDBX_ALLOY MDBX_GetFileInformationByHandleEx mdbx_GetFileInformationByHandleEx; MDBX_GetVolumeInformationByHandleW mdbx_GetVolumeInformationByHandleW; MDBX_GetFinalPathNameByHandleW mdbx_GetFinalPathNameByHandleW; @@ -686,6 +689,7 @@ MDBX_SetFileInformationByHandle mdbx_SetFileInformationByHandle; MDBX_PrefetchVirtualMemory mdbx_PrefetchVirtualMemory; MDBX_DiscardVirtualMemory mdbx_DiscardVirtualMemory; MDBX_NtFsControlFile mdbx_NtFsControlFile; +#endif /* MDBX_ALLOY */ static void mdbx_winnt_import(void) { const HINSTANCE hKernel32dll = GetModuleHandleA("kernel32.dll"); diff --git a/src/ntdll.def b/src/elements/ntdll.def similarity index 100% rename from src/ntdll.def rename to src/elements/ntdll.def diff --git a/src/osal.c b/src/elements/osal.c similarity index 91% rename from src/osal.c rename to src/elements/osal.c index 48d6d4e2..6b9e136a 100644 --- a/src/osal.c +++ b/src/elements/osal.c @@ -14,7 +14,7 @@ * . */ -#include "./bits.h" +#include "./internals.h" #if defined(_WIN32) || defined(_WIN64) @@ -202,8 +202,9 @@ __extern_C void __assert(const char *function, const char *file, int line, #endif /* __assert_fail */ -void __cold mdbx_assert_fail(const MDBX_env *env, const char *msg, - const char *func, int line) { +MDBX_INTERNAL_FUNC void __cold mdbx_assert_fail(const MDBX_env *env, + const char *msg, + const char *func, int line) { #if MDBX_DEBUG if (env && env->me_assert_func) { env->me_assert_func(env, msg, func, line); @@ -237,7 +238,7 @@ void __cold mdbx_assert_fail(const MDBX_env *env, const char *msg, #endif } -__cold void mdbx_panic(const char *fmt, ...) { +MDBX_INTERNAL_FUNC __cold void mdbx_panic(const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -262,7 +263,8 @@ __cold void mdbx_panic(const char *fmt, ...) { /*----------------------------------------------------------------------------*/ #ifndef mdbx_vasprintf -int mdbx_vasprintf(char **strp, const char *fmt, va_list ap) { +MDBX_INTERNAL_FUNC int mdbx_vasprintf(char **strp, const char *fmt, + va_list ap) { va_list ones; va_copy(ones, ap); int needed = vsnprintf(nullptr, 0, fmt, ap); @@ -297,7 +299,7 @@ int mdbx_vasprintf(char **strp, const char *fmt, va_list ap) { #endif /* mdbx_vasprintf */ #ifndef mdbx_asprintf -int mdbx_asprintf(char **strp, const char *fmt, ...) { +MDBX_INTERNAL_FUNC int mdbx_asprintf(char **strp, const char *fmt, ...) { va_list ap; va_start(ap, fmt); int rc = mdbx_vasprintf(strp, fmt, ap); @@ -307,7 +309,8 @@ int mdbx_asprintf(char **strp, const char *fmt, ...) { #endif /* mdbx_asprintf */ #ifndef mdbx_memalign_alloc -int mdbx_memalign_alloc(size_t alignment, size_t bytes, void **result) { +MDBX_INTERNAL_FUNC int mdbx_memalign_alloc(size_t alignment, size_t bytes, + void **result) { #if defined(_WIN32) || defined(_WIN64) (void)alignment; *result = VirtualAlloc(NULL, bytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); @@ -328,7 +331,7 @@ int mdbx_memalign_alloc(size_t alignment, size_t bytes, void **result) { #endif /* mdbx_memalign_alloc */ #ifndef mdbx_memalign_free -void mdbx_memalign_free(void *ptr) { +MDBX_INTERNAL_FUNC void mdbx_memalign_free(void *ptr) { #if defined(_WIN32) || defined(_WIN64) VirtualFree(ptr, 0, MEM_RELEASE); #else @@ -351,7 +354,7 @@ char *mdbx_strdup(const char *str) { /*----------------------------------------------------------------------------*/ -int mdbx_condmutex_init(mdbx_condmutex_t *condmutex) { +MDBX_INTERNAL_FUNC int mdbx_condmutex_init(mdbx_condmutex_t *condmutex) { #if defined(_WIN32) || defined(_WIN64) int rc = MDBX_SUCCESS; condmutex->event = NULL; @@ -386,7 +389,7 @@ static bool is_allzeros(const void *ptr, size_t bytes) { return true; } -int mdbx_condmutex_destroy(mdbx_condmutex_t *condmutex) { +MDBX_INTERNAL_FUNC int mdbx_condmutex_destroy(mdbx_condmutex_t *condmutex) { int rc = MDBX_EINVAL; #if defined(_WIN32) || defined(_WIN64) if (condmutex->event) { @@ -414,7 +417,7 @@ int mdbx_condmutex_destroy(mdbx_condmutex_t *condmutex) { return rc; } -int mdbx_condmutex_lock(mdbx_condmutex_t *condmutex) { +MDBX_INTERNAL_FUNC int mdbx_condmutex_lock(mdbx_condmutex_t *condmutex) { #if defined(_WIN32) || defined(_WIN64) DWORD code = WaitForSingleObject(condmutex->mutex, INFINITE); return waitstatus2errcode(code); @@ -423,7 +426,7 @@ int mdbx_condmutex_lock(mdbx_condmutex_t *condmutex) { #endif } -int mdbx_condmutex_unlock(mdbx_condmutex_t *condmutex) { +MDBX_INTERNAL_FUNC int mdbx_condmutex_unlock(mdbx_condmutex_t *condmutex) { #if defined(_WIN32) || defined(_WIN64) return ReleaseMutex(condmutex->mutex) ? MDBX_SUCCESS : GetLastError(); #else @@ -431,7 +434,7 @@ int mdbx_condmutex_unlock(mdbx_condmutex_t *condmutex) { #endif } -int mdbx_condmutex_signal(mdbx_condmutex_t *condmutex) { +MDBX_INTERNAL_FUNC int mdbx_condmutex_signal(mdbx_condmutex_t *condmutex) { #if defined(_WIN32) || defined(_WIN64) return SetEvent(condmutex->event) ? MDBX_SUCCESS : GetLastError(); #else @@ -439,7 +442,7 @@ int mdbx_condmutex_signal(mdbx_condmutex_t *condmutex) { #endif } -int mdbx_condmutex_wait(mdbx_condmutex_t *condmutex) { +MDBX_INTERNAL_FUNC int mdbx_condmutex_wait(mdbx_condmutex_t *condmutex) { #if defined(_WIN32) || defined(_WIN64) DWORD code = SignalObjectAndWait(condmutex->mutex, condmutex->event, INFINITE, FALSE); @@ -453,7 +456,7 @@ int mdbx_condmutex_wait(mdbx_condmutex_t *condmutex) { /*----------------------------------------------------------------------------*/ -int mdbx_fastmutex_init(mdbx_fastmutex_t *fastmutex) { +MDBX_INTERNAL_FUNC int mdbx_fastmutex_init(mdbx_fastmutex_t *fastmutex) { #if defined(_WIN32) || defined(_WIN64) InitializeCriticalSection(fastmutex); return MDBX_SUCCESS; @@ -462,7 +465,7 @@ int mdbx_fastmutex_init(mdbx_fastmutex_t *fastmutex) { #endif } -int mdbx_fastmutex_destroy(mdbx_fastmutex_t *fastmutex) { +MDBX_INTERNAL_FUNC int mdbx_fastmutex_destroy(mdbx_fastmutex_t *fastmutex) { #if defined(_WIN32) || defined(_WIN64) DeleteCriticalSection(fastmutex); return MDBX_SUCCESS; @@ -471,7 +474,7 @@ int mdbx_fastmutex_destroy(mdbx_fastmutex_t *fastmutex) { #endif } -int mdbx_fastmutex_acquire(mdbx_fastmutex_t *fastmutex) { +MDBX_INTERNAL_FUNC int mdbx_fastmutex_acquire(mdbx_fastmutex_t *fastmutex) { #if defined(_WIN32) || defined(_WIN64) EnterCriticalSection(fastmutex); return MDBX_SUCCESS; @@ -480,7 +483,7 @@ int mdbx_fastmutex_acquire(mdbx_fastmutex_t *fastmutex) { #endif } -int mdbx_fastmutex_release(mdbx_fastmutex_t *fastmutex) { +MDBX_INTERNAL_FUNC int mdbx_fastmutex_release(mdbx_fastmutex_t *fastmutex) { #if defined(_WIN32) || defined(_WIN64) LeaveCriticalSection(fastmutex); return MDBX_SUCCESS; @@ -491,15 +494,17 @@ int mdbx_fastmutex_release(mdbx_fastmutex_t *fastmutex) { /*----------------------------------------------------------------------------*/ -int mdbx_removefile(const char *pathname) { +MDBX_INTERNAL_FUNC int mdbx_removefile(const char *pathname) { #if defined(_WIN32) || defined(_WIN64) return DeleteFileA(pathname) ? MDBX_SUCCESS : GetLastError(); #else return unlink(pathname) ? errno : MDBX_SUCCESS; #endif } -int mdbx_openfile(const char *pathname, int flags, mode_t mode, - mdbx_filehandle_t *fd, bool exclusive) { + +MDBX_INTERNAL_FUNC int mdbx_openfile(const char *pathname, int flags, + mode_t mode, mdbx_filehandle_t *fd, + bool exclusive) { *fd = INVALID_HANDLE_VALUE; #if defined(_WIN32) || defined(_WIN64) (void)mode; @@ -590,7 +595,7 @@ int mdbx_openfile(const char *pathname, int flags, mode_t mode, return MDBX_SUCCESS; } -int mdbx_closefile(mdbx_filehandle_t fd) { +MDBX_INTERNAL_FUNC int mdbx_closefile(mdbx_filehandle_t fd) { #if defined(_WIN32) || defined(_WIN64) return CloseHandle(fd) ? MDBX_SUCCESS : GetLastError(); #else @@ -598,7 +603,8 @@ int mdbx_closefile(mdbx_filehandle_t fd) { #endif } -int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t bytes, uint64_t offset) { +MDBX_INTERNAL_FUNC int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t bytes, + uint64_t offset) { if (bytes > MAX_WRITE) return MDBX_EINVAL; #if defined(_WIN32) || defined(_WIN64) @@ -624,8 +630,8 @@ int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t bytes, uint64_t offset) { return (bytes == (size_t)read) ? MDBX_SUCCESS : MDBX_ENODATA; } -int mdbx_pwrite(mdbx_filehandle_t fd, const void *buf, size_t bytes, - uint64_t offset) { +MDBX_INTERNAL_FUNC int mdbx_pwrite(mdbx_filehandle_t fd, const void *buf, + size_t bytes, uint64_t offset) { while (true) { #if defined(_WIN32) || defined(_WIN64) OVERLAPPED ov; @@ -688,7 +694,8 @@ int mdbx_pwritev(mdbx_filehandle_t fd, struct iovec *iov, int iovcnt, #endif } -int mdbx_filesync(mdbx_filehandle_t fd, enum mdbx_syncmode_bits mode_bits) { +MDBX_INTERNAL_FUNC int mdbx_filesync(mdbx_filehandle_t fd, + enum mdbx_syncmode_bits mode_bits) { #if defined(_WIN32) || defined(_WIN64) return ((mode_bits & (MDBX_SYNC_DATA | MDBX_SYNC_IODQ)) == 0 || FlushFileBuffers(fd)) @@ -747,7 +754,7 @@ int mdbx_filesize(mdbx_filehandle_t fd, uint64_t *length) { return MDBX_SUCCESS; } -int mdbx_ftruncate(mdbx_filehandle_t fd, uint64_t length) { +MDBX_INTERNAL_FUNC int mdbx_ftruncate(mdbx_filehandle_t fd, uint64_t length) { #if defined(_WIN32) || defined(_WIN64) if (mdbx_SetFileInformationByHandle) { FILE_END_OF_FILE_INFO EndOfFileInfo; @@ -771,7 +778,7 @@ int mdbx_ftruncate(mdbx_filehandle_t fd, uint64_t length) { #endif } -int mdbx_fseek(mdbx_filehandle_t fd, uint64_t pos) { +MDBX_INTERNAL_FUNC int mdbx_fseek(mdbx_filehandle_t fd, uint64_t pos) { #if defined(_WIN32) || defined(_WIN64) LARGE_INTEGER li; li.QuadPart = pos; @@ -786,9 +793,10 @@ int mdbx_fseek(mdbx_filehandle_t fd, uint64_t pos) { /*----------------------------------------------------------------------------*/ -int mdbx_thread_create(mdbx_thread_t *thread, - THREAD_RESULT(THREAD_CALL *start_routine)(void *), - void *arg) { +MDBX_INTERNAL_FUNC int +mdbx_thread_create(mdbx_thread_t *thread, + THREAD_RESULT(THREAD_CALL *start_routine)(void *), + void *arg) { #if defined(_WIN32) || defined(_WIN64) *thread = CreateThread(NULL, 0, start_routine, arg, 0, NULL); return *thread ? MDBX_SUCCESS : GetLastError(); @@ -797,7 +805,7 @@ int mdbx_thread_create(mdbx_thread_t *thread, #endif } -int mdbx_thread_join(mdbx_thread_t thread) { +MDBX_INTERNAL_FUNC int mdbx_thread_join(mdbx_thread_t thread) { #if defined(_WIN32) || defined(_WIN64) DWORD code = WaitForSingleObject(thread, INFINITE); return waitstatus2errcode(code); @@ -809,7 +817,8 @@ int mdbx_thread_join(mdbx_thread_t thread) { /*----------------------------------------------------------------------------*/ -int mdbx_msync(mdbx_mmap_t *map, size_t offset, size_t length, int async) { +MDBX_INTERNAL_FUNC int mdbx_msync(mdbx_mmap_t *map, size_t offset, + size_t length, int async) { uint8_t *ptr = (uint8_t *)map->address + offset; #if defined(_WIN32) || defined(_WIN64) if (FlushViewOfFile(ptr, length) && (async || FlushFileBuffers(map->fd))) @@ -834,7 +843,8 @@ int mdbx_msync(mdbx_mmap_t *map, size_t offset, size_t length, int async) { #endif } -int mdbx_check4nonlocal(mdbx_filehandle_t handle, int flags) { +MDBX_INTERNAL_FUNC int mdbx_check4nonlocal(mdbx_filehandle_t handle, + int flags) { #if defined(_WIN32) || defined(_WIN64) if (GetFileType(handle) != FILE_TYPE_DISK) return ERROR_FILE_OFFLINE; @@ -952,7 +962,8 @@ int mdbx_check4nonlocal(mdbx_filehandle_t handle, int flags) { return MDBX_SUCCESS; } -int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t size, size_t limit) { +MDBX_INTERNAL_FUNC int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t size, + size_t limit) { assert(size <= limit); #if defined(_WIN32) || defined(_WIN64) map->length = 0; @@ -1013,6 +1024,9 @@ int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t size, size_t limit) { map->length = ViewSize; return MDBX_SUCCESS; #else + int err = mdbx_check4nonlocal(map->fd, flags); + if (unlikely(err != MDBX_SUCCESS)) + return err; (void)size; map->address = mmap( NULL, limit, (flags & MDBX_WRITEMAP) ? PROT_READ | PROT_WRITE : PROT_READ, @@ -1027,7 +1041,7 @@ int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t size, size_t limit) { #endif } -int mdbx_munmap(mdbx_mmap_t *map) { +MDBX_INTERNAL_FUNC int mdbx_munmap(mdbx_mmap_t *map) { #if defined(_WIN32) || defined(_WIN64) if (map->section) NtClose(map->section); @@ -1047,7 +1061,8 @@ int mdbx_munmap(mdbx_mmap_t *map) { return MDBX_SUCCESS; } -int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t size, size_t limit) { +MDBX_INTERNAL_FUNC int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t size, + size_t limit) { assert(size <= limit); #if defined(_WIN32) || defined(_WIN64) assert(size != map->current || limit != map->length || size < map->filesize); @@ -1228,7 +1243,7 @@ retry_mapview:; /*----------------------------------------------------------------------------*/ -__cold void mdbx_osal_jitter(bool tiny) { +MDBX_INTERNAL_FUNC __cold void mdbx_osal_jitter(bool tiny) { for (;;) { #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || \ defined(__x86_64__) @@ -1272,7 +1287,8 @@ static __cold clockid_t choice_monoclock() { } #endif -uint64_t mdbx_osal_16dot16_to_monotime(uint32_t seconds_16dot16) { +MDBX_INTERNAL_FUNC uint64_t +mdbx_osal_16dot16_to_monotime(uint32_t seconds_16dot16) { #if defined(_WIN32) || defined(_WIN64) static LARGE_INTEGER performance_frequency; if (performance_frequency.QuadPart == 0) @@ -1291,7 +1307,7 @@ uint64_t mdbx_osal_16dot16_to_monotime(uint32_t seconds_16dot16) { return (ratio * seconds_16dot16 + 32768) >> 16; } -uint64_t mdbx_osal_monotime(void) { +MDBX_INTERNAL_FUNC uint64_t mdbx_osal_monotime(void) { #if defined(_WIN32) || defined(_WIN64) LARGE_INTEGER counter; counter.QuadPart = 0; diff --git a/src/osal.h b/src/elements/osal.h similarity index 86% rename from src/osal.h rename to src/elements/osal.h index 0a7a4ad6..e5770c3a 100644 --- a/src/osal.h +++ b/src/elements/osal.h @@ -484,8 +484,9 @@ static __inline void mdbx_invalidate_mmap_noncoherent_cache(void *addr, #define mdbx_asprintf asprintf #define mdbx_vasprintf vasprintf #else -__printf_args(2, 3) int mdbx_asprintf(char **strp, const char *fmt, ...); -int mdbx_vasprintf(char **strp, const char *fmt, va_list ap); +MDBX_INTERNAL_FUNC __printf_args(2, 3) int __maybe_unused + mdbx_asprintf(char **strp, const char *fmt, ...); +MDBX_INTERNAL_FUNC int mdbx_vasprintf(char **strp, const char *fmt, va_list ap); #endif /*----------------------------------------------------------------------------*/ @@ -495,7 +496,7 @@ int mdbx_vasprintf(char **strp, const char *fmt, va_list ap); #define MAX_WRITE UINT32_C(0x3fff0000) #if defined(__linux__) || defined(__gnu_linux__) -extern uint32_t mdbx_linux_kernel_version; +MDBX_INTERNAL_VAR uint32_t mdbx_linux_kernel_version; #endif /* Linux */ /* Get the size of a memory page for the system. @@ -525,34 +526,38 @@ static __inline int mdbx_get_errno(void) { } #ifndef mdbx_memalign_alloc -int mdbx_memalign_alloc(size_t alignment, size_t bytes, void **result); +MDBX_INTERNAL_FUNC int mdbx_memalign_alloc(size_t alignment, size_t bytes, + void **result); #endif #ifndef mdbx_memalign_free -void mdbx_memalign_free(void *ptr); +MDBX_INTERNAL_FUNC void mdbx_memalign_free(void *ptr); #endif -int mdbx_condmutex_init(mdbx_condmutex_t *condmutex); -int mdbx_condmutex_lock(mdbx_condmutex_t *condmutex); -int mdbx_condmutex_unlock(mdbx_condmutex_t *condmutex); -int mdbx_condmutex_signal(mdbx_condmutex_t *condmutex); -int mdbx_condmutex_wait(mdbx_condmutex_t *condmutex); -int mdbx_condmutex_destroy(mdbx_condmutex_t *condmutex); +MDBX_INTERNAL_FUNC int mdbx_condmutex_init(mdbx_condmutex_t *condmutex); +MDBX_INTERNAL_FUNC int mdbx_condmutex_lock(mdbx_condmutex_t *condmutex); +MDBX_INTERNAL_FUNC int mdbx_condmutex_unlock(mdbx_condmutex_t *condmutex); +MDBX_INTERNAL_FUNC int mdbx_condmutex_signal(mdbx_condmutex_t *condmutex); +MDBX_INTERNAL_FUNC int mdbx_condmutex_wait(mdbx_condmutex_t *condmutex); +MDBX_INTERNAL_FUNC int mdbx_condmutex_destroy(mdbx_condmutex_t *condmutex); -int mdbx_fastmutex_init(mdbx_fastmutex_t *fastmutex); -int mdbx_fastmutex_acquire(mdbx_fastmutex_t *fastmutex); -int mdbx_fastmutex_release(mdbx_fastmutex_t *fastmutex); -int mdbx_fastmutex_destroy(mdbx_fastmutex_t *fastmutex); +MDBX_INTERNAL_FUNC int mdbx_fastmutex_init(mdbx_fastmutex_t *fastmutex); +MDBX_INTERNAL_FUNC int mdbx_fastmutex_acquire(mdbx_fastmutex_t *fastmutex); +MDBX_INTERNAL_FUNC int mdbx_fastmutex_release(mdbx_fastmutex_t *fastmutex); +MDBX_INTERNAL_FUNC int mdbx_fastmutex_destroy(mdbx_fastmutex_t *fastmutex); -int mdbx_pwritev(mdbx_filehandle_t fd, struct iovec *iov, int iovcnt, - uint64_t offset, size_t expected_written); -int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t count, uint64_t offset); -int mdbx_pwrite(mdbx_filehandle_t fd, const void *buf, size_t count, - uint64_t offset); +MDBX_INTERNAL_FUNC int mdbx_pwritev(mdbx_filehandle_t fd, struct iovec *iov, + int iovcnt, uint64_t offset, + size_t expected_written); +MDBX_INTERNAL_FUNC int mdbx_pread(mdbx_filehandle_t fd, void *buf, size_t count, + uint64_t offset); +MDBX_INTERNAL_FUNC int mdbx_pwrite(mdbx_filehandle_t fd, const void *buf, + size_t count, uint64_t offset); -int mdbx_thread_create(mdbx_thread_t *thread, - THREAD_RESULT(THREAD_CALL *start_routine)(void *), - void *arg); -int mdbx_thread_join(mdbx_thread_t thread); +MDBX_INTERNAL_FUNC int +mdbx_thread_create(mdbx_thread_t *thread, + THREAD_RESULT(THREAD_CALL *start_routine)(void *), + void *arg); +MDBX_INTERNAL_FUNC int mdbx_thread_join(mdbx_thread_t thread); enum mdbx_syncmode_bits { MDBX_SYNC_DATA = 1, @@ -560,15 +565,16 @@ enum mdbx_syncmode_bits { MDBX_SYNC_IODQ = 4 }; -int mdbx_filesync(mdbx_filehandle_t fd, enum mdbx_syncmode_bits mode_bits); -int mdbx_filesize_sync(mdbx_filehandle_t fd); -int mdbx_ftruncate(mdbx_filehandle_t fd, uint64_t length); -int mdbx_fseek(mdbx_filehandle_t fd, uint64_t pos); -int mdbx_filesize(mdbx_filehandle_t fd, uint64_t *length); -int mdbx_openfile(const char *pathname, int flags, mode_t mode, - mdbx_filehandle_t *fd, bool exclusive); -int mdbx_closefile(mdbx_filehandle_t fd); -int mdbx_removefile(const char *pathname); +MDBX_INTERNAL_FUNC int mdbx_filesync(mdbx_filehandle_t fd, + enum mdbx_syncmode_bits mode_bits); +MDBX_INTERNAL_FUNC int mdbx_ftruncate(mdbx_filehandle_t fd, uint64_t length); +MDBX_INTERNAL_FUNC int mdbx_fseek(mdbx_filehandle_t fd, uint64_t pos); +MDBX_INTERNAL_FUNC int mdbx_filesize(mdbx_filehandle_t fd, uint64_t *length); +MDBX_INTERNAL_FUNC int mdbx_openfile(const char *pathname, int flags, + mode_t mode, mdbx_filehandle_t *fd, + bool exclusive); +MDBX_INTERNAL_FUNC int mdbx_closefile(mdbx_filehandle_t fd); +MDBX_INTERNAL_FUNC int mdbx_removefile(const char *pathname); typedef struct mdbx_mmap_param { union { @@ -587,20 +593,24 @@ typedef struct mdbx_mmap_param { #endif } mdbx_mmap_t; -int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t must, size_t limit); -int mdbx_munmap(mdbx_mmap_t *map); -int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t current, size_t wanna); +MDBX_INTERNAL_FUNC int mdbx_mmap(int flags, mdbx_mmap_t *map, size_t must, + size_t limit); +MDBX_INTERNAL_FUNC int mdbx_munmap(mdbx_mmap_t *map); +MDBX_INTERNAL_FUNC int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t current, + size_t wanna); #if defined(_WIN32) || defined(_WIN64) typedef struct { unsigned limit, count; HANDLE handles[31]; } mdbx_handle_array_t; -int mdbx_suspend_threads_before_remap(MDBX_env *env, - mdbx_handle_array_t **array); -int mdbx_resume_threads_after_remap(mdbx_handle_array_t *array); +MDBX_INTERNAL_FUNC int +mdbx_suspend_threads_before_remap(MDBX_env *env, mdbx_handle_array_t **array); +MDBX_INTERNAL_FUNC int +mdbx_resume_threads_after_remap(mdbx_handle_array_t *array); #endif /* Windows */ -int mdbx_msync(mdbx_mmap_t *map, size_t offset, size_t length, int async); -int mdbx_check4nonlocal(mdbx_filehandle_t handle, int flags); +MDBX_INTERNAL_FUNC int mdbx_msync(mdbx_mmap_t *map, size_t offset, + size_t length, int async); +MDBX_INTERNAL_FUNC int mdbx_check4nonlocal(mdbx_filehandle_t handle, int flags); static __inline mdbx_pid_t mdbx_getpid(void) { #if defined(_WIN32) || defined(_WIN64) @@ -618,9 +628,10 @@ static __inline mdbx_tid_t mdbx_thread_self(void) { #endif } -void mdbx_osal_jitter(bool tiny); -uint64_t mdbx_osal_monotime(void); -uint64_t mdbx_osal_16dot16_to_monotime(uint32_t seconds_16dot16); +MDBX_INTERNAL_FUNC void __maybe_unused mdbx_osal_jitter(bool tiny); +MDBX_INTERNAL_FUNC uint64_t mdbx_osal_monotime(void); +MDBX_INTERNAL_FUNC uint64_t +mdbx_osal_16dot16_to_monotime(uint32_t seconds_16dot16); /*----------------------------------------------------------------------------*/ /* lck stuff */ @@ -646,7 +657,7 @@ uint64_t mdbx_osal_16dot16_to_monotime(uint32_t seconds_16dot16); /// НЕ должна инициализировать уже используемые разделяемые объекты /// синхронизации расположенные в отображенном в память LCK-файле. /// \return Код ошибки или 0 в случае успеха. -int mdbx_lck_init(MDBX_env *env, int global_uniqueness_flag); +MDBX_INTERNAL_FUNC int mdbx_lck_init(MDBX_env *env, int global_uniqueness_flag); /// \brief Отключение от общих межпроцесных объектов и разрушение объектов /// синхронизации внутри текущего процесса связанных с экземпляром MDBX_env. @@ -665,7 +676,8 @@ int mdbx_lck_init(MDBX_env *env, int global_uniqueness_flag); /// MDBX_env внутри процесса - например, восстановить POSIX-fcntl блокировки /// после закрытия файловых дескрипторов. /// \return Код ошибки (MDBX_PANIC) или 0 в случае успеха. -int mdbx_lck_destroy(MDBX_env *env, MDBX_env *inprocess_neighbor); +MDBX_INTERNAL_FUNC int mdbx_lck_destroy(MDBX_env *env, + MDBX_env *inprocess_neighbor); /// \brief Подключение к общим межпроцесным объектам блокировки с попыткой /// захвата блокировки максимального уровня (разделяемой при недоступности @@ -683,7 +695,7 @@ int mdbx_lck_destroy(MDBX_env *env, MDBX_env *inprocess_neighbor); /// блокировку и, следовательно, БД уже открыта и используется другими /// процессами. /// Иначе (не 0 и не -1) - код ошибки. -int mdbx_lck_seize(MDBX_env *env); +MDBX_INTERNAL_FUNC int mdbx_lck_seize(MDBX_env *env); /// \brief Снижает уровень первоначальной захваченной блокировки до /// операционного уровня определяемого аргументом. @@ -691,37 +703,39 @@ int mdbx_lck_seize(MDBX_env *env); /// complete = TRUE - понижение до разделяемой блокировки. /// complete = FALSE - понижение до эксклюзивной операционной блокировки. /// \return Код ошибки или 0 в случае успеха. -int mdbx_lck_downgrade(MDBX_env *env, bool complete); +MDBX_INTERNAL_FUNC int mdbx_lck_downgrade(MDBX_env *env, bool complete); /// \brief Блокирует lck-файл и/или таблицу читателей для (де)регистрации. /// \return Код ошибки или 0 в случае успеха. -int mdbx_rdt_lock(MDBX_env *env); +MDBX_INTERNAL_FUNC int mdbx_rdt_lock(MDBX_env *env); /// \brief Разблокирует lck-файл и/или таблицу читателей после (де)регистрации. -void mdbx_rdt_unlock(MDBX_env *env); +MDBX_INTERNAL_FUNC void mdbx_rdt_unlock(MDBX_env *env); /// \brief Захватывает блокировку для изменения БД (при старте пишущей -/// транзакции). Транзакции чтения при этом никак не блокируются. +/// транзакции). Транзакции чтения при этом никак не блокируются. +/// Объявлена без MDBX_INTERNAL_FUNC так как используется в mdbx_chk. /// \return Код ошибки или 0 в случае успеха. -LIBMDBX_API int mdbx_txn_lock(MDBX_env *env, bool dontwait); +int mdbx_txn_lock(MDBX_env *env, bool dontwait); /// \brief Освобождает блокировку по окончанию изменения БД (после завершения -/// пишущей транзакции). -LIBMDBX_API void mdbx_txn_unlock(MDBX_env *env); +/// пишущей транзакции). +/// Объявлена без MDBX_INTERNAL_FUNC так как используется в mdbx_chk. +void mdbx_txn_unlock(MDBX_env *env); /// \brief Устанавливает alive-флажок присутствия (индицирующую блокировку) /// читателя для pid текущего процесса. Функции может выполнить не более /// необходимого минимума для корректной работы mdbx_rpid_check() в других /// процессах. /// \return Код ошибки или 0 в случае успеха. -int mdbx_rpid_set(MDBX_env *env); +MDBX_INTERNAL_FUNC int mdbx_rpid_set(MDBX_env *env); /// \brief Снимает alive-флажок присутствия (индицирующую блокировку) /// читателя для pid текущего процесса. Функции может выполнить не более /// необходимого минимума для корректной работы mdbx_rpid_check() в других /// процессах. /// \return Код ошибки или 0 в случае успеха. -int mdbx_rpid_clear(MDBX_env *env); +MDBX_INTERNAL_FUNC int mdbx_rpid_clear(MDBX_env *env); /// \brief Проверяет жив ли процесс-читатель с заданным pid /// по alive-флажку присутствия (индицирующей блокировку), @@ -732,7 +746,7 @@ int mdbx_rpid_clear(MDBX_env *env); /// MDBX_RESULT_FALSE (0) - если процесс-читатель с соответствующим pid /// отсутствует или не работает с БД (индицирующая блокировка отсутствует). /// Иначе (не 0 и не -1) - код ошибки. -int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid); +MDBX_INTERNAL_FUNC int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid); #if defined(_WIN32) || defined(_WIN64) typedef union MDBX_srwlock { @@ -744,14 +758,15 @@ typedef union MDBX_srwlock { } MDBX_srwlock; typedef void(WINAPI *MDBX_srwlock_function)(MDBX_srwlock *); -extern MDBX_srwlock_function mdbx_srwlock_Init, mdbx_srwlock_AcquireShared, - mdbx_srwlock_ReleaseShared, mdbx_srwlock_AcquireExclusive, - mdbx_srwlock_ReleaseExclusive; +MDBX_INTERNAL_VAR MDBX_srwlock_function mdbx_srwlock_Init, + mdbx_srwlock_AcquireShared, mdbx_srwlock_ReleaseShared, + mdbx_srwlock_AcquireExclusive, mdbx_srwlock_ReleaseExclusive; typedef BOOL(WINAPI *MDBX_GetFileInformationByHandleEx)( _In_ HANDLE hFile, _In_ FILE_INFO_BY_HANDLE_CLASS FileInformationClass, _Out_ LPVOID lpFileInformation, _In_ DWORD dwBufferSize); -extern MDBX_GetFileInformationByHandleEx mdbx_GetFileInformationByHandleEx; +MDBX_INTERNAL_VAR MDBX_GetFileInformationByHandleEx + mdbx_GetFileInformationByHandleEx; typedef BOOL(WINAPI *MDBX_GetVolumeInformationByHandleW)( _In_ HANDLE hFile, _Out_opt_ LPWSTR lpVolumeNameBuffer, @@ -759,18 +774,20 @@ typedef BOOL(WINAPI *MDBX_GetVolumeInformationByHandleW)( _Out_opt_ LPDWORD lpMaximumComponentLength, _Out_opt_ LPDWORD lpFileSystemFlags, _Out_opt_ LPWSTR lpFileSystemNameBuffer, _In_ DWORD nFileSystemNameSize); -extern MDBX_GetVolumeInformationByHandleW mdbx_GetVolumeInformationByHandleW; +MDBX_INTERNAL_VAR MDBX_GetVolumeInformationByHandleW + mdbx_GetVolumeInformationByHandleW; typedef DWORD(WINAPI *MDBX_GetFinalPathNameByHandleW)(_In_ HANDLE hFile, _Out_ LPWSTR lpszFilePath, _In_ DWORD cchFilePath, _In_ DWORD dwFlags); -extern MDBX_GetFinalPathNameByHandleW mdbx_GetFinalPathNameByHandleW; +MDBX_INTERNAL_VAR MDBX_GetFinalPathNameByHandleW mdbx_GetFinalPathNameByHandleW; typedef BOOL(WINAPI *MDBX_SetFileInformationByHandle)( _In_ HANDLE hFile, _In_ FILE_INFO_BY_HANDLE_CLASS FileInformationClass, _Out_ LPVOID lpFileInformation, _In_ DWORD dwBufferSize); -extern MDBX_SetFileInformationByHandle mdbx_SetFileInformationByHandle; +MDBX_INTERNAL_VAR MDBX_SetFileInformationByHandle + mdbx_SetFileInformationByHandle; typedef NTSTATUS(NTAPI *MDBX_NtFsControlFile)( IN HANDLE FileHandle, IN OUT HANDLE Event, @@ -778,7 +795,7 @@ typedef NTSTATUS(NTAPI *MDBX_NtFsControlFile)( OUT PIO_STATUS_BLOCK IoStatusBlock, IN ULONG FsControlCode, IN OUT PVOID InputBuffer, IN ULONG InputBufferLength, OUT OPTIONAL PVOID OutputBuffer, IN ULONG OutputBufferLength); -extern MDBX_NtFsControlFile mdbx_NtFsControlFile; +MDBX_INTERNAL_VAR MDBX_NtFsControlFile mdbx_NtFsControlFile; #if !defined(_WIN32_WINNT_WIN8) || _WIN32_WINNT < _WIN32_WINNT_WIN8 typedef struct _WIN32_MEMORY_RANGE_ENTRY { @@ -790,11 +807,11 @@ typedef struct _WIN32_MEMORY_RANGE_ENTRY { typedef BOOL(WINAPI *MDBX_PrefetchVirtualMemory)( HANDLE hProcess, ULONG_PTR NumberOfEntries, PWIN32_MEMORY_RANGE_ENTRY VirtualAddresses, ULONG Flags); -extern MDBX_PrefetchVirtualMemory mdbx_PrefetchVirtualMemory; +MDBX_INTERNAL_VAR MDBX_PrefetchVirtualMemory mdbx_PrefetchVirtualMemory; typedef DWORD(WINAPI *MDBX_DiscardVirtualMemory)(PVOID VirtualAddress, SIZE_T Size); -extern MDBX_DiscardVirtualMemory mdbx_DiscardVirtualMemory; +MDBX_INTERNAL_VAR MDBX_DiscardVirtualMemory mdbx_DiscardVirtualMemory; #endif /* Windows */ diff --git a/src/version.c b/src/elements/version.c.in similarity index 97% rename from src/version.c rename to src/elements/version.c.in index a0f7b4f5..27c44fa6 100644 --- a/src/version.c +++ b/src/elements/version.c.in @@ -12,7 +12,7 @@ * . */ -#include "./bits.h" +#include "./internals.h" #if MDBX_VERSION_MAJOR != 0 || MDBX_VERSION_MINOR != 3 #error "API version mismatch!" diff --git a/src/tools/mdbx_chk.c b/src/tools/mdbx_chk.c index 9d3b9e06..8fa10e93 100644 --- a/src/tools/mdbx_chk.c +++ b/src/tools/mdbx_chk.c @@ -22,7 +22,7 @@ /* Avoid reference to mdbx_runtime_flags from assert() */ #define mdbx_runtime_flags (~0u) -#include "../bits.h" +#include "../elements/internals.h" typedef struct flagbit { int bit; diff --git a/src/tools/mdbx_chk.vcxproj b/src/tools/mdbx_chk.vcxproj deleted file mode 100644 index e6c26862..00000000 --- a/src/tools/mdbx_chk.vcxproj +++ /dev/null @@ -1,166 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {15030120-5F7F-48F9-ABE5-DFC814F2A4BE} - Win32Proj - mdbx_chk - 8.1 - - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - EnableAllWarnings - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - - - EnableAllWarnings - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - EnableAllWarnings - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - EnableAllWarnings - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - {6d19209b-ece7-4b9c-941c-0aa2b484f199} - - - - - - - - - - - - - - diff --git a/src/tools/mdbx_copy.c b/src/tools/mdbx_copy.c index f700b178..5e59974c 100644 --- a/src/tools/mdbx_copy.c +++ b/src/tools/mdbx_copy.c @@ -22,7 +22,7 @@ /* Avoid reference to mdbx_runtime_flags from assert() */ #define mdbx_runtime_flags (~0u) -#include "../bits.h" +#include "../elements/internals.h" #if defined(_WIN32) || defined(_WIN64) #include "wingetopt.h" diff --git a/src/tools/mdbx_copy.vcxproj b/src/tools/mdbx_copy.vcxproj deleted file mode 100644 index d47513c2..00000000 --- a/src/tools/mdbx_copy.vcxproj +++ /dev/null @@ -1,166 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {15030120-5F7F-48F9-ABE5-DFC814F2A4BD} - Win32Proj - mdbx_copy - 8.1 - - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - EnableAllWarnings - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - - - EnableAllWarnings - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - EnableAllWarnings - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - EnableAllWarnings - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - {6d19209b-ece7-4b9c-941c-0aa2b484f199} - - - - - - - - - - - - - - diff --git a/src/tools/mdbx_dump.c b/src/tools/mdbx_dump.c index 8cb9c86e..779e9abc 100644 --- a/src/tools/mdbx_dump.c +++ b/src/tools/mdbx_dump.c @@ -22,7 +22,7 @@ /* Avoid reference to mdbx_runtime_flags from assert() */ #define mdbx_runtime_flags (~0u) -#include "../bits.h" +#include "../elements/internals.h" #include diff --git a/src/tools/mdbx_dump.vcxproj b/src/tools/mdbx_dump.vcxproj deleted file mode 100644 index 6978a2c2..00000000 --- a/src/tools/mdbx_dump.vcxproj +++ /dev/null @@ -1,166 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {15030120-5F7F-48F9-ABE5-DFC814F2A4BC} - Win32Proj - mdbx_dump - 8.1 - - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - EnableAllWarnings - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - - - EnableAllWarnings - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - EnableAllWarnings - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - EnableAllWarnings - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - {6d19209b-ece7-4b9c-941c-0aa2b484f199} - - - - - - - - - - - - - - diff --git a/src/tools/mdbx_load.c b/src/tools/mdbx_load.c index 7bbc52b8..7bd82821 100644 --- a/src/tools/mdbx_load.c +++ b/src/tools/mdbx_load.c @@ -22,7 +22,7 @@ /* Avoid reference to mdbx_runtime_flags from assert() */ #define mdbx_runtime_flags (~0u) -#include "../bits.h" +#include "../elements/internals.h" #include diff --git a/src/tools/mdbx_load.vcxproj b/src/tools/mdbx_load.vcxproj deleted file mode 100644 index 05a100fc..00000000 --- a/src/tools/mdbx_load.vcxproj +++ /dev/null @@ -1,166 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {15030120-5F7F-48F9-ABE5-DFC814F2A4BB} - Win32Proj - mdbx_load - 8.1 - - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - EnableAllWarnings - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - - - EnableAllWarnings - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - EnableAllWarnings - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - EnableAllWarnings - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - {6d19209b-ece7-4b9c-941c-0aa2b484f199} - - - - - - - - - - - - - - diff --git a/src/tools/mdbx_stat.c b/src/tools/mdbx_stat.c index d4ebc2e6..707e14ae 100644 --- a/src/tools/mdbx_stat.c +++ b/src/tools/mdbx_stat.c @@ -22,7 +22,7 @@ /* Avoid reference to mdbx_runtime_flags from assert() */ #define mdbx_runtime_flags (~0u) -#include "../bits.h" +#include "../elements/internals.h" #if defined(_WIN32) || defined(_WIN64) #include "wingetopt.h" diff --git a/src/tools/mdbx_stat.vcxproj b/src/tools/mdbx_stat.vcxproj deleted file mode 100644 index 4027491d..00000000 --- a/src/tools/mdbx_stat.vcxproj +++ /dev/null @@ -1,166 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {15030120-5F7F-48F9-ABE5-DFC814F2A4BF} - Win32Proj - mdbx_stat - 8.1 - - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - - - - - - EnableAllWarnings - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - - - EnableAllWarnings - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - - - Console - - - - - EnableAllWarnings - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - EnableAllWarnings - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - - - Console - true - true - - - - - {6d19209b-ece7-4b9c-941c-0aa2b484f199} - - - - - - - - - - - - - - diff --git a/test/base.h b/test/base.h index 5ca134a8..b5ad6417 100644 --- a/test/base.h +++ b/test/base.h @@ -80,9 +80,11 @@ #include #include +#define MDBX_INTERNAL_FUNC +#define MDBX_INTERNAL_VAR extern #include "../mdbx.h" -#include "../src/defs.h" -#include "../src/osal.h" +#include "../src/elements/defs.h" +#include "../src/elements/osal.h" #if !defined(__thread) && (defined(_MSC_VER) || defined(__DMC__)) #define __thread __declspec(thread) diff --git a/test/test.vcxproj b/test/test.vcxproj deleted file mode 100644 index 93de00e3..00000000 --- a/test/test.vcxproj +++ /dev/null @@ -1,209 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {6d19209b-ece7-4b9c-941c-0aa2b484f199} - - - - {30E29CE6-E6FC-4D32-AA07-46A55FAF3A31} - Win32Proj - mdbxtest - 8.1 - - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - Application - true - v140 - MultiByte - - - Application - false - v140 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - mdbx_test - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - mdbx_test - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - mdbx_test - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\ - mdbx_test - - - - Use - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;MDBX_DEBUG=1;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - test.h - true - - - Console - true - winmm.lib;%(AdditionalDependencies) - - - - - Use - Level4 - Disabled - _DEBUG;_CONSOLE;MDBX_DEBUG=1;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - test.h - true - - - Console - true - winmm.lib;%(AdditionalDependencies) - - - - - Level4 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - test.h - true - - - Console - true - true - true - winmm.lib;%(AdditionalDependencies) - - - - - Level4 - Use - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions);LIBMDBX_IMPORTS=1 - true - test.h - true - - - Console - true - true - true - winmm.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - -