libmdbx 0.13.4.211 (2025-03-21T00:31:54+03:00)
One of the fastest compact embeddable key-value ACID storage engine without WAL.
 
Loading...
Searching...
No Matches
options.h
Go to the documentation of this file.
1
3
4/*******************************************************************************
5 *******************************************************************************
6 *
7 * BUILD TIME
8 *
9 * #### ##### ##### # #### # # ####
10 * # # # # # # # # ## # #
11 * # # # # # # # # # # # ####
12 * # # ##### # # # # # # # #
13 * # # # # # # # # ## # #
14 * #### # # # #### # # ####
15 *
16 *
17 */
18
19#pragma once
20
21#include "essentials.h"
22
26
28#define MDBX_OSX_WANNA_DURABILITY 0
30#define MDBX_OSX_WANNA_SPEED 1
31
32#ifndef MDBX_APPLE_SPEED_INSTEADOF_DURABILITY
35#define MDBX_APPLE_SPEED_INSTEADOF_DURABILITY MDBX_OSX_WANNA_DURABILITY
36#endif /* MDBX_APPLE_SPEED_INSTEADOF_DURABILITY */
37
39#ifndef MDBX_ENV_CHECKPID
40#if defined(MADV_DONTFORK) || defined(_WIN32) || defined(_WIN64)
41/* PID check could be omitted:
42 * - on Linux when madvise(MADV_DONTFORK) is available, i.e. after the fork()
43 * mapped pages will not be available for child process.
44 * - in Windows where fork() not available. */
45#define MDBX_ENV_CHECKPID 0
46#else
47#define MDBX_ENV_CHECKPID 1
48#endif
49#define MDBX_ENV_CHECKPID_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_ENV_CHECKPID)
50#elif !(MDBX_ENV_CHECKPID == 0 || MDBX_ENV_CHECKPID == 1)
51#error MDBX_ENV_CHECKPID must be defined as 0 or 1
52#else
53#define MDBX_ENV_CHECKPID_CONFIG MDBX_STRINGIFY(MDBX_ENV_CHECKPID)
54#endif /* MDBX_ENV_CHECKPID */
55
58#ifndef MDBX_TXN_CHECKOWNER
59#define MDBX_TXN_CHECKOWNER 1
60#define MDBX_TXN_CHECKOWNER_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_TXN_CHECKOWNER)
61#elif !(MDBX_TXN_CHECKOWNER == 0 || MDBX_TXN_CHECKOWNER == 1)
62#error MDBX_TXN_CHECKOWNER must be defined as 0 or 1
63#else
64#define MDBX_TXN_CHECKOWNER_CONFIG MDBX_STRINGIFY(MDBX_TXN_CHECKOWNER)
65#endif /* MDBX_TXN_CHECKOWNER */
66
68#ifndef MDBX_TRUST_RTC
69#if defined(__linux__) || defined(__gnu_linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
70#define MDBX_TRUST_RTC 0 /* a lot of embedded systems have a fake RTC */
71#else
72#define MDBX_TRUST_RTC 1
73#endif
74#define MDBX_TRUST_RTC_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_TRUST_RTC)
75#elif !(MDBX_TRUST_RTC == 0 || MDBX_TRUST_RTC == 1)
76#error MDBX_TRUST_RTC must be defined as 0 or 1
77#else
78#define MDBX_TRUST_RTC_CONFIG MDBX_STRINGIFY(MDBX_TRUST_RTC)
79#endif /* MDBX_TRUST_RTC */
80
82#ifndef MDBX_ENABLE_REFUND
83#define MDBX_ENABLE_REFUND 1
84#elif !(MDBX_ENABLE_REFUND == 0 || MDBX_ENABLE_REFUND == 1)
85#error MDBX_ENABLE_REFUND must be defined as 0 or 1
86#endif /* MDBX_ENABLE_REFUND */
87
89#ifndef MDBX_ENABLE_PROFGC
90#define MDBX_ENABLE_PROFGC 0
91#elif !(MDBX_ENABLE_PROFGC == 0 || MDBX_ENABLE_PROFGC == 1)
92#error MDBX_ENABLE_PROFGC must be defined as 0 or 1
93#endif /* MDBX_ENABLE_PROFGC */
94
96#ifndef MDBX_ENABLE_PGOP_STAT
97#define MDBX_ENABLE_PGOP_STAT 1
98#elif !(MDBX_ENABLE_PGOP_STAT == 0 || MDBX_ENABLE_PGOP_STAT == 1)
99#error MDBX_ENABLE_PGOP_STAT must be defined as 0 or 1
100#endif /* MDBX_ENABLE_PGOP_STAT */
101
104#ifndef MDBX_USE_MINCORE
105#if defined(MINCORE_INCORE) || !(defined(_WIN32) || defined(_WIN64))
106#define MDBX_USE_MINCORE 1
107#else
108#define MDBX_USE_MINCORE 0
109#endif
110#define MDBX_USE_MINCORE_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_MINCORE)
111#elif !(MDBX_USE_MINCORE == 0 || MDBX_USE_MINCORE == 1)
112#error MDBX_USE_MINCORE must be defined as 0 or 1
113#endif /* MDBX_USE_MINCORE */
114
117#ifndef MDBX_ENABLE_BIGFOOT
118#define MDBX_ENABLE_BIGFOOT 1
119#elif !(MDBX_ENABLE_BIGFOOT == 0 || MDBX_ENABLE_BIGFOOT == 1)
120#error MDBX_ENABLE_BIGFOOT must be defined as 0 or 1
121#endif /* MDBX_ENABLE_BIGFOOT */
122
125#ifndef MDBX_DISABLE_VALIDATION
126#define MDBX_DISABLE_VALIDATION 0
127#elif !(MDBX_DISABLE_VALIDATION == 0 || MDBX_DISABLE_VALIDATION == 1)
128#error MDBX_DISABLE_VALIDATION must be defined as 0 or 1
129#endif /* MDBX_DISABLE_VALIDATION */
130
131#ifndef MDBX_PNL_PREALLOC_FOR_RADIXSORT
132#define MDBX_PNL_PREALLOC_FOR_RADIXSORT 1
133#elif !(MDBX_PNL_PREALLOC_FOR_RADIXSORT == 0 || MDBX_PNL_PREALLOC_FOR_RADIXSORT == 1)
134#error MDBX_PNL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
135#endif /* MDBX_PNL_PREALLOC_FOR_RADIXSORT */
136
137#ifndef MDBX_DPL_PREALLOC_FOR_RADIXSORT
138#define MDBX_DPL_PREALLOC_FOR_RADIXSORT 1
139#elif !(MDBX_DPL_PREALLOC_FOR_RADIXSORT == 0 || MDBX_DPL_PREALLOC_FOR_RADIXSORT == 1)
140#error MDBX_DPL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
141#endif /* MDBX_DPL_PREALLOC_FOR_RADIXSORT */
142
154#ifndef MDBX_AVOID_MSYNC
155#if defined(_WIN32) || defined(_WIN64)
156#define MDBX_AVOID_MSYNC 1
157#else
158#define MDBX_AVOID_MSYNC 0
159#endif
160#elif !(MDBX_AVOID_MSYNC == 0 || MDBX_AVOID_MSYNC == 1)
161#error MDBX_AVOID_MSYNC must be defined as 0 or 1
162#endif /* MDBX_AVOID_MSYNC */
163
166#ifndef MDBX_ENABLE_DBI_SPARSE
167#define MDBX_ENABLE_DBI_SPARSE 1
168#elif !(MDBX_ENABLE_DBI_SPARSE == 0 || MDBX_ENABLE_DBI_SPARSE == 1)
169#error MDBX_ENABLE_DBI_SPARSE must be defined as 0 or 1
170#endif /* MDBX_ENABLE_DBI_SPARSE */
171
174#ifndef MDBX_ENABLE_DBI_LOCKFREE
175#define MDBX_ENABLE_DBI_LOCKFREE 1
176#elif !(MDBX_ENABLE_DBI_LOCKFREE == 0 || MDBX_ENABLE_DBI_LOCKFREE == 1)
177#error MDBX_ENABLE_DBI_LOCKFREE must be defined as 0 or 1
178#endif /* MDBX_ENABLE_DBI_LOCKFREE */
179
184#ifndef MDBX_PNL_ASCENDING
185#define MDBX_PNL_ASCENDING 0
186#elif !(MDBX_PNL_ASCENDING == 0 || MDBX_PNL_ASCENDING == 1)
187#error MDBX_PNL_ASCENDING must be defined as 0 or 1
188#endif /* MDBX_PNL_ASCENDING */
189
191#ifndef MDBX_WITHOUT_MSVC_CRT
192#if defined(MDBX_BUILD_CXX) && !MDBX_BUILD_CXX
193#define MDBX_WITHOUT_MSVC_CRT 1
194#else
195#define MDBX_WITHOUT_MSVC_CRT 0
196#endif
197#elif !(MDBX_WITHOUT_MSVC_CRT == 0 || MDBX_WITHOUT_MSVC_CRT == 1)
198#error MDBX_WITHOUT_MSVC_CRT must be defined as 0 or 1
199#endif /* MDBX_WITHOUT_MSVC_CRT */
200
202#ifndef MDBX_ENVCOPY_WRITEBUF
203#define MDBX_ENVCOPY_WRITEBUF 1048576u
204#elif MDBX_ENVCOPY_WRITEBUF < 65536u || MDBX_ENVCOPY_WRITEBUF > 1073741824u || MDBX_ENVCOPY_WRITEBUF % 65536u
205#error MDBX_ENVCOPY_WRITEBUF must be defined in range 65536..1073741824 and be multiple of 65536
206#endif /* MDBX_ENVCOPY_WRITEBUF */
207
209#ifndef MDBX_FORCE_ASSERTIONS
210#define MDBX_FORCE_ASSERTIONS 0
211#elif !(MDBX_FORCE_ASSERTIONS == 0 || MDBX_FORCE_ASSERTIONS == 1)
212#error MDBX_FORCE_ASSERTIONS must be defined as 0 or 1
213#endif /* MDBX_FORCE_ASSERTIONS */
214
217#ifndef MDBX_ASSUME_MALLOC_OVERHEAD
218#ifdef __SIZEOF_POINTER__
219#define MDBX_ASSUME_MALLOC_OVERHEAD (__SIZEOF_POINTER__ * 2u)
220#else
221#define MDBX_ASSUME_MALLOC_OVERHEAD (sizeof(void *) * 2u)
222#endif
223#elif MDBX_ASSUME_MALLOC_OVERHEAD < 0 || MDBX_ASSUME_MALLOC_OVERHEAD > 64 || MDBX_ASSUME_MALLOC_OVERHEAD % 4
224#error MDBX_ASSUME_MALLOC_OVERHEAD must be defined in range 0..64 and be multiple of 4
225#endif /* MDBX_ASSUME_MALLOC_OVERHEAD */
226
229#ifndef ENABLE_MEMCHECK
230#endif /* ENABLE_MEMCHECK */
231
234#ifndef MDBX_HAVE_C11ATOMICS
235#endif /* MDBX_HAVE_C11ATOMICS */
236
243#ifndef MDBX_HAVE_BUILTIN_CPU_SUPPORTS
244#if defined(__APPLE__) || defined(BIONIC)
245/* Never use any modern features on Apple's or Google's OSes
246 * since a lot of troubles with compatibility and/or performance */
247#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
248#elif defined(__e2k__)
249#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
250#elif __has_builtin(__builtin_cpu_supports) || defined(__BUILTIN_CPU_SUPPORTS__) || \
251 (defined(__ia32__) && __GNUC_PREREQ(4, 8) && __GLIBC_PREREQ(2, 23))
252#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 1
253#else
254#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
255#endif
256#elif !(MDBX_HAVE_BUILTIN_CPU_SUPPORTS == 0 || MDBX_HAVE_BUILTIN_CPU_SUPPORTS == 1)
257#error MDBX_HAVE_BUILTIN_CPU_SUPPORTS must be defined as 0 or 1
258#endif /* MDBX_HAVE_BUILTIN_CPU_SUPPORTS */
259
262#ifndef MDBX_NOSUCCESS_PURE_COMMIT
263#define MDBX_NOSUCCESS_PURE_COMMIT 0
264#elif !(MDBX_NOSUCCESS_PURE_COMMIT == 0 || MDBX_NOSUCCESS_PURE_COMMIT == 1)
265#error MDBX_NOSUCCESS_PURE_COMMIT must be defined as 0 or 1
266#endif /* MDBX_NOSUCCESS_PURE_COMMIT */
267
270#ifndef MDBX_ENABLE_NON_READONLY_EXPORT
271#define MDBX_ENABLE_NON_READONLY_EXPORT 0
272#elif !(MDBX_ENABLE_NON_READONLY_EXPORT == 0 || MDBX_ENABLE_NON_READONLY_EXPORT == 1)
273#error MDBX_ENABLE_NON_READONLY_EXPORT must be defined as 0 or 1
274#endif /* MDBX_ENABLE_NON_READONLY_EXPORT */
275
276//------------------------------------------------------------------------------
277
279#define MDBX_LOCKING_WIN32FILES -1
280
282#define MDBX_LOCKING_SYSV 5
283
285#define MDBX_LOCKING_POSIX1988 1988
286
288#define MDBX_LOCKING_POSIX2001 2001
289
291#define MDBX_LOCKING_POSIX2008 2008
292
294#if defined(_WIN32) || defined(_WIN64)
295#define MDBX_LOCKING MDBX_LOCKING_WIN32FILES
296#else
297#ifndef MDBX_LOCKING
298#if defined(_POSIX_THREAD_PROCESS_SHARED) && _POSIX_THREAD_PROCESS_SHARED >= 200112L && !defined(__FreeBSD__)
299
300/* Some platforms define the EOWNERDEAD error code even though they
301 * don't support Robust Mutexes. If doubt compile with -MDBX_LOCKING=2001. */
302#if defined(EOWNERDEAD) && _POSIX_THREAD_PROCESS_SHARED >= 200809L && \
303 ((defined(_POSIX_THREAD_ROBUST_PRIO_INHERIT) && _POSIX_THREAD_ROBUST_PRIO_INHERIT > 0) || \
304 (defined(_POSIX_THREAD_ROBUST_PRIO_PROTECT) && _POSIX_THREAD_ROBUST_PRIO_PROTECT > 0) || \
305 defined(PTHREAD_MUTEX_ROBUST) || defined(PTHREAD_MUTEX_ROBUST_NP)) && \
306 (!defined(__GLIBC__) || __GLIBC_PREREQ(2, 10) /* troubles with Robust mutexes before 2.10 */)
307#define MDBX_LOCKING MDBX_LOCKING_POSIX2008
308#else
309#define MDBX_LOCKING MDBX_LOCKING_POSIX2001
310#endif
311#elif defined(__sun) || defined(__SVR4) || defined(__svr4__)
312#define MDBX_LOCKING MDBX_LOCKING_POSIX1988
313#else
314#define MDBX_LOCKING MDBX_LOCKING_SYSV
315#endif
316#define MDBX_LOCKING_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_LOCKING)
317#else
318#define MDBX_LOCKING_CONFIG MDBX_STRINGIFY(MDBX_LOCKING)
319#endif /* MDBX_LOCKING */
320#endif /* !Windows */
321
323#ifndef MDBX_USE_OFDLOCKS
324#if ((defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK)) || \
325 (defined(F_OFD_SETLK64) && defined(F_OFD_SETLKW64) && defined(F_OFD_GETLK64))) && \
326 !defined(MDBX_SAFE4QEMU) && !defined(__sun) /* OFD-lock are broken on Solaris */
327#define MDBX_USE_OFDLOCKS 1
328#else
329#define MDBX_USE_OFDLOCKS 0
330#endif
331#define MDBX_USE_OFDLOCKS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
332#elif !(MDBX_USE_OFDLOCKS == 0 || MDBX_USE_OFDLOCKS == 1)
333#error MDBX_USE_OFDLOCKS must be defined as 0 or 1
334#else
335#define MDBX_USE_OFDLOCKS_CONFIG MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
336#endif /* MDBX_USE_OFDLOCKS */
337
339#ifndef MDBX_USE_SENDFILE
340#if ((defined(__linux__) || defined(__gnu_linux__)) && !defined(__ANDROID_API__)) || \
341 (defined(__ANDROID_API__) && __ANDROID_API__ >= 21)
342#define MDBX_USE_SENDFILE 1
343#else
344#define MDBX_USE_SENDFILE 0
345#endif
346#elif !(MDBX_USE_SENDFILE == 0 || MDBX_USE_SENDFILE == 1)
347#error MDBX_USE_SENDFILE must be defined as 0 or 1
348#endif /* MDBX_USE_SENDFILE */
349
351#ifndef MDBX_USE_COPYFILERANGE
352#if __GLIBC_PREREQ(2, 27) && defined(_GNU_SOURCE)
353#define MDBX_USE_COPYFILERANGE 1
354#else
355#define MDBX_USE_COPYFILERANGE 0
356#endif
357#elif !(MDBX_USE_COPYFILERANGE == 0 || MDBX_USE_COPYFILERANGE == 1)
358#error MDBX_USE_COPYFILERANGE must be defined as 0 or 1
359#endif /* MDBX_USE_COPYFILERANGE */
360
361//------------------------------------------------------------------------------
362
363#ifndef MDBX_CPU_WRITEBACK_INCOHERENT
364#if defined(__ia32__) || defined(__e2k__) || defined(__hppa) || defined(__hppa__) || defined(DOXYGEN)
365#define MDBX_CPU_WRITEBACK_INCOHERENT 0
366#else
367#define MDBX_CPU_WRITEBACK_INCOHERENT 1
368#endif
369#elif !(MDBX_CPU_WRITEBACK_INCOHERENT == 0 || MDBX_CPU_WRITEBACK_INCOHERENT == 1)
370#error MDBX_CPU_WRITEBACK_INCOHERENT must be defined as 0 or 1
371#endif /* MDBX_CPU_WRITEBACK_INCOHERENT */
372
373#ifndef MDBX_MMAP_INCOHERENT_FILE_WRITE
374#ifdef __OpenBSD__
375#define MDBX_MMAP_INCOHERENT_FILE_WRITE 1
376#else
377#define MDBX_MMAP_INCOHERENT_FILE_WRITE 0
378#endif
379#elif !(MDBX_MMAP_INCOHERENT_FILE_WRITE == 0 || MDBX_MMAP_INCOHERENT_FILE_WRITE == 1)
380#error MDBX_MMAP_INCOHERENT_FILE_WRITE must be defined as 0 or 1
381#endif /* MDBX_MMAP_INCOHERENT_FILE_WRITE */
382
383#ifndef MDBX_MMAP_INCOHERENT_CPU_CACHE
384#if defined(__mips) || defined(__mips__) || defined(__mips64) || defined(__mips64__) || defined(_M_MRX000) || \
385 defined(_MIPS_) || defined(__MWERKS__) || defined(__sgi)
386/* MIPS has cache coherency issues. */
387#define MDBX_MMAP_INCOHERENT_CPU_CACHE 1
388#else
389/* LY: assume no relevant mmap/dcache issues. */
390#define MDBX_MMAP_INCOHERENT_CPU_CACHE 0
391#endif
392#elif !(MDBX_MMAP_INCOHERENT_CPU_CACHE == 0 || MDBX_MMAP_INCOHERENT_CPU_CACHE == 1)
393#error MDBX_MMAP_INCOHERENT_CPU_CACHE must be defined as 0 or 1
394#endif /* MDBX_MMAP_INCOHERENT_CPU_CACHE */
395
398#ifndef MDBX_MMAP_NEEDS_JOLT
399#if MDBX_MMAP_INCOHERENT_FILE_WRITE || MDBX_MMAP_INCOHERENT_CPU_CACHE || !(defined(__linux__) || defined(__gnu_linux__))
400#define MDBX_MMAP_NEEDS_JOLT 1
401#else
402#define MDBX_MMAP_NEEDS_JOLT 0
403#endif
404#define MDBX_MMAP_NEEDS_JOLT_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_MMAP_NEEDS_JOLT)
405#elif !(MDBX_MMAP_NEEDS_JOLT == 0 || MDBX_MMAP_NEEDS_JOLT == 1)
406#error MDBX_MMAP_NEEDS_JOLT must be defined as 0 or 1
407#endif /* MDBX_MMAP_NEEDS_JOLT */
408
409#ifndef MDBX_64BIT_ATOMIC
410#if MDBX_WORDBITS >= 64 || defined(DOXYGEN)
411#define MDBX_64BIT_ATOMIC 1
412#else
413#define MDBX_64BIT_ATOMIC 0
414#endif
415#define MDBX_64BIT_ATOMIC_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
416#elif !(MDBX_64BIT_ATOMIC == 0 || MDBX_64BIT_ATOMIC == 1)
417#error MDBX_64BIT_ATOMIC must be defined as 0 or 1
418#else
419#define MDBX_64BIT_ATOMIC_CONFIG MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
420#endif /* MDBX_64BIT_ATOMIC */
421
422#ifndef MDBX_64BIT_CAS
423#if defined(__GCC_ATOMIC_LLONG_LOCK_FREE)
424#if __GCC_ATOMIC_LLONG_LOCK_FREE > 1
425#define MDBX_64BIT_CAS 1
426#else
427#define MDBX_64BIT_CAS 0
428#endif
429#elif defined(__CLANG_ATOMIC_LLONG_LOCK_FREE)
430#if __CLANG_ATOMIC_LLONG_LOCK_FREE > 1
431#define MDBX_64BIT_CAS 1
432#else
433#define MDBX_64BIT_CAS 0
434#endif
435#elif defined(ATOMIC_LLONG_LOCK_FREE)
436#if ATOMIC_LLONG_LOCK_FREE > 1
437#define MDBX_64BIT_CAS 1
438#else
439#define MDBX_64BIT_CAS 0
440#endif
441#elif defined(_MSC_VER) || defined(__APPLE__) || defined(DOXYGEN)
442#define MDBX_64BIT_CAS 1
443#elif !(MDBX_64BIT_CAS == 0 || MDBX_64BIT_CAS == 1)
444#error MDBX_64BIT_CAS must be defined as 0 or 1
445#else
446#define MDBX_64BIT_CAS MDBX_64BIT_ATOMIC
447#endif
448#define MDBX_64BIT_CAS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_CAS)
449#else
450#define MDBX_64BIT_CAS_CONFIG MDBX_STRINGIFY(MDBX_64BIT_CAS)
451#endif /* MDBX_64BIT_CAS */
452
453#ifndef MDBX_UNALIGNED_OK
454#if defined(__ALIGNED__) || defined(__SANITIZE_UNDEFINED__) || defined(ENABLE_UBSAN)
455#define MDBX_UNALIGNED_OK 0 /* no unaligned access allowed */
456#elif defined(__ARM_FEATURE_UNALIGNED)
457#define MDBX_UNALIGNED_OK 4 /* ok unaligned for 32-bit words */
458#elif defined(__e2k__) || defined(__elbrus__)
459#if __iset__ > 4
460#define MDBX_UNALIGNED_OK 8 /* ok unaligned for 64-bit words */
461#else
462#define MDBX_UNALIGNED_OK 4 /* ok unaligned for 32-bit words */
463#endif
464#elif defined(__ia32__)
465#define MDBX_UNALIGNED_OK 8 /* ok unaligned for 64-bit words */
466#elif __CLANG_PREREQ(5, 0) || __GNUC_PREREQ(5, 0)
467/* expecting an optimization will well done, also this
468 * hushes false-positives from UBSAN (undefined behaviour sanitizer) */
469#define MDBX_UNALIGNED_OK 0
470#else
471#define MDBX_UNALIGNED_OK 0 /* no unaligned access allowed */
472#endif
473#elif MDBX_UNALIGNED_OK == 1
474#undef MDBX_UNALIGNED_OK
475#define MDBX_UNALIGNED_OK 32 /* any unaligned access allowed */
476#endif /* MDBX_UNALIGNED_OK */
477
478#ifndef MDBX_CACHELINE_SIZE
479#if defined(SYSTEM_CACHE_ALIGNMENT_SIZE)
480#define MDBX_CACHELINE_SIZE SYSTEM_CACHE_ALIGNMENT_SIZE
481#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
482#define MDBX_CACHELINE_SIZE 128
483#else
484#define MDBX_CACHELINE_SIZE 64
485#endif
486#endif /* MDBX_CACHELINE_SIZE */
487
488/* Max length of iov-vector passed to writev() call, used for auxilary writes */
489#ifndef MDBX_AUXILARY_IOV_MAX
490#define MDBX_AUXILARY_IOV_MAX 64
491#endif
492#if defined(IOV_MAX) && IOV_MAX < MDBX_AUXILARY_IOV_MAX
493#undef MDBX_AUXILARY_IOV_MAX
494#define MDBX_AUXILARY_IOV_MAX IOV_MAX
495#endif /* MDBX_AUXILARY_IOV_MAX */
496
497/* An extra/custom information provided during library build */
498#ifndef MDBX_BUILD_METADATA
499#define MDBX_BUILD_METADATA ""
500#endif /* MDBX_BUILD_METADATA */
502/*******************************************************************************
503 *******************************************************************************
504 ******************************************************************************/
505
506#ifndef DOXYGEN
507
508/* In case the MDBX_DEBUG is undefined set it corresponding to NDEBUG */
509#ifndef MDBX_DEBUG
510#ifdef NDEBUG
511#define MDBX_DEBUG 0
512#else
513#define MDBX_DEBUG 1
514#endif
515#endif
516#if MDBX_DEBUG < 0 || MDBX_DEBUG > 2
517#error "The MDBX_DEBUG must be defined to 0, 1 or 2"
518#endif /* MDBX_DEBUG */
519
520#else
521
522/* !!! Actually this is a fake definitions for Doxygen !!! */
523
537#define MDBX_DEBUG 0...2
538
540#define MDBX_DISABLE_GNU_SOURCE 0 or 1
541
542#endif /* DOXYGEN */