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