libmdbx
0.14.2.492 (2026-07-31T22:58:19+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) || IS_WINDOWS
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
103
#ifndef MDBX_ENABLE_PGET_STAT
104
#define MDBX_ENABLE_PGET_STAT 1
105
#elif !(MDBX_ENABLE_PGET_STAT == 0 || MDBX_ENABLE_PGET_STAT == 1)
106
#error MDBX_ENABLE_PGET_STAT must be defined as 0 or 1
107
#endif
/* MDBX_ENABLE_PGET_STAT */
108
111
#ifndef MDBX_USE_MINCORE
112
#if defined(MINCORE_INCORE) || !IS_WINDOWS
113
#define MDBX_USE_MINCORE 1
114
#else
115
#define MDBX_USE_MINCORE 0
116
#endif
117
#define MDBX_USE_MINCORE_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_MINCORE)
118
#elif !(MDBX_USE_MINCORE == 0 || MDBX_USE_MINCORE == 1)
119
#error MDBX_USE_MINCORE must be defined as 0 or 1
120
#endif
/* MDBX_USE_MINCORE */
121
124
#ifndef MDBX_ENABLE_BIGFOOT
125
#define MDBX_ENABLE_BIGFOOT 1
126
#elif !(MDBX_ENABLE_BIGFOOT == 0 || MDBX_ENABLE_BIGFOOT == 1)
127
#error MDBX_ENABLE_BIGFOOT must be defined as 0 or 1
128
#endif
/* MDBX_ENABLE_BIGFOOT */
129
131
#ifndef MDBX_ENABLE_BUNCHES_REMOVAL
132
#define MDBX_ENABLE_BUNCHES_REMOVAL 1
133
#elif !(MDBX_ENABLE_BUNCHES_REMOVAL == 0 || MDBX_ENABLE_BUNCHES_REMOVAL == 1)
134
#error MDBX_ENABLE_BUNCHES_REMOVAL must be MDBX_ENABLE_BUNCHES_REMOVAL as 0 or 1
135
#endif
/* MDBX_ENABLE_BUNCHES_REMOVAL */
136
139
#ifndef MDBX_DISABLE_VALIDATION
140
#define MDBX_DISABLE_VALIDATION 0
141
#elif !(MDBX_DISABLE_VALIDATION == 0 || MDBX_DISABLE_VALIDATION == 1)
142
#error MDBX_DISABLE_VALIDATION must be defined as 0 or 1
143
#endif
/* MDBX_DISABLE_VALIDATION */
144
145
#ifndef MDBX_PNL_PREALLOC_FOR_RADIXSORT
146
#define MDBX_PNL_PREALLOC_FOR_RADIXSORT 1
147
#elif !(MDBX_PNL_PREALLOC_FOR_RADIXSORT == 0 || MDBX_PNL_PREALLOC_FOR_RADIXSORT == 1)
148
#error MDBX_PNL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
149
#endif
/* MDBX_PNL_PREALLOC_FOR_RADIXSORT */
150
151
#ifndef MDBX_DPL_PREALLOC_FOR_RADIXSORT
152
#define MDBX_DPL_PREALLOC_FOR_RADIXSORT 1
153
#elif !(MDBX_DPL_PREALLOC_FOR_RADIXSORT == 0 || MDBX_DPL_PREALLOC_FOR_RADIXSORT == 1)
154
#error MDBX_DPL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
155
#endif
/* MDBX_DPL_PREALLOC_FOR_RADIXSORT */
156
157
#ifndef MDBX_DML_PREALLOC_FOR_RADIXSORT
158
#define MDBX_DML_PREALLOC_FOR_RADIXSORT 1
159
#elif !(MDBX_DML_PREALLOC_FOR_RADIXSORT == 0 || MDBX_DML_PREALLOC_FOR_RADIXSORT == 1)
160
#error MDBX_DML_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
161
#endif
/* MDBX_DML_PREALLOC_FOR_RADIXSORT */
162
163
#ifndef MDBX_DPL_CACHE_NPAGES
164
#if MDBX_WORDBITS >= 64
165
#define MDBX_DPL_CACHE_NPAGES 1
166
#else
167
#define MDBX_DPL_CACHE_NPAGES 0
168
#endif
169
#elif !(MDBX_DPL_CACHE_NPAGES == 0 || MDBX_DPL_CACHE_NPAGES == 1)
170
#error MDBX_DPL_CACHE_NPAGES must be defined as 0 or 1
171
#endif
/* MDBX_DPL_CACHE_NPAGES */
172
185
#ifndef MDBX_AVOID_MSYNC
186
#if IS_WINDOWS
187
#define MDBX_AVOID_MSYNC 1
188
#else
189
#define MDBX_AVOID_MSYNC 0
190
#endif
191
#elif !(MDBX_AVOID_MSYNC == 0 || MDBX_AVOID_MSYNC == 1)
192
#error MDBX_AVOID_MSYNC must be defined as 0 or 1
193
#endif
/* MDBX_AVOID_MSYNC */
194
196
#ifndef MDBX_ENABLE_DBI_SPARSE
197
#define MDBX_ENABLE_DBI_SPARSE 1
198
#elif !(MDBX_ENABLE_DBI_SPARSE == 0 || MDBX_ENABLE_DBI_SPARSE == 1)
199
#error MDBX_ENABLE_DBI_SPARSE must be defined as 0 or 1
200
#endif
/* MDBX_ENABLE_DBI_SPARSE */
201
203
#ifndef MDBX_ENABLE_DBI_LOCKFREE
204
#define MDBX_ENABLE_DBI_LOCKFREE 1
205
#elif !(MDBX_ENABLE_DBI_LOCKFREE == 0 || MDBX_ENABLE_DBI_LOCKFREE == 1)
206
#error MDBX_ENABLE_DBI_LOCKFREE must be defined as 0 or 1
207
#endif
/* MDBX_ENABLE_DBI_LOCKFREE */
208
210
#ifndef MDBX_WITHOUT_MSVC_CRT
211
#if defined(MDBX_BUILD_CXX) && !MDBX_BUILD_CXX && IS_WINDOWS
212
#define MDBX_WITHOUT_MSVC_CRT 1
213
#else
214
#define MDBX_WITHOUT_MSVC_CRT 0
215
#endif
216
#elif !(MDBX_WITHOUT_MSVC_CRT == 0 || MDBX_WITHOUT_MSVC_CRT == 1)
217
#error MDBX_WITHOUT_MSVC_CRT must be defined as 0 or 1
218
#endif
/* MDBX_WITHOUT_MSVC_CRT */
219
226
#if !defined(MDBX_NATIVE_SEH)
227
#if !(defined(_MSC_VER) || defined(__try)) || (MDBX_WITHOUT_MSVC_CRT && defined(__ia32__))
228
#define MDBX_NATIVE_SEH 0
229
#else
230
#define MDBX_NATIVE_SEH 1
231
#endif
232
#elif !(MDBX_NATIVE_SEH == 0 || MDBX_NATIVE_SEH == 1)
233
#error MDBX_NATIVE_SEH must be defined as 0 or 1
234
#endif
/* MDBX_NATIVE_SEH */
235
237
#ifndef MDBX_ENVCOPY_WRITEBUF
238
#define MDBX_ENVCOPY_WRITEBUF 1048576u
239
#elif MDBX_ENVCOPY_WRITEBUF < 65536u || MDBX_ENVCOPY_WRITEBUF > 1073741824u || MDBX_ENVCOPY_WRITEBUF % 65536u
240
#error MDBX_ENVCOPY_WRITEBUF must be defined in range 65536..1073741824 and be multiple of 65536
241
#endif
/* MDBX_ENVCOPY_WRITEBUF */
242
245
#ifndef MDBX_FORCE_ASSERTIONS
246
#define MDBX_FORCE_ASSERTIONS 0
247
#elif !(MDBX_FORCE_ASSERTIONS == 0 || MDBX_FORCE_ASSERTIONS == 1)
248
#error MDBX_FORCE_ASSERTIONS must be defined as 0 or 1
249
#endif
/* MDBX_FORCE_ASSERTIONS */
250
253
#ifndef MDBX_ASSUME_MALLOC_OVERHEAD
254
#ifdef __SIZEOF_POINTER__
255
#define MDBX_ASSUME_MALLOC_OVERHEAD (__SIZEOF_POINTER__ * 2u)
256
#else
257
#define MDBX_ASSUME_MALLOC_OVERHEAD (sizeof(void *) * 2u)
258
#endif
259
#elif MDBX_ASSUME_MALLOC_OVERHEAD < 0 || MDBX_ASSUME_MALLOC_OVERHEAD > 64 || MDBX_ASSUME_MALLOC_OVERHEAD % 4
260
#error MDBX_ASSUME_MALLOC_OVERHEAD must be defined in range 0..64 and be multiple of 4
261
#endif
/* MDBX_ASSUME_MALLOC_OVERHEAD */
262
265
#ifndef ENABLE_MEMCHECK
266
#endif
/* ENABLE_MEMCHECK */
267
270
#ifndef MDBX_HAVE_C11ATOMICS
271
#endif
/* MDBX_HAVE_C11ATOMICS */
272
279
#ifndef MDBX_HAVE_BUILTIN_CPU_SUPPORTS
280
#if defined(__APPLE__) || defined(BIONIC)
281
/* Never use any modern features on Apple's or Google's OSes
282
* since a lot of troubles with compatibility and/or performance */
283
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
284
#elif defined(__e2k__)
285
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
286
#elif __has_builtin(__builtin_cpu_supports) || defined(__BUILTIN_CPU_SUPPORTS__) || \
287
(defined(__ia32__) && __GNUC_PREREQ(4, 8) && __GLIBC_PREREQ(2, 23))
288
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 1
289
#else
290
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
291
#endif
292
#elif !(MDBX_HAVE_BUILTIN_CPU_SUPPORTS == 0 || MDBX_HAVE_BUILTIN_CPU_SUPPORTS == 1)
293
#error MDBX_HAVE_BUILTIN_CPU_SUPPORTS must be defined as 0 or 1
294
#endif
/* MDBX_HAVE_BUILTIN_CPU_SUPPORTS */
295
298
#ifndef MDBX_NOSUCCESS_PURE_COMMIT
299
#define MDBX_NOSUCCESS_PURE_COMMIT 0
300
#elif !(MDBX_NOSUCCESS_PURE_COMMIT == 0 || MDBX_NOSUCCESS_PURE_COMMIT == 1)
301
#error MDBX_NOSUCCESS_PURE_COMMIT must be defined as 0 or 1
302
#endif
/* MDBX_NOSUCCESS_PURE_COMMIT */
303
306
#ifndef MDBX_ENABLE_NON_READONLY_EXPORT
307
#define MDBX_ENABLE_NON_READONLY_EXPORT 0
308
#elif !(MDBX_ENABLE_NON_READONLY_EXPORT == 0 || MDBX_ENABLE_NON_READONLY_EXPORT == 1)
309
#error MDBX_ENABLE_NON_READONLY_EXPORT must be defined as 0 or 1
310
#endif
/* MDBX_ENABLE_NON_READONLY_EXPORT */
311
314
#ifndef MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS
315
#define MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS 0
316
#elif !(MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS == 0 || MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS == 1)
317
#error MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS must be defined as 0 or 1
318
#endif
/* MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS */
319
328
#ifndef MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY
329
#define MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY 0
330
#elif !(MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY == 0 || MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY == 1)
331
#error MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY must be defined as 0 or 1
332
#endif
/* MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY */
333
334
//------------------------------------------------------------------------------
335
337
#define MDBX_LOCKING_WIN32FILES -1
338
340
#define MDBX_LOCKING_SYSV 5
341
343
#define MDBX_LOCKING_POSIX1988 1988
344
346
#define MDBX_LOCKING_POSIX2001 2001
347
349
#define MDBX_LOCKING_POSIX2008 2008
350
352
#if IS_WINDOWS
353
#define MDBX_LOCKING MDBX_LOCKING_WIN32FILES
354
#else
355
#ifndef MDBX_LOCKING
356
#if defined(_POSIX_THREAD_PROCESS_SHARED) && _POSIX_THREAD_PROCESS_SHARED >= 200112L && !defined(__FreeBSD__)
357
358
/* Some platforms define the EOWNERDEAD error code even though they
359
* don't support Robust Mutexes. If doubt compile with -MDBX_LOCKING=2001. */
360
#if defined(EOWNERDEAD) && _POSIX_THREAD_PROCESS_SHARED >= 200809L && \
361
((defined(_POSIX_THREAD_ROBUST_PRIO_INHERIT) && _POSIX_THREAD_ROBUST_PRIO_INHERIT > 0) || \
362
(defined(_POSIX_THREAD_ROBUST_PRIO_PROTECT) && _POSIX_THREAD_ROBUST_PRIO_PROTECT > 0) || \
363
defined(PTHREAD_MUTEX_ROBUST) || defined(PTHREAD_MUTEX_ROBUST_NP)) && \
364
(!defined(__GLIBC__) || __GLIBC_PREREQ(2, 10)
/* troubles with Robust mutexes before 2.10 */
) && \
365
!defined(__OHOS__)
/* Harmony OS doesn't support robust mutexes at the end of 2025 */
366
#define MDBX_LOCKING MDBX_LOCKING_POSIX2008
367
#else
368
#define MDBX_LOCKING MDBX_LOCKING_POSIX2001
369
#endif
370
#elif defined(__sun) || defined(__SVR4) || defined(__svr4__) || defined(__HAIKU__)
371
#define MDBX_LOCKING MDBX_LOCKING_POSIX1988
372
#else
373
#define MDBX_LOCKING MDBX_LOCKING_SYSV
374
#endif
375
#define MDBX_LOCKING_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_LOCKING)
376
#else
377
#define MDBX_LOCKING_CONFIG MDBX_STRINGIFY(MDBX_LOCKING)
378
#endif
/* MDBX_LOCKING */
379
#endif
/* !Windows */
380
382
#ifndef MDBX_USE_OFDLOCKS
383
#if ((defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK)) || \
384
(defined(F_OFD_SETLK64) && defined(F_OFD_SETLKW64) && defined(F_OFD_GETLK64))) && \
385
!defined(MDBX_SAFE4QEMU) && !defined(__sun)
/* OFD-lock are broken on Solaris */
386
#define MDBX_USE_OFDLOCKS 1
387
#else
388
#define MDBX_USE_OFDLOCKS 0
389
#endif
390
#define MDBX_USE_OFDLOCKS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
391
#elif !(MDBX_USE_OFDLOCKS == 0 || MDBX_USE_OFDLOCKS == 1)
392
#error MDBX_USE_OFDLOCKS must be defined as 0 or 1
393
#else
394
#define MDBX_USE_OFDLOCKS_CONFIG MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
395
#endif
/* MDBX_USE_OFDLOCKS */
396
398
#ifndef MDBX_USE_SENDFILE
399
#if ((defined(__linux__) || defined(__gnu_linux__)) && !defined(__ANDROID_API__)) || \
400
(defined(__ANDROID_API__) && __ANDROID_API__ >= 21)
401
#define MDBX_USE_SENDFILE 1
402
#else
403
#define MDBX_USE_SENDFILE 0
404
#endif
405
#elif !(MDBX_USE_SENDFILE == 0 || MDBX_USE_SENDFILE == 1)
406
#error MDBX_USE_SENDFILE must be defined as 0 or 1
407
#endif
/* MDBX_USE_SENDFILE */
408
410
#ifndef MDBX_USE_COPYFILERANGE
411
#if __GLIBC_PREREQ(2, 27) && defined(_GNU_SOURCE)
412
#define MDBX_USE_COPYFILERANGE 1
413
#else
414
#define MDBX_USE_COPYFILERANGE 0
415
#endif
416
#elif !(MDBX_USE_COPYFILERANGE == 0 || MDBX_USE_COPYFILERANGE == 1)
417
#error MDBX_USE_COPYFILERANGE must be defined as 0 or 1
418
#endif
/* MDBX_USE_COPYFILERANGE */
419
421
#ifndef MDBX_USE_FALLOCATE
422
#if defined(__APPLE__)
423
#define MDBX_USE_FALLOCATE 0
/* Too slow and unclean, but not required to prevent SIGBUS */
424
#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (__GLIBC_PREREQ(2, 10) && defined(_GNU_SOURCE))
425
#define MDBX_USE_FALLOCATE 1
426
#else
427
#define MDBX_USE_FALLOCATE 0
428
#endif
429
#define MDBX_USE_FALLOCATE_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_FALLOCATE)
430
#elif !(MDBX_USE_FALLOCATE == 0 || MDBX_USE_FALLOCATE == 1)
431
#error MDBX_USE_FALLOCATE must be defined as 0 or 1
432
#else
433
#define MDBX_USE_FALLOCATE_CONFIG MDBX_STRINGIFY(MDBX_USE_FALLOCATE)
434
#endif
/* MDBX_USE_FALLOCATE */
435
436
#ifndef MDBX_HISTOGRAM_USING_128BIT
437
#if MDBX_WORDBITS >= 64
438
#define MDBX_HISTOGRAM_USING_128BIT 1
439
#else
440
#define MDBX_HISTOGRAM_USING_128BIT 0
441
#endif
442
#elif !(MDBX_HISTOGRAM_USING_128BIT == 0 || MDBX_HISTOGRAM_USING_128BIT == 1)
443
#error MDBX_HISTOGRAM_USING_128BIT must be defined as 0 or 1
444
#endif
/* MDBX_HISTOGRAM_USING_128BIT */
445
446
//------------------------------------------------------------------------------
447
448
#ifndef MDBX_CPU_WRITEBACK_INCOHERENT
449
#if defined(__ia32__) || defined(__e2k__) || defined(__hppa) || defined(__hppa__) || defined(DOXYGEN)
450
#define MDBX_CPU_WRITEBACK_INCOHERENT 0
451
#else
452
#define MDBX_CPU_WRITEBACK_INCOHERENT 1
453
#endif
454
#elif !(MDBX_CPU_WRITEBACK_INCOHERENT == 0 || MDBX_CPU_WRITEBACK_INCOHERENT == 1)
455
#error MDBX_CPU_WRITEBACK_INCOHERENT must be defined as 0 or 1
456
#endif
/* MDBX_CPU_WRITEBACK_INCOHERENT */
457
458
#ifndef MDBX_MMAP_INCOHERENT_FILE_WRITE
459
#ifdef __OpenBSD__
460
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 1
461
#else
462
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 0
463
#endif
464
#elif !(MDBX_MMAP_INCOHERENT_FILE_WRITE == 0 || MDBX_MMAP_INCOHERENT_FILE_WRITE == 1)
465
#error MDBX_MMAP_INCOHERENT_FILE_WRITE must be defined as 0 or 1
466
#endif
/* MDBX_MMAP_INCOHERENT_FILE_WRITE */
467
468
#ifndef MDBX_MMAP_INCOHERENT_CPU_CACHE
469
#if defined(__mips) || defined(__mips__) || defined(__mips64) || defined(__mips64__) || defined(_M_MRX000) || \
470
defined(_MIPS_) || defined(__MWERKS__) || defined(__sgi)
471
/* MIPS has cache coherency issues. */
472
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 1
473
#else
474
/* LY: assume no relevant mmap/dcache issues. */
475
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 0
476
#endif
477
#elif !(MDBX_MMAP_INCOHERENT_CPU_CACHE == 0 || MDBX_MMAP_INCOHERENT_CPU_CACHE == 1)
478
#error MDBX_MMAP_INCOHERENT_CPU_CACHE must be defined as 0 or 1
479
#endif
/* MDBX_MMAP_INCOHERENT_CPU_CACHE */
480
483
#ifndef MDBX_MMAP_NEEDS_JOLT
484
#if MDBX_MMAP_INCOHERENT_FILE_WRITE || MDBX_MMAP_INCOHERENT_CPU_CACHE || !(defined(__linux__) || defined(__gnu_linux__))
485
#define MDBX_MMAP_NEEDS_JOLT 1
486
#else
487
#define MDBX_MMAP_NEEDS_JOLT 0
488
#endif
489
#define MDBX_MMAP_NEEDS_JOLT_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_MMAP_NEEDS_JOLT)
490
#elif !(MDBX_MMAP_NEEDS_JOLT == 0 || MDBX_MMAP_NEEDS_JOLT == 1)
491
#error MDBX_MMAP_NEEDS_JOLT must be defined as 0 or 1
492
#endif
/* MDBX_MMAP_NEEDS_JOLT */
493
494
#ifndef MDBX_64BIT_ATOMIC
495
#if MDBX_WORDBITS >= 64 || defined(DOXYGEN)
496
#define MDBX_64BIT_ATOMIC 1
497
#else
498
#define MDBX_64BIT_ATOMIC 0
499
#endif
500
#define MDBX_64BIT_ATOMIC_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
501
#elif !(MDBX_64BIT_ATOMIC == 0 || MDBX_64BIT_ATOMIC == 1)
502
#error MDBX_64BIT_ATOMIC must be defined as 0 or 1
503
#else
504
#define MDBX_64BIT_ATOMIC_CONFIG MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
505
#endif
/* MDBX_64BIT_ATOMIC */
506
507
#ifndef MDBX_64BIT_CAS
508
#if defined(__GCC_ATOMIC_LLONG_LOCK_FREE)
509
#if __GCC_ATOMIC_LLONG_LOCK_FREE > 1
510
#define MDBX_64BIT_CAS 1
511
#else
512
#define MDBX_64BIT_CAS 0
513
#endif
514
#elif defined(__CLANG_ATOMIC_LLONG_LOCK_FREE)
515
#if __CLANG_ATOMIC_LLONG_LOCK_FREE > 1
516
#define MDBX_64BIT_CAS 1
517
#else
518
#define MDBX_64BIT_CAS 0
519
#endif
520
#elif defined(ATOMIC_LLONG_LOCK_FREE)
521
#if ATOMIC_LLONG_LOCK_FREE > 1
522
#define MDBX_64BIT_CAS 1
523
#else
524
#define MDBX_64BIT_CAS 0
525
#endif
526
#elif defined(_MSC_VER) || defined(__APPLE__) || defined(DOXYGEN)
527
#define MDBX_64BIT_CAS 1
528
#elif !(MDBX_64BIT_CAS == 0 || MDBX_64BIT_CAS == 1)
529
#error MDBX_64BIT_CAS must be defined as 0 or 1
530
#else
531
#define MDBX_64BIT_CAS MDBX_64BIT_ATOMIC
532
#endif
533
#define MDBX_64BIT_CAS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_CAS)
534
#else
535
#define MDBX_64BIT_CAS_CONFIG MDBX_STRINGIFY(MDBX_64BIT_CAS)
536
#endif
/* MDBX_64BIT_CAS */
537
538
#ifndef MDBX_UNALIGNED_OK
539
#if defined(__ALIGNED__) || defined(__SANITIZE_UNDEFINED__) || defined(ENABLE_UBSAN)
540
#define MDBX_UNALIGNED_OK 0
/* no unaligned access allowed */
541
#elif defined(__ARM_FEATURE_UNALIGNED)
542
#define MDBX_UNALIGNED_OK 4
/* ok unaligned for 32-bit words */
543
#elif defined(__e2k__) || defined(__elbrus__)
544
#if __iset__ > 4
545
#define MDBX_UNALIGNED_OK 8
/* ok unaligned for 64-bit words */
546
#else
547
#define MDBX_UNALIGNED_OK 4
/* ok unaligned for 32-bit words */
548
#endif
549
#elif defined(__ia32__)
550
#define MDBX_UNALIGNED_OK 8
/* ok unaligned for 64-bit words */
551
#elif __CLANG_PREREQ(5, 0) || __GNUC_PREREQ(5, 0)
552
/* expecting an optimization will well done, also this
553
* hushes false-positives from UBSAN (undefined behaviour sanitizer) */
554
#define MDBX_UNALIGNED_OK 0
555
#else
556
#define MDBX_UNALIGNED_OK 0
/* no unaligned access allowed */
557
#endif
558
#elif MDBX_UNALIGNED_OK == 1
559
#undef MDBX_UNALIGNED_OK
560
#define MDBX_UNALIGNED_OK 32
/* any unaligned access allowed */
561
#endif
/* MDBX_UNALIGNED_OK */
562
563
#ifndef MDBX_CACHELINE_SIZE
564
#if defined(SYSTEM_CACHE_ALIGNMENT_SIZE)
565
#define MDBX_CACHELINE_SIZE SYSTEM_CACHE_ALIGNMENT_SIZE
566
#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
567
#define MDBX_CACHELINE_SIZE 128
568
#else
569
#define MDBX_CACHELINE_SIZE 64
570
#endif
571
#endif
/* MDBX_CACHELINE_SIZE */
572
573
/* Max length of iov-vector passed to writev() call, used for auxiliary writes */
574
#ifndef MDBX_AUXILARY_IOV_MAX
575
#define MDBX_AUXILARY_IOV_MAX 64
576
#endif
577
#if defined(IOV_MAX) && IOV_MAX < MDBX_AUXILARY_IOV_MAX
578
#undef MDBX_AUXILARY_IOV_MAX
579
#define MDBX_AUXILARY_IOV_MAX IOV_MAX
580
#endif
/* MDBX_AUXILARY_IOV_MAX */
581
582
/* An extra/custom information provided during library build */
583
#ifndef MDBX_BUILD_METADATA
584
#define MDBX_BUILD_METADATA ""
585
#endif
/* MDBX_BUILD_METADATA */
586
587
#ifdef DOXYGEN
588
/* !!! Actually this is a fake definitions for Doxygen !!! */
589
605
#define MDBX_DEBUG 0...3
606
627
#define MDBX_CHECKING -1...3
628
630
#define MDBX_DISABLE_GNU_SOURCE 0 or 1
631
633
/********************************************************************************/
634
#else
/* DOXYGEN */
635
636
#ifndef MDBX_DEBUG
637
#define MDBX_DEBUG 0
638
#elif MDBX_DEBUG < -1 || MDBX_DEBUG > 3
639
#error "The MDBX_DEBUG must be defined to -1, 0, 1, 2 or 3"
640
#endif
/* MDBX_DEBUG */
641
642
#ifndef MDBX_CHECKING
643
#if MDBX_FORCE_ASSERTIONS && MDBX_DEBUG < 2
644
#define MDBX_CHECKING 2
645
#else
646
#define MDBX_CHECKING MDBX_DEBUG
647
#endif
648
#elif MDBX_CHECKING < -1 || MDBX_DEBUG > 3
649
#error "The MDBX_CHECKING must be defined to -1, 0, 1, 2 or 3"
650
#endif
/* MDBX_CHECKING */
651
652
#if MDBX_FORCE_ASSERTIONS && MDBX_CHECKING < 2
653
#error "Please use one of MDBX_CHECKING either MDBX_FORCE_ASSERTIONS build options, but not both"
654
#endif
655
656
/* Since 2026-04-01 alternatives to MDBX_PNL_ASCENDING = 0 are no longer supported. */
657
#define MDBX_PNL_ASCENDING 0
658
659
#endif
/* DOXYGEN */
options.h
Generated by
1.16.1