libmdbx
0.14.1.101 (2025-10-18T12:36:36+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
362
#ifndef MDBX_USE_FALLOCATE
363
#if defined(__APPLE__)
364
#define MDBX_USE_FALLOCATE 0
/* Too slow and unclean, but not required to prevent SIGBUS */
365
#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (__GLIBC_PREREQ(2, 10) && defined(_GNU_SOURCE))
366
#define MDBX_USE_FALLOCATE 1
367
#else
368
#define MDBX_USE_FALLOCATE 0
369
#endif
370
#elif !(MDBX_USE_FALLOCATE == 0 || MDBX_USE_FALLOCATE == 1)
371
#error MDBX_USE_FALLOCATE must be defined as 0 or 1
372
#endif
/* MDBX_USE_FALLOCATE */
373
374
//------------------------------------------------------------------------------
375
376
#ifndef MDBX_CPU_WRITEBACK_INCOHERENT
377
#if defined(__ia32__) || defined(__e2k__) || defined(__hppa) || defined(__hppa__) || defined(DOXYGEN)
378
#define MDBX_CPU_WRITEBACK_INCOHERENT 0
379
#else
380
#define MDBX_CPU_WRITEBACK_INCOHERENT 1
381
#endif
382
#elif !(MDBX_CPU_WRITEBACK_INCOHERENT == 0 || MDBX_CPU_WRITEBACK_INCOHERENT == 1)
383
#error MDBX_CPU_WRITEBACK_INCOHERENT must be defined as 0 or 1
384
#endif
/* MDBX_CPU_WRITEBACK_INCOHERENT */
385
386
#ifndef MDBX_MMAP_INCOHERENT_FILE_WRITE
387
#ifdef __OpenBSD__
388
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 1
389
#else
390
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 0
391
#endif
392
#elif !(MDBX_MMAP_INCOHERENT_FILE_WRITE == 0 || MDBX_MMAP_INCOHERENT_FILE_WRITE == 1)
393
#error MDBX_MMAP_INCOHERENT_FILE_WRITE must be defined as 0 or 1
394
#endif
/* MDBX_MMAP_INCOHERENT_FILE_WRITE */
395
396
#ifndef MDBX_MMAP_INCOHERENT_CPU_CACHE
397
#if defined(__mips) || defined(__mips__) || defined(__mips64) || defined(__mips64__) || defined(_M_MRX000) || \
398
defined(_MIPS_) || defined(__MWERKS__) || defined(__sgi)
399
/* MIPS has cache coherency issues. */
400
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 1
401
#else
402
/* LY: assume no relevant mmap/dcache issues. */
403
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 0
404
#endif
405
#elif !(MDBX_MMAP_INCOHERENT_CPU_CACHE == 0 || MDBX_MMAP_INCOHERENT_CPU_CACHE == 1)
406
#error MDBX_MMAP_INCOHERENT_CPU_CACHE must be defined as 0 or 1
407
#endif
/* MDBX_MMAP_INCOHERENT_CPU_CACHE */
408
411
#ifndef MDBX_MMAP_NEEDS_JOLT
412
#if MDBX_MMAP_INCOHERENT_FILE_WRITE || MDBX_MMAP_INCOHERENT_CPU_CACHE || !(defined(__linux__) || defined(__gnu_linux__))
413
#define MDBX_MMAP_NEEDS_JOLT 1
414
#else
415
#define MDBX_MMAP_NEEDS_JOLT 0
416
#endif
417
#define MDBX_MMAP_NEEDS_JOLT_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_MMAP_NEEDS_JOLT)
418
#elif !(MDBX_MMAP_NEEDS_JOLT == 0 || MDBX_MMAP_NEEDS_JOLT == 1)
419
#error MDBX_MMAP_NEEDS_JOLT must be defined as 0 or 1
420
#endif
/* MDBX_MMAP_NEEDS_JOLT */
421
422
#ifndef MDBX_64BIT_ATOMIC
423
#if MDBX_WORDBITS >= 64 || defined(DOXYGEN)
424
#define MDBX_64BIT_ATOMIC 1
425
#else
426
#define MDBX_64BIT_ATOMIC 0
427
#endif
428
#define MDBX_64BIT_ATOMIC_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
429
#elif !(MDBX_64BIT_ATOMIC == 0 || MDBX_64BIT_ATOMIC == 1)
430
#error MDBX_64BIT_ATOMIC must be defined as 0 or 1
431
#else
432
#define MDBX_64BIT_ATOMIC_CONFIG MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
433
#endif
/* MDBX_64BIT_ATOMIC */
434
435
#ifndef MDBX_64BIT_CAS
436
#if defined(__GCC_ATOMIC_LLONG_LOCK_FREE)
437
#if __GCC_ATOMIC_LLONG_LOCK_FREE > 1
438
#define MDBX_64BIT_CAS 1
439
#else
440
#define MDBX_64BIT_CAS 0
441
#endif
442
#elif defined(__CLANG_ATOMIC_LLONG_LOCK_FREE)
443
#if __CLANG_ATOMIC_LLONG_LOCK_FREE > 1
444
#define MDBX_64BIT_CAS 1
445
#else
446
#define MDBX_64BIT_CAS 0
447
#endif
448
#elif defined(ATOMIC_LLONG_LOCK_FREE)
449
#if ATOMIC_LLONG_LOCK_FREE > 1
450
#define MDBX_64BIT_CAS 1
451
#else
452
#define MDBX_64BIT_CAS 0
453
#endif
454
#elif defined(_MSC_VER) || defined(__APPLE__) || defined(DOXYGEN)
455
#define MDBX_64BIT_CAS 1
456
#elif !(MDBX_64BIT_CAS == 0 || MDBX_64BIT_CAS == 1)
457
#error MDBX_64BIT_CAS must be defined as 0 or 1
458
#else
459
#define MDBX_64BIT_CAS MDBX_64BIT_ATOMIC
460
#endif
461
#define MDBX_64BIT_CAS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_CAS)
462
#else
463
#define MDBX_64BIT_CAS_CONFIG MDBX_STRINGIFY(MDBX_64BIT_CAS)
464
#endif
/* MDBX_64BIT_CAS */
465
466
#ifndef MDBX_UNALIGNED_OK
467
#if defined(__ALIGNED__) || defined(__SANITIZE_UNDEFINED__) || defined(ENABLE_UBSAN)
468
#define MDBX_UNALIGNED_OK 0
/* no unaligned access allowed */
469
#elif defined(__ARM_FEATURE_UNALIGNED)
470
#define MDBX_UNALIGNED_OK 4
/* ok unaligned for 32-bit words */
471
#elif defined(__e2k__) || defined(__elbrus__)
472
#if __iset__ > 4
473
#define MDBX_UNALIGNED_OK 8
/* ok unaligned for 64-bit words */
474
#else
475
#define MDBX_UNALIGNED_OK 4
/* ok unaligned for 32-bit words */
476
#endif
477
#elif defined(__ia32__)
478
#define MDBX_UNALIGNED_OK 8
/* ok unaligned for 64-bit words */
479
#elif __CLANG_PREREQ(5, 0) || __GNUC_PREREQ(5, 0)
480
/* expecting an optimization will well done, also this
481
* hushes false-positives from UBSAN (undefined behaviour sanitizer) */
482
#define MDBX_UNALIGNED_OK 0
483
#else
484
#define MDBX_UNALIGNED_OK 0
/* no unaligned access allowed */
485
#endif
486
#elif MDBX_UNALIGNED_OK == 1
487
#undef MDBX_UNALIGNED_OK
488
#define MDBX_UNALIGNED_OK 32
/* any unaligned access allowed */
489
#endif
/* MDBX_UNALIGNED_OK */
490
491
#ifndef MDBX_CACHELINE_SIZE
492
#if defined(SYSTEM_CACHE_ALIGNMENT_SIZE)
493
#define MDBX_CACHELINE_SIZE SYSTEM_CACHE_ALIGNMENT_SIZE
494
#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
495
#define MDBX_CACHELINE_SIZE 128
496
#else
497
#define MDBX_CACHELINE_SIZE 64
498
#endif
499
#endif
/* MDBX_CACHELINE_SIZE */
500
501
/* Max length of iov-vector passed to writev() call, used for auxilary writes */
502
#ifndef MDBX_AUXILARY_IOV_MAX
503
#define MDBX_AUXILARY_IOV_MAX 64
504
#endif
505
#if defined(IOV_MAX) && IOV_MAX < MDBX_AUXILARY_IOV_MAX
506
#undef MDBX_AUXILARY_IOV_MAX
507
#define MDBX_AUXILARY_IOV_MAX IOV_MAX
508
#endif
/* MDBX_AUXILARY_IOV_MAX */
509
510
/* An extra/custom information provided during library build */
511
#ifndef MDBX_BUILD_METADATA
512
#define MDBX_BUILD_METADATA ""
513
#endif
/* MDBX_BUILD_METADATA */
515
/*******************************************************************************
516
*******************************************************************************
517
******************************************************************************/
518
519
#ifndef DOXYGEN
520
521
/* In case the MDBX_DEBUG is undefined set it corresponding to NDEBUG */
522
#ifndef MDBX_DEBUG
523
#ifdef NDEBUG
524
#define MDBX_DEBUG 0
525
#else
526
#define MDBX_DEBUG 1
527
#endif
528
#endif
529
#if MDBX_DEBUG < 0 || MDBX_DEBUG > 2
530
#error "The MDBX_DEBUG must be defined to 0, 1 or 2"
531
#endif
/* MDBX_DEBUG */
532
533
#else
534
535
/* !!! Actually this is a fake definitions for Doxygen !!! */
536
550
#define MDBX_DEBUG 0...2
551
553
#define MDBX_DISABLE_GNU_SOURCE 0 or 1
554
555
#endif
/* DOXYGEN */
options.h
Generated by
1.14.0