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