mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-28 18:58:48 +08:00
mdbx: rename internal defines/macros to distinguish it from build options.
Change-Id: I42fe240e6ddd5d34c8fec38633849ebdcce0e116
This commit is contained in:
parent
d27e48ae1b
commit
6b6165cdeb
@ -310,7 +310,7 @@ release-assets: libmdbx-sources-$(MDBX_VERSION_SUFFIX).tar.gz libmdbx-sources-$(
|
||||
|
||||
dist-checked.tag: $(addprefix dist/, $(DIST_SRC) $(DIST_EXTRA))
|
||||
@rm -rf $@ && echo -n "Verify amalgamated sources..." \
|
||||
&& if grep -R "define MDBX_ALLOY" dist | grep -q MDBX_BUILD_SOURCERY; then echo "sed output is WRONG!" >&2; exit 2; fi \
|
||||
&& if grep -R "define xMDBX_ALLOY" dist | grep -q MDBX_BUILD_SOURCERY; then echo "sed output is WRONG!" >&2; exit 2; fi \
|
||||
&& rm -rf dist-check && cp -r -p dist dist-check && ($(MAKE) -C dist-check > dist-check/build.log 2> dist-check/build.err || (cat dist-check/build.err && exit 1)) \
|
||||
&& touch $@ || (echo " FAILED! See dist-check/build.err" >&2; exit 2) && echo " Ok" \
|
||||
&& rm dist/@tmp-shared_internals.inc
|
||||
@ -329,7 +329,7 @@ dist/mdbx.h++: mdbx.h++ src/version.c $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
dist/@tmp-shared_internals.inc: src/version.c $(ALLOY_DEPS) $(lastword $(MAKEFILE_LIST))
|
||||
mkdir -p dist \
|
||||
&& echo '#define MDBX_ALLOY 1' > dist/@tmp-sed.inc && echo '#define MDBX_BUILD_SOURCERY $(MDBX_BUILD_SOURCERY)' >> dist/@tmp-sed.inc \
|
||||
&& echo '#define xMDBX_ALLOY 1' > dist/@tmp-sed.inc && echo '#define MDBX_BUILD_SOURCERY $(MDBX_BUILD_SOURCERY)' >> dist/@tmp-sed.inc \
|
||||
&& sed \
|
||||
-e '/#pragma once/r dist/@tmp-sed.inc' \
|
||||
-e 's|#include "../mdbx.h"|@INCLUDE "mdbx.h"|' \
|
||||
@ -355,7 +355,7 @@ dist/$(1).c: src/$(1).c src/wingetopt.h src/wingetopt.c \
|
||||
-e '/#include "internals.h"/r dist/@tmp-shared_internals.inc' \
|
||||
-e '/#include "wingetopt.h"/r src/wingetopt.c' \
|
||||
src/$(1).c \
|
||||
| grep -v -e '#include "' -e '#pragma once' -e '#define MDBX_ALLOY' \
|
||||
| grep -v -e '#include "' -e '#pragma once' -e '#define xMDBX_ALLOY' \
|
||||
| sed 's|@INCLUDE|#include|' > $$@
|
||||
|
||||
endef
|
||||
|
@ -11,7 +11,7 @@
|
||||
* top-level directory of the distribution or, alternatively, at
|
||||
* <http://www.OpenLDAP.org/license.html>. */
|
||||
|
||||
#define MDBX_ALLOY 1 /* alloyed build */
|
||||
#define xMDBX_ALLOY 1 /* alloyed build */
|
||||
#include "internals.h" /* must be included first */
|
||||
|
||||
#include "core.c"
|
||||
|
40
src/core.c
40
src/core.c
@ -936,7 +936,7 @@ static __always_inline uint32_t atomic_add32(MDBX_atomic_uint32_t *p,
|
||||
#define atomic_sub32(p, v) atomic_add32(p, 0 - (v))
|
||||
|
||||
static __always_inline uint64_t safe64_txnid_next(uint64_t txnid) {
|
||||
txnid += MDBX_TXNID_STEP;
|
||||
txnid += xMDBX_TXNID_STEP;
|
||||
#if !MDBX_64BIT_CAS
|
||||
/* avoid overflow of low-part in safe64_reset() */
|
||||
txnid += (UINT32_MAX == (uint32_t)txnid);
|
||||
@ -948,8 +948,8 @@ static __always_inline void safe64_reset(MDBX_atomic_uint64_t *p,
|
||||
bool single_writer) {
|
||||
#if !MDBX_64BIT_CAS
|
||||
if (!single_writer) {
|
||||
STATIC_ASSERT(MDBX_TXNID_STEP > 1);
|
||||
/* it is safe to increment low-part to avoid ABA, since MDBX_TXNID_STEP > 1
|
||||
STATIC_ASSERT(xMDBX_TXNID_STEP > 1);
|
||||
/* it is safe to increment low-part to avoid ABA, since xMDBX_TXNID_STEP > 1
|
||||
* and overflow was preserved in safe64_txnid_next() */
|
||||
atomic_add32(&p->low, 1) /* avoid ABA in safe64_reset_compare() */;
|
||||
atomic_store32(
|
||||
@ -5107,16 +5107,16 @@ static unsigned spill_prio(const MDBX_txn *txn, const unsigned i,
|
||||
* the child aborted. */
|
||||
static int mdbx_txn_spill(MDBX_txn *const txn, MDBX_cursor *const m0,
|
||||
const unsigned need) {
|
||||
#if MDBX_DEBUG_SPILLING != 1
|
||||
#if xMDBX_DEBUG_SPILLING != 1
|
||||
/* production mode */
|
||||
if (likely(txn->tw.dirtyroom + txn->tw.loose_count >= need))
|
||||
return MDBX_SUCCESS;
|
||||
unsigned wanna_spill = need - txn->tw.dirtyroom;
|
||||
#else
|
||||
/* debug mode: spill at least one page if MDBX_DEBUG_SPILLING == 1 */
|
||||
/* debug mode: spill at least one page if xMDBX_DEBUG_SPILLING == 1 */
|
||||
unsigned wanna_spill =
|
||||
(need > txn->tw.dirtyroom) ? need - txn->tw.dirtyroom : 1;
|
||||
#endif /* MDBX_DEBUG_SPILLING */
|
||||
#endif /* xMDBX_DEBUG_SPILLING */
|
||||
|
||||
const unsigned dirty = txn->tw.dirtylist->length;
|
||||
const unsigned spill_min =
|
||||
@ -5194,10 +5194,10 @@ static int mdbx_txn_spill(MDBX_txn *const txn, MDBX_cursor *const m0,
|
||||
/* Preserve pages which may soon be dirtied again */
|
||||
const unsigned unspillable = mdbx_txn_keep(txn, m0);
|
||||
if (unspillable + txn->tw.loose_count >= dl->length) {
|
||||
#if MDBX_DEBUG_SPILLING == 1 /* avoid false failure in debug mode */
|
||||
#if xMDBX_DEBUG_SPILLING == 1 /* avoid false failure in debug mode */
|
||||
if (likely(txn->tw.dirtyroom + txn->tw.loose_count >= need))
|
||||
return MDBX_SUCCESS;
|
||||
#endif /* MDBX_DEBUG_SPILLING */
|
||||
#endif /* xMDBX_DEBUG_SPILLING */
|
||||
mdbx_error("all %u dirty pages are unspillable since referenced "
|
||||
"by a cursor(s), use fewer cursors or increase "
|
||||
"MDBX_opt_txn_dp_limit",
|
||||
@ -5353,7 +5353,7 @@ static int mdbx_txn_spill(MDBX_txn *const txn, MDBX_cursor *const m0,
|
||||
}
|
||||
}
|
||||
|
||||
#if MDBX_DEBUG_SPILLING == 2
|
||||
#if xMDBX_DEBUG_SPILLING == 2
|
||||
if (txn->tw.loose_count + txn->tw.dirtyroom <= need / 2 + 1)
|
||||
mdbx_error("dirty-list length: before %u, after %u, parent %i, loose %u; "
|
||||
"needed %u, spillable %u; "
|
||||
@ -5365,7 +5365,7 @@ static int mdbx_txn_spill(MDBX_txn *const txn, MDBX_cursor *const m0,
|
||||
txn->tw.loose_count, need, spillable, spilled,
|
||||
txn->tw.dirtyroom);
|
||||
mdbx_ensure(txn->mt_env, txn->tw.loose_count + txn->tw.dirtyroom > need / 2);
|
||||
#endif /* MDBX_DEBUG_SPILLING */
|
||||
#endif /* xMDBX_DEBUG_SPILLING */
|
||||
|
||||
return likely(txn->tw.loose_count + txn->tw.dirtyroom > need / 2)
|
||||
? MDBX_SUCCESS
|
||||
@ -5385,7 +5385,7 @@ static int mdbx_cursor_spill(MDBX_cursor *mc, const MDBX_val *key,
|
||||
if (mc->mc_dbi > MAIN_DBI)
|
||||
need += txn->mt_dbs[MAIN_DBI].md_depth + 3;
|
||||
}
|
||||
#if MDBX_DEBUG_SPILLING != 2
|
||||
#if xMDBX_DEBUG_SPILLING != 2
|
||||
/* production mode */
|
||||
/* 4) Double the page chain estimation
|
||||
* for extensively splitting, rebalance and merging */
|
||||
@ -5398,7 +5398,7 @@ static int mdbx_cursor_spill(MDBX_cursor *mc, const MDBX_val *key,
|
||||
(void)data;
|
||||
mc->mc_txn->mt_env->debug_dirtied_est = ++need;
|
||||
mc->mc_txn->mt_env->debug_dirtied_act = 0;
|
||||
#endif /* MDBX_DEBUG_SPILLING == 2 */
|
||||
#endif /* xMDBX_DEBUG_SPILLING == 2 */
|
||||
|
||||
return mdbx_txn_spill(txn, mc, need);
|
||||
}
|
||||
@ -5695,12 +5695,12 @@ static __cold pgno_t mdbx_find_largest(MDBX_env *env, pgno_t largest) {
|
||||
/* Add a page to the txn's dirty list */
|
||||
static int __must_check_result mdbx_page_dirty(MDBX_txn *txn, MDBX_page *mp,
|
||||
unsigned npages) {
|
||||
#if MDBX_DEBUG_SPILLING == 2
|
||||
#if xMDBX_DEBUG_SPILLING == 2
|
||||
txn->mt_env->debug_dirtied_act += 1;
|
||||
mdbx_ensure(txn->mt_env,
|
||||
txn->mt_env->debug_dirtied_act < txn->mt_env->debug_dirtied_est);
|
||||
mdbx_ensure(txn->mt_env, txn->tw.dirtyroom + txn->tw.loose_count > 0);
|
||||
#endif /* MDBX_DEBUG_SPILLING == 2 */
|
||||
#endif /* xMDBX_DEBUG_SPILLING == 2 */
|
||||
|
||||
int rc;
|
||||
mp->mp_txnid = txn->mt_front;
|
||||
@ -6574,7 +6574,7 @@ no_loose:
|
||||
continue;
|
||||
/* it is reasonable check/kick lagging reader(s) here,
|
||||
* since we made a new steady point or wipe the last. */
|
||||
if (oldest < txn->mt_txnid - MDBX_TXNID_STEP &&
|
||||
if (oldest < txn->mt_txnid - xMDBX_TXNID_STEP &&
|
||||
mdbx_kick_longlived_readers(env, oldest) > oldest)
|
||||
continue;
|
||||
} else if (unlikely(ret.err != MDBX_RESULT_TRUE))
|
||||
@ -6586,7 +6586,7 @@ no_loose:
|
||||
* at the end of database file. */
|
||||
if ((flags & MDBX_ALLOC_NEW) && next <= txn->mt_end_pgno)
|
||||
goto done;
|
||||
if ((flags & MDBX_ALLOC_GC) && oldest < txn->mt_txnid - MDBX_TXNID_STEP &&
|
||||
if ((flags & MDBX_ALLOC_GC) && oldest < txn->mt_txnid - xMDBX_TXNID_STEP &&
|
||||
mdbx_kick_longlived_readers(env, oldest) > oldest)
|
||||
continue;
|
||||
|
||||
@ -19063,7 +19063,7 @@ __cold int mdbx_env_info_ex(const MDBX_env *env, const MDBX_txn *txn,
|
||||
|
||||
const txnid_t wanna_meta_txnid = (txn->mt_flags & MDBX_TXN_RDONLY)
|
||||
? txn->mt_txnid
|
||||
: txn->mt_txnid - MDBX_TXNID_STEP;
|
||||
: txn->mt_txnid - xMDBX_TXNID_STEP;
|
||||
txn_meta = (arg->mi_meta0_txnid == wanna_meta_txnid) ? meta0 : txn_meta;
|
||||
txn_meta = (arg->mi_meta1_txnid == wanna_meta_txnid) ? meta1 : txn_meta;
|
||||
txn_meta = (arg->mi_meta2_txnid == wanna_meta_txnid) ? meta2 : txn_meta;
|
||||
@ -19781,7 +19781,7 @@ __cold int mdbx_reader_list(const MDBX_env *env, MDBX_reader_list_func *func,
|
||||
head_txnid != mdbx_meta_txnid_fluid(env, recent_meta))
|
||||
goto retry_header;
|
||||
|
||||
lag = (head_txnid - txnid) / MDBX_TXNID_STEP;
|
||||
lag = (head_txnid - txnid) / xMDBX_TXNID_STEP;
|
||||
bytes_used = pgno2bytes(env, pages_used);
|
||||
bytes_retained = (head_pages_retired > reader_pages_retired)
|
||||
? pgno2bytes(env, (pgno_t)(head_pages_retired -
|
||||
@ -20032,7 +20032,7 @@ static txnid_t __cold mdbx_kick_longlived_readers(MDBX_env *env,
|
||||
|
||||
const MDBX_meta *head_meta = mdbx_meta_head(env);
|
||||
const txnid_t gap =
|
||||
(mdbx_meta_txnid_stable(env, head_meta) - laggard) / MDBX_TXNID_STEP;
|
||||
(mdbx_meta_txnid_stable(env, head_meta) - laggard) / xMDBX_TXNID_STEP;
|
||||
const uint64_t head_retired =
|
||||
unaligned_peek_u64(4, head_meta->mm_pages_retired);
|
||||
const size_t space =
|
||||
@ -20119,7 +20119,7 @@ int mdbx_txn_straggler(const MDBX_txn *txn, int *percent)
|
||||
}
|
||||
} while (unlikely(recent != mdbx_meta_txnid_fluid(env, meta)));
|
||||
|
||||
txnid_t lag = (recent - txn->mt_txnid) / MDBX_TXNID_STEP;
|
||||
txnid_t lag = (recent - txn->mt_txnid) / xMDBX_TXNID_STEP;
|
||||
return (lag > INT_MAX) ? INT_MAX : (int)lag;
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
||||
#endif
|
||||
|
||||
#define LIBMDBX_INTERNALS
|
||||
#ifdef MDBX_TOOLS
|
||||
#ifdef xMDBX_TOOLS
|
||||
#define MDBX_DEPRECATED
|
||||
#endif /* MDBX_TOOLS */
|
||||
#endif /* xMDBX_TOOLS */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
/* clang-format off */
|
||||
@ -38,7 +38,7 @@
|
||||
# undef NDEBUG
|
||||
#endif
|
||||
|
||||
#ifdef MDBX_ALLOY
|
||||
#ifdef xMDBX_ALLOY
|
||||
/* Amalgamated build */
|
||||
# define MDBX_INTERNAL_FUNC static
|
||||
# define MDBX_INTERNAL_VAR static
|
||||
@ -46,7 +46,7 @@
|
||||
/* Non-amalgamated build */
|
||||
# define MDBX_INTERNAL_FUNC
|
||||
# define MDBX_INTERNAL_VAR extern
|
||||
#endif /* MDBX_ALLOY */
|
||||
#endif /* xMDBX_ALLOY */
|
||||
|
||||
#ifndef MDBX_DISABLE_GNU_SOURCE
|
||||
#define MDBX_DISABLE_GNU_SOURCE 0
|
||||
@ -177,7 +177,7 @@ extern "C" {
|
||||
#include "osal.h"
|
||||
|
||||
#define mdbx_sourcery_anchor XCONCAT(mdbx_sourcery_, MDBX_BUILD_SOURCERY)
|
||||
#if defined(MDBX_TOOLS)
|
||||
#if defined(xMDBX_TOOLS)
|
||||
extern LIBMDBX_API const char *const mdbx_sourcery_anchor;
|
||||
#endif
|
||||
|
||||
@ -417,14 +417,14 @@ typedef MDBX_atomic_uint64_t atomic_txnid_t;
|
||||
#define INITIAL_TXNID (MIN_TXNID + NUM_METAS - 1)
|
||||
#define INVALID_TXNID UINT64_MAX
|
||||
/* LY: for testing non-atomic 64-bit txnid on 32-bit arches.
|
||||
* #define MDBX_TXNID_STEP (UINT32_MAX / 3) */
|
||||
#ifndef MDBX_TXNID_STEP
|
||||
* #define xMDBX_TXNID_STEP (UINT32_MAX / 3) */
|
||||
#ifndef xMDBX_TXNID_STEP
|
||||
#if MDBX_64BIT_CAS
|
||||
#define MDBX_TXNID_STEP 1u
|
||||
#define xMDBX_TXNID_STEP 1u
|
||||
#else
|
||||
#define MDBX_TXNID_STEP 2u
|
||||
#define xMDBX_TXNID_STEP 2u
|
||||
#endif
|
||||
#endif /* MDBX_TXNID_STEP */
|
||||
#endif /* xMDBX_TXNID_STEP */
|
||||
|
||||
/* Used for offsets within a single page.
|
||||
* Since memory pages are typically 4 or 8KB in size, 12-13 bits,
|
||||
@ -1226,12 +1226,12 @@ struct MDBX_env {
|
||||
pgno_t me_poison_edge;
|
||||
#endif /* MDBX_USE_VALGRIND || __SANITIZE_ADDRESS__ */
|
||||
|
||||
#ifndef MDBX_DEBUG_SPILLING
|
||||
#define MDBX_DEBUG_SPILLING 0
|
||||
#ifndef xMDBX_DEBUG_SPILLING
|
||||
#define xMDBX_DEBUG_SPILLING 0
|
||||
#endif
|
||||
#if MDBX_DEBUG_SPILLING == 2
|
||||
#if xMDBX_DEBUG_SPILLING == 2
|
||||
unsigned debug_dirtied_est, debug_dirtied_act;
|
||||
#endif /* MDBX_DEBUG_SPILLING */
|
||||
#endif /* xMDBX_DEBUG_SPILLING */
|
||||
|
||||
/* ------------------------------------------------- stub for lck-less mode */
|
||||
alignas(MDBX_CACHELINE_SIZE) uint64_t
|
||||
@ -1364,7 +1364,7 @@ void mdbx_assert_fail(const MDBX_env *env, const char *msg, const char *func,
|
||||
/* assert(3) variant in transaction context */
|
||||
#define mdbx_tassert(txn, expr) mdbx_assert((txn)->mt_env, expr)
|
||||
|
||||
#ifndef MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#ifndef xMDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#undef assert
|
||||
#define assert(expr) mdbx_assert(NULL, expr)
|
||||
#endif
|
||||
|
@ -24,10 +24,10 @@
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#ifndef MDBX_ALLOY
|
||||
#ifndef xMDBX_ALLOY
|
||||
uint32_t mdbx_linux_kernel_version;
|
||||
bool mdbx_RunningOnWSL1;
|
||||
#endif /* MDBX_ALLOY */
|
||||
#endif /* xMDBX_ALLOY */
|
||||
|
||||
static __cold uint8_t probe_for_WSL(const char *tag) {
|
||||
const char *const WSL = strstr(tag, "WSL");
|
||||
|
@ -757,7 +757,7 @@ static uint64_t WINAPI stub_GetTickCount64(void) {
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#ifndef MDBX_ALLOY
|
||||
#ifndef xMDBX_ALLOY
|
||||
MDBX_NtExtendSection mdbx_NtExtendSection;
|
||||
MDBX_GetFileInformationByHandleEx mdbx_GetFileInformationByHandleEx;
|
||||
MDBX_GetVolumeInformationByHandleW mdbx_GetVolumeInformationByHandleW;
|
||||
@ -772,7 +772,7 @@ MDBX_DiscardVirtualMemory mdbx_DiscardVirtualMemory;
|
||||
MDBX_OfferVirtualMemory mdbx_OfferVirtualMemory;
|
||||
MDBX_ReclaimVirtualMemory mdbx_ReclaimVirtualMemory;
|
||||
#endif /* unused for now */
|
||||
#endif /* MDBX_ALLOY */
|
||||
#endif /* xMDBX_ALLOY */
|
||||
|
||||
static void mdbx_winnt_import(void) {
|
||||
const HINSTANCE hNtdll = GetModuleHandleA("ntdll.dll");
|
||||
|
@ -20,7 +20,7 @@
|
||||
#pragma warning(disable : 4996) /* The POSIX name is deprecated... */
|
||||
#endif /* _MSC_VER (warnings) */
|
||||
|
||||
#define MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#define xMDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#include "internals.h"
|
||||
|
||||
typedef struct flagbit {
|
||||
|
@ -20,7 +20,7 @@
|
||||
#pragma warning(disable : 4996) /* The POSIX name is deprecated... */
|
||||
#endif /* _MSC_VER (warnings) */
|
||||
|
||||
#define MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#define xMDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#include "internals.h"
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
@ -22,7 +22,7 @@
|
||||
#pragma warning(disable : 4996) /* The POSIX name is deprecated... */
|
||||
#endif /* _MSC_VER (warnings) */
|
||||
|
||||
#define MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#define xMDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#include "internals.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
#pragma warning(disable : 4996) /* The POSIX name is deprecated... */
|
||||
#endif /* _MSC_VER (warnings) */
|
||||
|
||||
#define MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#define xMDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#include "internals.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
#pragma warning(disable : 4996) /* The POSIX name is deprecated... */
|
||||
#endif /* _MSC_VER (warnings) */
|
||||
|
||||
#define MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#define xMDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#include "internals.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
#pragma warning(disable : 4996) /* The POSIX name is deprecated... */
|
||||
#endif /* _MSC_VER (warnings) */
|
||||
|
||||
#define MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#define xMDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#include "internals.h"
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
@ -35,7 +35,7 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#if !defined(_NO_CRT_STDIO_INLINE) && MDBX_BUILD_SHARED_LIBRARY && \
|
||||
!defined(MDBX_TOOLS) && MDBX_WITHOUT_MSVC_CRT
|
||||
!defined(xMDBX_TOOLS) && MDBX_WITHOUT_MSVC_CRT
|
||||
#define _NO_CRT_STDIO_INLINE
|
||||
#endif
|
||||
#elif !defined(_POSIX_C_SOURCE)
|
||||
@ -155,7 +155,6 @@ __extern_C key_t ftok(const char *, int);
|
||||
#define HAVE_SYS_TYPES_H
|
||||
typedef HANDLE mdbx_thread_t;
|
||||
typedef unsigned mdbx_thread_key_t;
|
||||
#define MDBX_OSAL_SECTION HANDLE
|
||||
#define MAP_FAILED NULL
|
||||
#define HIGH_DWORD(v) ((DWORD)((sizeof(v) > 4) ? ((uint64_t)(v) >> 32) : 0))
|
||||
#define THREAD_CALL WINAPI
|
||||
@ -440,10 +439,8 @@ typedef struct mdbx_mmap_param {
|
||||
size_t limit; /* mapping length, but NOT a size of file nor DB */
|
||||
size_t current; /* mapped region size, i.e. the size of file and DB */
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
uint64_t filesize /* in-process cache of a file size. */;
|
||||
#endif
|
||||
#ifdef MDBX_OSAL_SECTION
|
||||
MDBX_OSAL_SECTION section;
|
||||
uint64_t filesize /* in-process cache of a file size */;
|
||||
HANDLE section; /* memory-mapped section handle */
|
||||
#endif
|
||||
} mdbx_mmap_t;
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
|
||||
#define MDBX_INTERNAL_FUNC
|
||||
#define MDBX_INTERNAL_VAR extern
|
||||
#define MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#define xMDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#include "../mdbx.h"
|
||||
#include "../src/defs.h"
|
||||
#include "../src/osal.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user