libmdbx
0.14.1.177 (2025-12-04T00:18:57+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 && (defined(_WIN32) || defined(_WIN64))
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
!defined(__OHOS__)
/* Harmony OS doesn't support robust mutexes at the end of 2025 */
308
#define MDBX_LOCKING MDBX_LOCKING_POSIX2008
309
#else
310
#define MDBX_LOCKING MDBX_LOCKING_POSIX2001
311
#endif
312
#elif defined(__sun) || defined(__SVR4) || defined(__svr4__)
313
#define MDBX_LOCKING MDBX_LOCKING_POSIX1988
314
#else
315
#define MDBX_LOCKING MDBX_LOCKING_SYSV
316
#endif
317
#define MDBX_LOCKING_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_LOCKING)
318
#else
319
#define MDBX_LOCKING_CONFIG MDBX_STRINGIFY(MDBX_LOCKING)
320
#endif
/* MDBX_LOCKING */
321
#endif
/* !Windows */
322
324
#ifndef MDBX_USE_OFDLOCKS
325
#if ((defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK)) || \
326
(defined(F_OFD_SETLK64) && defined(F_OFD_SETLKW64) && defined(F_OFD_GETLK64))) && \
327
!defined(MDBX_SAFE4QEMU) && !defined(__sun)
/* OFD-lock are broken on Solaris */
328
#define MDBX_USE_OFDLOCKS 1
329
#else
330
#define MDBX_USE_OFDLOCKS 0
331
#endif
332
#define MDBX_USE_OFDLOCKS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
333
#elif !(MDBX_USE_OFDLOCKS == 0 || MDBX_USE_OFDLOCKS == 1)
334
#error MDBX_USE_OFDLOCKS must be defined as 0 or 1
335
#else
336
#define MDBX_USE_OFDLOCKS_CONFIG MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
337
#endif
/* MDBX_USE_OFDLOCKS */
338
340
#ifndef MDBX_USE_SENDFILE
341
#if ((defined(__linux__) || defined(__gnu_linux__)) && !defined(__ANDROID_API__)) || \
342
(defined(__ANDROID_API__) && __ANDROID_API__ >= 21)
343
#define MDBX_USE_SENDFILE 1
344
#else
345
#define MDBX_USE_SENDFILE 0
346
#endif
347
#elif !(MDBX_USE_SENDFILE == 0 || MDBX_USE_SENDFILE == 1)
348
#error MDBX_USE_SENDFILE must be defined as 0 or 1
349
#endif
/* MDBX_USE_SENDFILE */
350
352
#ifndef MDBX_USE_COPYFILERANGE
353
#if __GLIBC_PREREQ(2, 27) && defined(_GNU_SOURCE)
354
#define MDBX_USE_COPYFILERANGE 1
355
#else
356
#define MDBX_USE_COPYFILERANGE 0
357
#endif
358
#elif !(MDBX_USE_COPYFILERANGE == 0 || MDBX_USE_COPYFILERANGE == 1)
359
#error MDBX_USE_COPYFILERANGE must be defined as 0 or 1
360
#endif
/* MDBX_USE_COPYFILERANGE */
361
363
#ifndef MDBX_USE_FALLOCATE
364
#if defined(__APPLE__)
365
#define MDBX_USE_FALLOCATE 0
/* Too slow and unclean, but not required to prevent SIGBUS */
366
#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (__GLIBC_PREREQ(2, 10) && defined(_GNU_SOURCE))
367
#define MDBX_USE_FALLOCATE 1
368
#else
369
#define MDBX_USE_FALLOCATE 0
370
#endif
371
#define MDBX_USE_FALLOCATE_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_FALLOCATE)
372
#elif !(MDBX_USE_FALLOCATE == 0 || MDBX_USE_FALLOCATE == 1)
373
#error MDBX_USE_FALLOCATE must be defined as 0 or 1
374
#else
375
#define MDBX_USE_FALLOCATE_CONFIG MDBX_STRINGIFY(MDBX_USE_FALLOCATE)
376
#endif
/* MDBX_USE_FALLOCATE */
377
378
//------------------------------------------------------------------------------
379
380
#ifndef MDBX_CPU_WRITEBACK_INCOHERENT
381
#if defined(__ia32__) || defined(__e2k__) || defined(__hppa) || defined(__hppa__) || defined(DOXYGEN)
382
#define MDBX_CPU_WRITEBACK_INCOHERENT 0
383
#else
384
#define MDBX_CPU_WRITEBACK_INCOHERENT 1
385
#endif
386
#elif !(MDBX_CPU_WRITEBACK_INCOHERENT == 0 || MDBX_CPU_WRITEBACK_INCOHERENT == 1)
387
#error MDBX_CPU_WRITEBACK_INCOHERENT must be defined as 0 or 1
388
#endif
/* MDBX_CPU_WRITEBACK_INCOHERENT */
389
390
#ifndef MDBX_MMAP_INCOHERENT_FILE_WRITE
391
#ifdef __OpenBSD__
392
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 1
393
#else
394
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 0
395
#endif
396
#elif !(MDBX_MMAP_INCOHERENT_FILE_WRITE == 0 || MDBX_MMAP_INCOHERENT_FILE_WRITE == 1)
397
#error MDBX_MMAP_INCOHERENT_FILE_WRITE must be defined as 0 or 1
398
#endif
/* MDBX_MMAP_INCOHERENT_FILE_WRITE */
399
400
#ifndef MDBX_MMAP_INCOHERENT_CPU_CACHE
401
#if defined(__mips) || defined(__mips__) || defined(__mips64) || defined(__mips64__) || defined(_M_MRX000) || \
402
defined(_MIPS_) || defined(__MWERKS__) || defined(__sgi)
403
/* MIPS has cache coherency issues. */
404
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 1
405
#else
406
/* LY: assume no relevant mmap/dcache issues. */
407
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 0
408
#endif
409
#elif !(MDBX_MMAP_INCOHERENT_CPU_CACHE == 0 || MDBX_MMAP_INCOHERENT_CPU_CACHE == 1)
410
#error MDBX_MMAP_INCOHERENT_CPU_CACHE must be defined as 0 or 1
411
#endif
/* MDBX_MMAP_INCOHERENT_CPU_CACHE */
412
415
#ifndef MDBX_MMAP_NEEDS_JOLT
416
#if MDBX_MMAP_INCOHERENT_FILE_WRITE || MDBX_MMAP_INCOHERENT_CPU_CACHE || !(defined(__linux__) || defined(__gnu_linux__))
417
#define MDBX_MMAP_NEEDS_JOLT 1
418
#else
419
#define MDBX_MMAP_NEEDS_JOLT 0
420
#endif
421
#define MDBX_MMAP_NEEDS_JOLT_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_MMAP_NEEDS_JOLT)
422
#elif !(MDBX_MMAP_NEEDS_JOLT == 0 || MDBX_MMAP_NEEDS_JOLT == 1)
423
#error MDBX_MMAP_NEEDS_JOLT must be defined as 0 or 1
424
#endif
/* MDBX_MMAP_NEEDS_JOLT */
425
426
#ifndef MDBX_64BIT_ATOMIC
427
#if MDBX_WORDBITS >= 64 || defined(DOXYGEN)
428
#define MDBX_64BIT_ATOMIC 1
429
#else
430
#define MDBX_64BIT_ATOMIC 0
431
#endif
432
#define MDBX_64BIT_ATOMIC_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
433
#elif !(MDBX_64BIT_ATOMIC == 0 || MDBX_64BIT_ATOMIC == 1)
434
#error MDBX_64BIT_ATOMIC must be defined as 0 or 1
435
#else
436
#define MDBX_64BIT_ATOMIC_CONFIG MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
437
#endif
/* MDBX_64BIT_ATOMIC */
438
439
#ifndef MDBX_64BIT_CAS
440
#if defined(__GCC_ATOMIC_LLONG_LOCK_FREE)
441
#if __GCC_ATOMIC_LLONG_LOCK_FREE > 1
442
#define MDBX_64BIT_CAS 1
443
#else
444
#define MDBX_64BIT_CAS 0
445
#endif
446
#elif defined(__CLANG_ATOMIC_LLONG_LOCK_FREE)
447
#if __CLANG_ATOMIC_LLONG_LOCK_FREE > 1
448
#define MDBX_64BIT_CAS 1
449
#else
450
#define MDBX_64BIT_CAS 0
451
#endif
452
#elif defined(ATOMIC_LLONG_LOCK_FREE)
453
#if ATOMIC_LLONG_LOCK_FREE > 1
454
#define MDBX_64BIT_CAS 1
455
#else
456
#define MDBX_64BIT_CAS 0
457
#endif
458
#elif defined(_MSC_VER) || defined(__APPLE__) || defined(DOXYGEN)
459
#define MDBX_64BIT_CAS 1
460
#elif !(MDBX_64BIT_CAS == 0 || MDBX_64BIT_CAS == 1)
461
#error MDBX_64BIT_CAS must be defined as 0 or 1
462
#else
463
#define MDBX_64BIT_CAS MDBX_64BIT_ATOMIC
464
#endif
465
#define MDBX_64BIT_CAS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_CAS)
466
#else
467
#define MDBX_64BIT_CAS_CONFIG MDBX_STRINGIFY(MDBX_64BIT_CAS)
468
#endif
/* MDBX_64BIT_CAS */
469
470
#ifndef MDBX_UNALIGNED_OK
471
#if defined(__ALIGNED__) || defined(__SANITIZE_UNDEFINED__) || defined(ENABLE_UBSAN)
472
#define MDBX_UNALIGNED_OK 0
/* no unaligned access allowed */
473
#elif defined(__ARM_FEATURE_UNALIGNED)
474
#define MDBX_UNALIGNED_OK 4
/* ok unaligned for 32-bit words */
475
#elif defined(__e2k__) || defined(__elbrus__)
476
#if __iset__ > 4
477
#define MDBX_UNALIGNED_OK 8
/* ok unaligned for 64-bit words */
478
#else
479
#define MDBX_UNALIGNED_OK 4
/* ok unaligned for 32-bit words */
480
#endif
481
#elif defined(__ia32__)
482
#define MDBX_UNALIGNED_OK 8
/* ok unaligned for 64-bit words */
483
#elif __CLANG_PREREQ(5, 0) || __GNUC_PREREQ(5, 0)
484
/* expecting an optimization will well done, also this
485
* hushes false-positives from UBSAN (undefined behaviour sanitizer) */
486
#define MDBX_UNALIGNED_OK 0
487
#else
488
#define MDBX_UNALIGNED_OK 0
/* no unaligned access allowed */
489
#endif
490
#elif MDBX_UNALIGNED_OK == 1
491
#undef MDBX_UNALIGNED_OK
492
#define MDBX_UNALIGNED_OK 32
/* any unaligned access allowed */
493
#endif
/* MDBX_UNALIGNED_OK */
494
495
#ifndef MDBX_CACHELINE_SIZE
496
#if defined(SYSTEM_CACHE_ALIGNMENT_SIZE)
497
#define MDBX_CACHELINE_SIZE SYSTEM_CACHE_ALIGNMENT_SIZE
498
#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
499
#define MDBX_CACHELINE_SIZE 128
500
#else
501
#define MDBX_CACHELINE_SIZE 64
502
#endif
503
#endif
/* MDBX_CACHELINE_SIZE */
504
505
/* Max length of iov-vector passed to writev() call, used for auxilary writes */
506
#ifndef MDBX_AUXILARY_IOV_MAX
507
#define MDBX_AUXILARY_IOV_MAX 64
508
#endif
509
#if defined(IOV_MAX) && IOV_MAX < MDBX_AUXILARY_IOV_MAX
510
#undef MDBX_AUXILARY_IOV_MAX
511
#define MDBX_AUXILARY_IOV_MAX IOV_MAX
512
#endif
/* MDBX_AUXILARY_IOV_MAX */
513
514
/* An extra/custom information provided during library build */
515
#ifndef MDBX_BUILD_METADATA
516
#define MDBX_BUILD_METADATA ""
517
#endif
/* MDBX_BUILD_METADATA */
519
/*******************************************************************************
520
*******************************************************************************
521
******************************************************************************/
522
523
#ifndef DOXYGEN
524
525
/* In case the MDBX_DEBUG is undefined set it corresponding to NDEBUG */
526
#ifndef MDBX_DEBUG
527
#ifdef NDEBUG
528
#define MDBX_DEBUG 0
529
#else
530
#define MDBX_DEBUG 1
531
#endif
532
#endif
533
#if MDBX_DEBUG < 0 || MDBX_DEBUG > 2
534
#error "The MDBX_DEBUG must be defined to 0, 1 or 2"
535
#endif
/* MDBX_DEBUG */
536
537
#else
538
539
/* !!! Actually this is a fake definitions for Doxygen !!! */
540
554
#define MDBX_DEBUG 0...2
555
557
#define MDBX_DISABLE_GNU_SOURCE 0 or 1
558
559
#endif
/* DOXYGEN */
options.h
Generated by
1.14.0