libmdbx
0.14.1.479 (2026-03-20T07:19:50+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
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) || !(defined(_WIN32) || defined(_WIN64))
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
132
#ifndef MDBX_DISABLE_VALIDATION
133
#define MDBX_DISABLE_VALIDATION 0
134
#elif !(MDBX_DISABLE_VALIDATION == 0 || MDBX_DISABLE_VALIDATION == 1)
135
#error MDBX_DISABLE_VALIDATION must be defined as 0 or 1
136
#endif
/* MDBX_DISABLE_VALIDATION */
137
138
#ifndef MDBX_PNL_PREALLOC_FOR_RADIXSORT
139
#define MDBX_PNL_PREALLOC_FOR_RADIXSORT 1
140
#elif !(MDBX_PNL_PREALLOC_FOR_RADIXSORT == 0 || MDBX_PNL_PREALLOC_FOR_RADIXSORT == 1)
141
#error MDBX_PNL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
142
#endif
/* MDBX_PNL_PREALLOC_FOR_RADIXSORT */
143
144
#ifndef MDBX_DPL_PREALLOC_FOR_RADIXSORT
145
#define MDBX_DPL_PREALLOC_FOR_RADIXSORT 1
146
#elif !(MDBX_DPL_PREALLOC_FOR_RADIXSORT == 0 || MDBX_DPL_PREALLOC_FOR_RADIXSORT == 1)
147
#error MDBX_DPL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
148
#endif
/* MDBX_DPL_PREALLOC_FOR_RADIXSORT */
149
150
#ifndef MDBX_DML_PREALLOC_FOR_RADIXSORT
151
#define MDBX_DML_PREALLOC_FOR_RADIXSORT 1
152
#elif !(MDBX_DML_PREALLOC_FOR_RADIXSORT == 0 || MDBX_DML_PREALLOC_FOR_RADIXSORT == 1)
153
#error MDBX_DML_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
154
#endif
/* MDBX_DML_PREALLOC_FOR_RADIXSORT */
155
156
#ifndef MDBX_DPL_CACHE_NPAGES
157
#if MDBX_WORDBITS >= 64
158
#define MDBX_DPL_CACHE_NPAGES 1
159
#else
160
#define MDBX_DPL_CACHE_NPAGES 0
161
#endif
162
#elif !(MDBX_DPL_CACHE_NPAGES == 0 || MDBX_DPL_CACHE_NPAGES == 1)
163
#error MDBX_DPL_CACHE_NPAGES must be defined as 0 or 1
164
#endif
/* MDBX_DPL_CACHE_NPAGES */
165
178
#ifndef MDBX_AVOID_MSYNC
179
#if defined(_WIN32) || defined(_WIN64)
180
#define MDBX_AVOID_MSYNC 1
181
#else
182
#define MDBX_AVOID_MSYNC 0
183
#endif
184
#elif !(MDBX_AVOID_MSYNC == 0 || MDBX_AVOID_MSYNC == 1)
185
#error MDBX_AVOID_MSYNC must be defined as 0 or 1
186
#endif
/* MDBX_AVOID_MSYNC */
187
189
#ifndef MDBX_ENABLE_DBI_SPARSE
190
#define MDBX_ENABLE_DBI_SPARSE 1
191
#elif !(MDBX_ENABLE_DBI_SPARSE == 0 || MDBX_ENABLE_DBI_SPARSE == 1)
192
#error MDBX_ENABLE_DBI_SPARSE must be defined as 0 or 1
193
#endif
/* MDBX_ENABLE_DBI_SPARSE */
194
196
#ifndef MDBX_ENABLE_DBI_LOCKFREE
197
#define MDBX_ENABLE_DBI_LOCKFREE 1
198
#elif !(MDBX_ENABLE_DBI_LOCKFREE == 0 || MDBX_ENABLE_DBI_LOCKFREE == 1)
199
#error MDBX_ENABLE_DBI_LOCKFREE must be defined as 0 or 1
200
#endif
/* MDBX_ENABLE_DBI_LOCKFREE */
201
206
#ifndef MDBX_PNL_ASCENDING
207
#define MDBX_PNL_ASCENDING 0
208
#elif !(MDBX_PNL_ASCENDING == 0 || MDBX_PNL_ASCENDING == 1)
209
#error MDBX_PNL_ASCENDING must be defined as 0 or 1
210
#endif
/* MDBX_PNL_ASCENDING */
211
213
#ifndef MDBX_WITHOUT_MSVC_CRT
214
#if defined(MDBX_BUILD_CXX) && !MDBX_BUILD_CXX && (defined(_WIN32) || defined(_WIN64))
215
#define MDBX_WITHOUT_MSVC_CRT 1
216
#else
217
#define MDBX_WITHOUT_MSVC_CRT 0
218
#endif
219
#elif !(MDBX_WITHOUT_MSVC_CRT == 0 || MDBX_WITHOUT_MSVC_CRT == 1)
220
#error MDBX_WITHOUT_MSVC_CRT must be defined as 0 or 1
221
#endif
/* MDBX_WITHOUT_MSVC_CRT */
222
224
#ifndef MDBX_ENVCOPY_WRITEBUF
225
#define MDBX_ENVCOPY_WRITEBUF 1048576u
226
#elif MDBX_ENVCOPY_WRITEBUF < 65536u || MDBX_ENVCOPY_WRITEBUF > 1073741824u || MDBX_ENVCOPY_WRITEBUF % 65536u
227
#error MDBX_ENVCOPY_WRITEBUF must be defined in range 65536..1073741824 and be multiple of 65536
228
#endif
/* MDBX_ENVCOPY_WRITEBUF */
229
231
#ifndef MDBX_FORCE_ASSERTIONS
232
#define MDBX_FORCE_ASSERTIONS 0
233
#elif !(MDBX_FORCE_ASSERTIONS == 0 || MDBX_FORCE_ASSERTIONS == 1)
234
#error MDBX_FORCE_ASSERTIONS must be defined as 0 or 1
235
#endif
/* MDBX_FORCE_ASSERTIONS */
236
239
#ifndef MDBX_ASSUME_MALLOC_OVERHEAD
240
#ifdef __SIZEOF_POINTER__
241
#define MDBX_ASSUME_MALLOC_OVERHEAD (__SIZEOF_POINTER__ * 2u)
242
#else
243
#define MDBX_ASSUME_MALLOC_OVERHEAD (sizeof(void *) * 2u)
244
#endif
245
#elif MDBX_ASSUME_MALLOC_OVERHEAD < 0 || MDBX_ASSUME_MALLOC_OVERHEAD > 64 || MDBX_ASSUME_MALLOC_OVERHEAD % 4
246
#error MDBX_ASSUME_MALLOC_OVERHEAD must be defined in range 0..64 and be multiple of 4
247
#endif
/* MDBX_ASSUME_MALLOC_OVERHEAD */
248
251
#ifndef ENABLE_MEMCHECK
252
#endif
/* ENABLE_MEMCHECK */
253
256
#ifndef MDBX_HAVE_C11ATOMICS
257
#endif
/* MDBX_HAVE_C11ATOMICS */
258
265
#ifndef MDBX_HAVE_BUILTIN_CPU_SUPPORTS
266
#if defined(__APPLE__) || defined(BIONIC)
267
/* Never use any modern features on Apple's or Google's OSes
268
* since a lot of troubles with compatibility and/or performance */
269
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
270
#elif defined(__e2k__)
271
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
272
#elif __has_builtin(__builtin_cpu_supports) || defined(__BUILTIN_CPU_SUPPORTS__) || \
273
(defined(__ia32__) && __GNUC_PREREQ(4, 8) && __GLIBC_PREREQ(2, 23))
274
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 1
275
#else
276
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
277
#endif
278
#elif !(MDBX_HAVE_BUILTIN_CPU_SUPPORTS == 0 || MDBX_HAVE_BUILTIN_CPU_SUPPORTS == 1)
279
#error MDBX_HAVE_BUILTIN_CPU_SUPPORTS must be defined as 0 or 1
280
#endif
/* MDBX_HAVE_BUILTIN_CPU_SUPPORTS */
281
284
#ifndef MDBX_NOSUCCESS_PURE_COMMIT
285
#define MDBX_NOSUCCESS_PURE_COMMIT 0
286
#elif !(MDBX_NOSUCCESS_PURE_COMMIT == 0 || MDBX_NOSUCCESS_PURE_COMMIT == 1)
287
#error MDBX_NOSUCCESS_PURE_COMMIT must be defined as 0 or 1
288
#endif
/* MDBX_NOSUCCESS_PURE_COMMIT */
289
292
#ifndef MDBX_ENABLE_NON_READONLY_EXPORT
293
#define MDBX_ENABLE_NON_READONLY_EXPORT 0
294
#elif !(MDBX_ENABLE_NON_READONLY_EXPORT == 0 || MDBX_ENABLE_NON_READONLY_EXPORT == 1)
295
#error MDBX_ENABLE_NON_READONLY_EXPORT must be defined as 0 or 1
296
#endif
/* MDBX_ENABLE_NON_READONLY_EXPORT */
297
300
#ifndef MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS
301
#define MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS 0
302
#elif !(MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS == 0 || MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS == 1)
303
#error MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS must be defined as 0 or 1
304
#endif
/* MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS */
305
314
#ifndef MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY
315
#define MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY 0
316
#elif !(MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY == 0 || MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY == 1)
317
#error MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY must be defined as 0 or 1
318
#endif
/* MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY */
319
320
//------------------------------------------------------------------------------
321
323
#define MDBX_LOCKING_WIN32FILES -1
324
326
#define MDBX_LOCKING_SYSV 5
327
329
#define MDBX_LOCKING_POSIX1988 1988
330
332
#define MDBX_LOCKING_POSIX2001 2001
333
335
#define MDBX_LOCKING_POSIX2008 2008
336
338
#if defined(_WIN32) || defined(_WIN64)
339
#define MDBX_LOCKING MDBX_LOCKING_WIN32FILES
340
#else
341
#ifndef MDBX_LOCKING
342
#if defined(_POSIX_THREAD_PROCESS_SHARED) && _POSIX_THREAD_PROCESS_SHARED >= 200112L && !defined(__FreeBSD__)
343
344
/* Some platforms define the EOWNERDEAD error code even though they
345
* don't support Robust Mutexes. If doubt compile with -MDBX_LOCKING=2001. */
346
#if defined(EOWNERDEAD) && _POSIX_THREAD_PROCESS_SHARED >= 200809L && \
347
((defined(_POSIX_THREAD_ROBUST_PRIO_INHERIT) && _POSIX_THREAD_ROBUST_PRIO_INHERIT > 0) || \
348
(defined(_POSIX_THREAD_ROBUST_PRIO_PROTECT) && _POSIX_THREAD_ROBUST_PRIO_PROTECT > 0) || \
349
defined(PTHREAD_MUTEX_ROBUST) || defined(PTHREAD_MUTEX_ROBUST_NP)) && \
350
(!defined(__GLIBC__) || __GLIBC_PREREQ(2, 10)
/* troubles with Robust mutexes before 2.10 */
) && \
351
!defined(__OHOS__)
/* Harmony OS doesn't support robust mutexes at the end of 2025 */
352
#define MDBX_LOCKING MDBX_LOCKING_POSIX2008
353
#else
354
#define MDBX_LOCKING MDBX_LOCKING_POSIX2001
355
#endif
356
#elif defined(__sun) || defined(__SVR4) || defined(__svr4__)
357
#define MDBX_LOCKING MDBX_LOCKING_POSIX1988
358
#else
359
#define MDBX_LOCKING MDBX_LOCKING_SYSV
360
#endif
361
#define MDBX_LOCKING_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_LOCKING)
362
#else
363
#define MDBX_LOCKING_CONFIG MDBX_STRINGIFY(MDBX_LOCKING)
364
#endif
/* MDBX_LOCKING */
365
#endif
/* !Windows */
366
368
#ifndef MDBX_USE_OFDLOCKS
369
#if ((defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK)) || \
370
(defined(F_OFD_SETLK64) && defined(F_OFD_SETLKW64) && defined(F_OFD_GETLK64))) && \
371
!defined(MDBX_SAFE4QEMU) && !defined(__sun)
/* OFD-lock are broken on Solaris */
372
#define MDBX_USE_OFDLOCKS 1
373
#else
374
#define MDBX_USE_OFDLOCKS 0
375
#endif
376
#define MDBX_USE_OFDLOCKS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
377
#elif !(MDBX_USE_OFDLOCKS == 0 || MDBX_USE_OFDLOCKS == 1)
378
#error MDBX_USE_OFDLOCKS must be defined as 0 or 1
379
#else
380
#define MDBX_USE_OFDLOCKS_CONFIG MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
381
#endif
/* MDBX_USE_OFDLOCKS */
382
384
#ifndef MDBX_USE_SENDFILE
385
#if ((defined(__linux__) || defined(__gnu_linux__)) && !defined(__ANDROID_API__)) || \
386
(defined(__ANDROID_API__) && __ANDROID_API__ >= 21)
387
#define MDBX_USE_SENDFILE 1
388
#else
389
#define MDBX_USE_SENDFILE 0
390
#endif
391
#elif !(MDBX_USE_SENDFILE == 0 || MDBX_USE_SENDFILE == 1)
392
#error MDBX_USE_SENDFILE must be defined as 0 or 1
393
#endif
/* MDBX_USE_SENDFILE */
394
396
#ifndef MDBX_USE_COPYFILERANGE
397
#if __GLIBC_PREREQ(2, 27) && defined(_GNU_SOURCE)
398
#define MDBX_USE_COPYFILERANGE 1
399
#else
400
#define MDBX_USE_COPYFILERANGE 0
401
#endif
402
#elif !(MDBX_USE_COPYFILERANGE == 0 || MDBX_USE_COPYFILERANGE == 1)
403
#error MDBX_USE_COPYFILERANGE must be defined as 0 or 1
404
#endif
/* MDBX_USE_COPYFILERANGE */
405
407
#ifndef MDBX_USE_FALLOCATE
408
#if defined(__APPLE__)
409
#define MDBX_USE_FALLOCATE 0
/* Too slow and unclean, but not required to prevent SIGBUS */
410
#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (__GLIBC_PREREQ(2, 10) && defined(_GNU_SOURCE))
411
#define MDBX_USE_FALLOCATE 1
412
#else
413
#define MDBX_USE_FALLOCATE 0
414
#endif
415
#define MDBX_USE_FALLOCATE_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_FALLOCATE)
416
#elif !(MDBX_USE_FALLOCATE == 0 || MDBX_USE_FALLOCATE == 1)
417
#error MDBX_USE_FALLOCATE must be defined as 0 or 1
418
#else
419
#define MDBX_USE_FALLOCATE_CONFIG MDBX_STRINGIFY(MDBX_USE_FALLOCATE)
420
#endif
/* MDBX_USE_FALLOCATE */
421
422
#ifndef MDBX_HISTOGRAM_USING_128BIT
423
#if MDBX_WORDBITS >= 64
424
#define MDBX_HISTOGRAM_USING_128BIT 1
425
#else
426
#define MDBX_HISTOGRAM_USING_128BIT 0
427
#endif
428
#elif !(MDBX_HISTOGRAM_USING_128BIT == 0 || MDBX_HISTOGRAM_USING_128BIT == 1)
429
#error MDBX_HISTOGRAM_USING_128BIT must be defined as 0 or 1
430
#endif
/* MDBX_HISTOGRAM_USING_128BIT */
431
432
//------------------------------------------------------------------------------
433
434
#ifndef MDBX_CPU_WRITEBACK_INCOHERENT
435
#if defined(__ia32__) || defined(__e2k__) || defined(__hppa) || defined(__hppa__) || defined(DOXYGEN)
436
#define MDBX_CPU_WRITEBACK_INCOHERENT 0
437
#else
438
#define MDBX_CPU_WRITEBACK_INCOHERENT 1
439
#endif
440
#elif !(MDBX_CPU_WRITEBACK_INCOHERENT == 0 || MDBX_CPU_WRITEBACK_INCOHERENT == 1)
441
#error MDBX_CPU_WRITEBACK_INCOHERENT must be defined as 0 or 1
442
#endif
/* MDBX_CPU_WRITEBACK_INCOHERENT */
443
444
#ifndef MDBX_MMAP_INCOHERENT_FILE_WRITE
445
#ifdef __OpenBSD__
446
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 1
447
#else
448
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 0
449
#endif
450
#elif !(MDBX_MMAP_INCOHERENT_FILE_WRITE == 0 || MDBX_MMAP_INCOHERENT_FILE_WRITE == 1)
451
#error MDBX_MMAP_INCOHERENT_FILE_WRITE must be defined as 0 or 1
452
#endif
/* MDBX_MMAP_INCOHERENT_FILE_WRITE */
453
454
#ifndef MDBX_MMAP_INCOHERENT_CPU_CACHE
455
#if defined(__mips) || defined(__mips__) || defined(__mips64) || defined(__mips64__) || defined(_M_MRX000) || \
456
defined(_MIPS_) || defined(__MWERKS__) || defined(__sgi)
457
/* MIPS has cache coherency issues. */
458
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 1
459
#else
460
/* LY: assume no relevant mmap/dcache issues. */
461
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 0
462
#endif
463
#elif !(MDBX_MMAP_INCOHERENT_CPU_CACHE == 0 || MDBX_MMAP_INCOHERENT_CPU_CACHE == 1)
464
#error MDBX_MMAP_INCOHERENT_CPU_CACHE must be defined as 0 or 1
465
#endif
/* MDBX_MMAP_INCOHERENT_CPU_CACHE */
466
469
#ifndef MDBX_MMAP_NEEDS_JOLT
470
#if MDBX_MMAP_INCOHERENT_FILE_WRITE || MDBX_MMAP_INCOHERENT_CPU_CACHE || !(defined(__linux__) || defined(__gnu_linux__))
471
#define MDBX_MMAP_NEEDS_JOLT 1
472
#else
473
#define MDBX_MMAP_NEEDS_JOLT 0
474
#endif
475
#define MDBX_MMAP_NEEDS_JOLT_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_MMAP_NEEDS_JOLT)
476
#elif !(MDBX_MMAP_NEEDS_JOLT == 0 || MDBX_MMAP_NEEDS_JOLT == 1)
477
#error MDBX_MMAP_NEEDS_JOLT must be defined as 0 or 1
478
#endif
/* MDBX_MMAP_NEEDS_JOLT */
479
480
#ifndef MDBX_64BIT_ATOMIC
481
#if MDBX_WORDBITS >= 64 || defined(DOXYGEN)
482
#define MDBX_64BIT_ATOMIC 1
483
#else
484
#define MDBX_64BIT_ATOMIC 0
485
#endif
486
#define MDBX_64BIT_ATOMIC_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
487
#elif !(MDBX_64BIT_ATOMIC == 0 || MDBX_64BIT_ATOMIC == 1)
488
#error MDBX_64BIT_ATOMIC must be defined as 0 or 1
489
#else
490
#define MDBX_64BIT_ATOMIC_CONFIG MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
491
#endif
/* MDBX_64BIT_ATOMIC */
492
493
#ifndef MDBX_64BIT_CAS
494
#if defined(__GCC_ATOMIC_LLONG_LOCK_FREE)
495
#if __GCC_ATOMIC_LLONG_LOCK_FREE > 1
496
#define MDBX_64BIT_CAS 1
497
#else
498
#define MDBX_64BIT_CAS 0
499
#endif
500
#elif defined(__CLANG_ATOMIC_LLONG_LOCK_FREE)
501
#if __CLANG_ATOMIC_LLONG_LOCK_FREE > 1
502
#define MDBX_64BIT_CAS 1
503
#else
504
#define MDBX_64BIT_CAS 0
505
#endif
506
#elif defined(ATOMIC_LLONG_LOCK_FREE)
507
#if ATOMIC_LLONG_LOCK_FREE > 1
508
#define MDBX_64BIT_CAS 1
509
#else
510
#define MDBX_64BIT_CAS 0
511
#endif
512
#elif defined(_MSC_VER) || defined(__APPLE__) || defined(DOXYGEN)
513
#define MDBX_64BIT_CAS 1
514
#elif !(MDBX_64BIT_CAS == 0 || MDBX_64BIT_CAS == 1)
515
#error MDBX_64BIT_CAS must be defined as 0 or 1
516
#else
517
#define MDBX_64BIT_CAS MDBX_64BIT_ATOMIC
518
#endif
519
#define MDBX_64BIT_CAS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_CAS)
520
#else
521
#define MDBX_64BIT_CAS_CONFIG MDBX_STRINGIFY(MDBX_64BIT_CAS)
522
#endif
/* MDBX_64BIT_CAS */
523
524
#ifndef MDBX_UNALIGNED_OK
525
#if defined(__ALIGNED__) || defined(__SANITIZE_UNDEFINED__) || defined(ENABLE_UBSAN)
526
#define MDBX_UNALIGNED_OK 0
/* no unaligned access allowed */
527
#elif defined(__ARM_FEATURE_UNALIGNED)
528
#define MDBX_UNALIGNED_OK 4
/* ok unaligned for 32-bit words */
529
#elif defined(__e2k__) || defined(__elbrus__)
530
#if __iset__ > 4
531
#define MDBX_UNALIGNED_OK 8
/* ok unaligned for 64-bit words */
532
#else
533
#define MDBX_UNALIGNED_OK 4
/* ok unaligned for 32-bit words */
534
#endif
535
#elif defined(__ia32__)
536
#define MDBX_UNALIGNED_OK 8
/* ok unaligned for 64-bit words */
537
#elif __CLANG_PREREQ(5, 0) || __GNUC_PREREQ(5, 0)
538
/* expecting an optimization will well done, also this
539
* hushes false-positives from UBSAN (undefined behaviour sanitizer) */
540
#define MDBX_UNALIGNED_OK 0
541
#else
542
#define MDBX_UNALIGNED_OK 0
/* no unaligned access allowed */
543
#endif
544
#elif MDBX_UNALIGNED_OK == 1
545
#undef MDBX_UNALIGNED_OK
546
#define MDBX_UNALIGNED_OK 32
/* any unaligned access allowed */
547
#endif
/* MDBX_UNALIGNED_OK */
548
549
#ifndef MDBX_CACHELINE_SIZE
550
#if defined(SYSTEM_CACHE_ALIGNMENT_SIZE)
551
#define MDBX_CACHELINE_SIZE SYSTEM_CACHE_ALIGNMENT_SIZE
552
#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
553
#define MDBX_CACHELINE_SIZE 128
554
#else
555
#define MDBX_CACHELINE_SIZE 64
556
#endif
557
#endif
/* MDBX_CACHELINE_SIZE */
558
559
/* Max length of iov-vector passed to writev() call, used for auxilary writes */
560
#ifndef MDBX_AUXILARY_IOV_MAX
561
#define MDBX_AUXILARY_IOV_MAX 64
562
#endif
563
#if defined(IOV_MAX) && IOV_MAX < MDBX_AUXILARY_IOV_MAX
564
#undef MDBX_AUXILARY_IOV_MAX
565
#define MDBX_AUXILARY_IOV_MAX IOV_MAX
566
#endif
/* MDBX_AUXILARY_IOV_MAX */
567
568
/* An extra/custom information provided during library build */
569
#ifndef MDBX_BUILD_METADATA
570
#define MDBX_BUILD_METADATA ""
571
#endif
/* MDBX_BUILD_METADATA */
573
/*******************************************************************************
574
*******************************************************************************
575
******************************************************************************/
576
577
#ifndef DOXYGEN
578
579
/* In case the MDBX_DEBUG is undefined set it corresponding to NDEBUG */
580
#ifndef MDBX_DEBUG
581
#ifdef NDEBUG
582
#define MDBX_DEBUG 0
583
#else
584
#define MDBX_DEBUG 1
585
#endif
586
#endif
587
#if MDBX_DEBUG < 0 || MDBX_DEBUG > 2
588
#error "The MDBX_DEBUG must be defined to 0, 1 or 2"
589
#endif
/* MDBX_DEBUG */
590
591
#else
592
593
/* !!! Actually this is a fake definitions for Doxygen !!! */
594
608
#define MDBX_DEBUG 0...2
609
611
#define MDBX_DISABLE_GNU_SOURCE 0 or 1
612
613
#endif
/* DOXYGEN */
options.h
Generated by
1.14.0