2019-11-13 20:14:17 +03:00
|
|
|
|
/*******************************************************************************
|
|
|
|
|
*******************************************************************************
|
|
|
|
|
*******************************************************************************
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* #### ##### ##### # #### # # ####
|
|
|
|
|
* # # # # # # # # ## # #
|
|
|
|
|
* # # # # # # # # # # # ####
|
|
|
|
|
* # # ##### # # # # # # # #
|
|
|
|
|
* # # # # # # # # ## # #
|
|
|
|
|
* #### # # # #### # # ####
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** \defgroup build_option Build options
|
|
|
|
|
* The libmdbx build options.
|
|
|
|
|
@{ */
|
|
|
|
|
|
|
|
|
|
/** Using fcntl(F_FULLFSYNC) with 5-10 times slowdown */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#define MDBX_OSX_WANNA_DURABILITY 0
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** Using fsync() with chance of data lost on power failure */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#define MDBX_OSX_WANNA_SPEED 1
|
|
|
|
|
|
|
|
|
|
#ifndef MDBX_OSX_SPEED_INSTEADOF_DURABILITY
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** Choices \ref MDBX_OSX_WANNA_DURABILITY or \ref MDBX_OSX_WANNA_SPEED
|
|
|
|
|
* for OSX & iOS */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#define MDBX_OSX_SPEED_INSTEADOF_DURABILITY MDBX_OSX_WANNA_DURABILITY
|
|
|
|
|
#endif /* MDBX_OSX_SPEED_INSTEADOF_DURABILITY */
|
|
|
|
|
|
2023-11-11 00:00:33 +03:00
|
|
|
|
/** Controls using of POSIX' madvise() and/or similar hints. */
|
|
|
|
|
#ifndef MDBX_ENABLE_MADVISE
|
|
|
|
|
#define MDBX_ENABLE_MADVISE 1
|
|
|
|
|
#elif !(MDBX_ENABLE_MADVISE == 0 || MDBX_ENABLE_MADVISE == 1)
|
|
|
|
|
#error MDBX_ENABLE_MADVISE must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_ENABLE_MADVISE */
|
|
|
|
|
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** Controls checking PID against reuse DB environment after the fork() */
|
2020-07-22 14:53:15 +03:00
|
|
|
|
#ifndef MDBX_ENV_CHECKPID
|
2023-11-11 00:00:33 +03:00
|
|
|
|
#if (defined(MADV_DONTFORK) && MDBX_ENABLE_MADVISE) || defined(_WIN32) || \
|
|
|
|
|
defined(_WIN64)
|
2020-09-21 23:51:47 -04:00
|
|
|
|
/* PID check could be omitted:
|
2020-09-29 20:14:08 +03:00
|
|
|
|
* - on Linux when madvise(MADV_DONTFORK) is available, i.e. after the fork()
|
2019-11-13 20:14:17 +03:00
|
|
|
|
* mapped pages will not be available for child process.
|
|
|
|
|
* - in Windows where fork() not available. */
|
2020-07-22 14:53:15 +03:00
|
|
|
|
#define MDBX_ENV_CHECKPID 0
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2020-07-22 14:53:15 +03:00
|
|
|
|
#define MDBX_ENV_CHECKPID 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_ENV_CHECKPID_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_ENV_CHECKPID)
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_ENV_CHECKPID == 0 || MDBX_ENV_CHECKPID == 1)
|
|
|
|
|
#error MDBX_ENV_CHECKPID must be defined as 0 or 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_ENV_CHECKPID_CONFIG MDBX_STRINGIFY(MDBX_ENV_CHECKPID)
|
2020-07-22 14:53:15 +03:00
|
|
|
|
#endif /* MDBX_ENV_CHECKPID */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** Controls checking transaction owner thread against misuse transactions from
|
2019-11-13 20:14:17 +03:00
|
|
|
|
* other threads. */
|
|
|
|
|
#ifndef MDBX_TXN_CHECKOWNER
|
|
|
|
|
#define MDBX_TXN_CHECKOWNER 1
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_TXN_CHECKOWNER_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_TXN_CHECKOWNER)
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_TXN_CHECKOWNER == 0 || MDBX_TXN_CHECKOWNER == 1)
|
|
|
|
|
#error MDBX_TXN_CHECKOWNER must be defined as 0 or 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_TXN_CHECKOWNER_CONFIG MDBX_STRINGIFY(MDBX_TXN_CHECKOWNER)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif /* MDBX_TXN_CHECKOWNER */
|
|
|
|
|
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** Does a system have battery-backed Real-Time Clock or just a fake. */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#ifndef MDBX_TRUST_RTC
|
|
|
|
|
#if defined(__linux__) || defined(__gnu_linux__) || defined(__NetBSD__) || \
|
|
|
|
|
defined(__OpenBSD__)
|
|
|
|
|
#define MDBX_TRUST_RTC 0 /* a lot of embedded systems have a fake RTC */
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_TRUST_RTC 1
|
|
|
|
|
#endif
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_TRUST_RTC_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_TRUST_RTC)
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_TRUST_RTC == 0 || MDBX_TRUST_RTC == 1)
|
|
|
|
|
#error MDBX_TRUST_RTC must be defined as 0 or 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_TRUST_RTC_CONFIG MDBX_STRINGIFY(MDBX_TRUST_RTC)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif /* MDBX_TRUST_RTC */
|
|
|
|
|
|
2021-01-18 17:34:54 +03:00
|
|
|
|
/** Controls online database auto-compactification during write-transactions. */
|
|
|
|
|
#ifndef MDBX_ENABLE_REFUND
|
|
|
|
|
#define MDBX_ENABLE_REFUND 1
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#elif !(MDBX_ENABLE_REFUND == 0 || MDBX_ENABLE_REFUND == 1)
|
2021-01-18 17:34:54 +03:00
|
|
|
|
#error MDBX_ENABLE_REFUND must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_ENABLE_REFUND */
|
|
|
|
|
|
2022-11-06 16:35:06 +03:00
|
|
|
|
/** Controls profiling of GC search and updates. */
|
|
|
|
|
#ifndef MDBX_ENABLE_PROFGC
|
|
|
|
|
#define MDBX_ENABLE_PROFGC 0
|
|
|
|
|
#elif !(MDBX_ENABLE_PROFGC == 0 || MDBX_ENABLE_PROFGC == 1)
|
|
|
|
|
#error MDBX_ENABLE_PROFGC must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_ENABLE_PROFGC */
|
|
|
|
|
|
2021-04-27 18:02:11 +03:00
|
|
|
|
/** Controls gathering statistics for page operations. */
|
|
|
|
|
#ifndef MDBX_ENABLE_PGOP_STAT
|
|
|
|
|
#define MDBX_ENABLE_PGOP_STAT 1
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#elif !(MDBX_ENABLE_PGOP_STAT == 0 || MDBX_ENABLE_PGOP_STAT == 1)
|
2021-04-27 18:02:11 +03:00
|
|
|
|
#error MDBX_ENABLE_PGOP_STAT must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_ENABLE_PGOP_STAT */
|
|
|
|
|
|
2022-12-05 10:41:05 +03:00
|
|
|
|
/** Controls using Unix' mincore() to determine whether DB-pages
|
|
|
|
|
* are resident in memory. */
|
|
|
|
|
#ifndef MDBX_ENABLE_MINCORE
|
2023-10-29 12:20:54 +03:00
|
|
|
|
#if defined(MINCORE_INCORE) || !(defined(_WIN32) || defined(_WIN64))
|
2022-12-05 10:41:05 +03:00
|
|
|
|
#define MDBX_ENABLE_MINCORE 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_ENABLE_MINCORE 0
|
|
|
|
|
#endif
|
|
|
|
|
#elif !(MDBX_ENABLE_MINCORE == 0 || MDBX_ENABLE_MINCORE == 1)
|
|
|
|
|
#error MDBX_ENABLE_MINCORE must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_ENABLE_MINCORE */
|
|
|
|
|
|
2022-07-02 09:05:59 +03:00
|
|
|
|
/** Enables chunking long list of retired pages during huge transactions commit
|
|
|
|
|
* to avoid use sequences of pages. */
|
|
|
|
|
#ifndef MDBX_ENABLE_BIGFOOT
|
|
|
|
|
#if MDBX_WORDBITS >= 64 || defined(DOXYGEN)
|
|
|
|
|
#define MDBX_ENABLE_BIGFOOT 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_ENABLE_BIGFOOT 0
|
|
|
|
|
#endif
|
|
|
|
|
#elif !(MDBX_ENABLE_BIGFOOT == 0 || MDBX_ENABLE_BIGFOOT == 1)
|
|
|
|
|
#error MDBX_ENABLE_BIGFOOT must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_ENABLE_BIGFOOT */
|
|
|
|
|
|
2021-02-07 02:35:44 +03:00
|
|
|
|
/** Disable some checks to reduce an overhead and detection probability of
|
|
|
|
|
* database corruption to a values closer to the LMDB. */
|
2022-06-30 21:38:32 +03:00
|
|
|
|
#ifndef MDBX_DISABLE_VALIDATION
|
|
|
|
|
#define MDBX_DISABLE_VALIDATION 0
|
|
|
|
|
#elif !(MDBX_DISABLE_VALIDATION == 0 || MDBX_DISABLE_VALIDATION == 1)
|
|
|
|
|
#error MDBX_DISABLE_VALIDATION must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_DISABLE_VALIDATION */
|
2021-02-07 02:35:44 +03:00
|
|
|
|
|
2021-04-21 00:13:51 +03:00
|
|
|
|
#ifndef MDBX_PNL_PREALLOC_FOR_RADIXSORT
|
|
|
|
|
#define MDBX_PNL_PREALLOC_FOR_RADIXSORT 1
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#elif !(MDBX_PNL_PREALLOC_FOR_RADIXSORT == 0 || \
|
|
|
|
|
MDBX_PNL_PREALLOC_FOR_RADIXSORT == 1)
|
2021-04-21 00:13:51 +03:00
|
|
|
|
#error MDBX_PNL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_PNL_PREALLOC_FOR_RADIXSORT */
|
|
|
|
|
|
|
|
|
|
#ifndef MDBX_DPL_PREALLOC_FOR_RADIXSORT
|
|
|
|
|
#define MDBX_DPL_PREALLOC_FOR_RADIXSORT 1
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#elif !(MDBX_DPL_PREALLOC_FOR_RADIXSORT == 0 || \
|
|
|
|
|
MDBX_DPL_PREALLOC_FOR_RADIXSORT == 1)
|
2021-04-21 00:13:51 +03:00
|
|
|
|
#error MDBX_DPL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_DPL_PREALLOC_FOR_RADIXSORT */
|
|
|
|
|
|
2024-04-03 19:05:34 +03:00
|
|
|
|
/** Controls dirty pages tracking, spilling and persisting in `MDBX_WRITEMAP`
|
2022-09-27 02:37:28 +03:00
|
|
|
|
* mode. 0/OFF = Don't track dirty pages at all, don't spill ones, and use
|
|
|
|
|
* msync() to persist data. This is by-default on Linux and other systems where
|
|
|
|
|
* kernel provides properly LRU tracking and effective flushing on-demand. 1/ON
|
|
|
|
|
* = Tracking of dirty pages but with LRU labels for spilling and explicit
|
|
|
|
|
* persist ones by write(). This may be reasonable for systems which low
|
|
|
|
|
* performance of msync() and/or LRU tracking. */
|
|
|
|
|
#ifndef MDBX_AVOID_MSYNC
|
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
|
#define MDBX_AVOID_MSYNC 1
|
2021-04-26 18:18:51 +03:00
|
|
|
|
#else
|
2022-09-27 02:37:28 +03:00
|
|
|
|
#define MDBX_AVOID_MSYNC 0
|
2021-04-26 18:18:51 +03:00
|
|
|
|
#endif
|
2022-09-27 02:37:28 +03:00
|
|
|
|
#elif !(MDBX_AVOID_MSYNC == 0 || MDBX_AVOID_MSYNC == 1)
|
|
|
|
|
#error MDBX_AVOID_MSYNC must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_AVOID_MSYNC */
|
2021-04-26 18:18:51 +03:00
|
|
|
|
|
2024-04-03 19:05:34 +03:00
|
|
|
|
/** Управляет механизмом поддержки разреженных наборов DBI-хендлов для снижения
|
|
|
|
|
* накладных расходов при запуске и обработке транзакций. */
|
mdbx: переработка инициализации, проверки и импорта dbi-хендлов в транзакциях.
Ранее инициализация в транзакциях структур данных, связанных с
dbi-хендлами и subDb, выполнялась непосредственно при запуске
транзакций. Что в сценариях с большим кол-вом dbi-дексприторов (например
libfpta) порождало заметные накладные расходы, которые расли линейно от
общего кол-ва открытых subDb, а не от реально используемых в транзакции.
При использовании одной-двух сотен хендлов, при старте каждой транзакции
могли копироваться и/или обнуляться десятки килобайт. Теперь этот
недостаток устранен.
Изменена схема инициализации, валидации и импорта хендлов открытых после
старта транзакции:
1) Инициализация теперь выполняется отложенна, а при старте транзации
обнуляется только массив с однобайтовыми статустами dbi-хендлов.
При этом доступнва опция сборки `MDBX_ENABLE_DBI_SPARSE`, при активации
которой используется битовая карты, что снижает объем инициализации
при старте транзакции в 8 раз (CHAR_BIT).
2) Переработана валидация dbi-хендлов на входах API, с уменьшением кол-ва
проверок и ветвлений до теоретического минимума.
3) Переработ импорт dbi-хендов открытых после старта транзакци, теперь
при этом не захватывается мьютекс.
2023-11-05 22:10:29 +03:00
|
|
|
|
#ifndef MDBX_ENABLE_DBI_SPARSE
|
|
|
|
|
#define MDBX_ENABLE_DBI_SPARSE 1
|
|
|
|
|
#elif !(MDBX_ENABLE_DBI_SPARSE == 0 || MDBX_ENABLE_DBI_SPARSE == 1)
|
|
|
|
|
#error MDBX_ENABLE_DBI_SPARSE must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_ENABLE_DBI_SPARSE */
|
|
|
|
|
|
2024-04-03 19:05:34 +03:00
|
|
|
|
/** Управляет механизмом отложенного освобождения и поддержки пути быстрого
|
|
|
|
|
* открытия DBI-хендлов без захвата блокировок. */
|
2023-11-04 23:45:29 +03:00
|
|
|
|
#ifndef MDBX_ENABLE_DBI_LOCKFREE
|
|
|
|
|
#define MDBX_ENABLE_DBI_LOCKFREE 1
|
|
|
|
|
#elif !(MDBX_ENABLE_DBI_LOCKFREE == 0 || MDBX_ENABLE_DBI_LOCKFREE == 1)
|
|
|
|
|
#error MDBX_ENABLE_DBI_LOCKFREE must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_ENABLE_DBI_LOCKFREE */
|
|
|
|
|
|
2021-01-20 13:05:32 +03:00
|
|
|
|
/** Controls sort order of internal page number lists.
|
2021-04-30 02:01:22 +03:00
|
|
|
|
* This mostly experimental/advanced option with not for regular MDBX users.
|
2023-01-10 14:16:08 +03:00
|
|
|
|
* \warning The database format depend on this option and libmdbx built with
|
2021-04-30 02:01:22 +03:00
|
|
|
|
* different option value are incompatible. */
|
2021-01-20 13:05:32 +03:00
|
|
|
|
#ifndef MDBX_PNL_ASCENDING
|
|
|
|
|
#define MDBX_PNL_ASCENDING 0
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#elif !(MDBX_PNL_ASCENDING == 0 || MDBX_PNL_ASCENDING == 1)
|
2021-01-20 13:05:32 +03:00
|
|
|
|
#error MDBX_PNL_ASCENDING must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_PNL_ASCENDING */
|
|
|
|
|
|
2021-04-30 02:01:22 +03:00
|
|
|
|
/** Avoid dependence from MSVC CRT and use ntdll.dll instead. */
|
|
|
|
|
#ifndef MDBX_WITHOUT_MSVC_CRT
|
|
|
|
|
#define MDBX_WITHOUT_MSVC_CRT 1
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#elif !(MDBX_WITHOUT_MSVC_CRT == 0 || MDBX_WITHOUT_MSVC_CRT == 1)
|
2021-04-30 02:01:22 +03:00
|
|
|
|
#error MDBX_WITHOUT_MSVC_CRT must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_WITHOUT_MSVC_CRT */
|
|
|
|
|
|
|
|
|
|
/** Size of buffer used during copying a environment/database file. */
|
|
|
|
|
#ifndef MDBX_ENVCOPY_WRITEBUF
|
|
|
|
|
#define MDBX_ENVCOPY_WRITEBUF 1048576u
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#elif MDBX_ENVCOPY_WRITEBUF < 65536u || MDBX_ENVCOPY_WRITEBUF > 1073741824u || \
|
2021-04-30 02:01:22 +03:00
|
|
|
|
MDBX_ENVCOPY_WRITEBUF % 65536u
|
|
|
|
|
#error MDBX_ENVCOPY_WRITEBUF must be defined in range 65536..1073741824 and be multiple of 65536
|
|
|
|
|
#endif /* MDBX_ENVCOPY_WRITEBUF */
|
|
|
|
|
|
|
|
|
|
/** Forces assertion checking */
|
|
|
|
|
#ifndef MDBX_FORCE_ASSERTIONS
|
2021-05-06 17:03:10 +03:00
|
|
|
|
#define MDBX_FORCE_ASSERTIONS 0
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#elif !(MDBX_FORCE_ASSERTIONS == 0 || MDBX_FORCE_ASSERTIONS == 1)
|
2021-04-30 02:01:22 +03:00
|
|
|
|
#error MDBX_FORCE_ASSERTIONS must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_FORCE_ASSERTIONS */
|
|
|
|
|
|
|
|
|
|
/** Presumed malloc size overhead for each allocation
|
|
|
|
|
* to adjust allocations to be more aligned. */
|
|
|
|
|
#ifndef MDBX_ASSUME_MALLOC_OVERHEAD
|
2021-05-03 14:44:15 +03:00
|
|
|
|
#ifdef __SIZEOF_POINTER__
|
|
|
|
|
#define MDBX_ASSUME_MALLOC_OVERHEAD (__SIZEOF_POINTER__ * 2u)
|
|
|
|
|
#else
|
2021-04-30 02:01:22 +03:00
|
|
|
|
#define MDBX_ASSUME_MALLOC_OVERHEAD (sizeof(void *) * 2u)
|
2021-05-03 14:44:15 +03:00
|
|
|
|
#endif
|
2021-04-30 02:01:22 +03:00
|
|
|
|
#elif MDBX_ASSUME_MALLOC_OVERHEAD < 0 || MDBX_ASSUME_MALLOC_OVERHEAD > 64 || \
|
|
|
|
|
MDBX_ASSUME_MALLOC_OVERHEAD % 4
|
|
|
|
|
#error MDBX_ASSUME_MALLOC_OVERHEAD must be defined in range 0..64 and be multiple of 4
|
|
|
|
|
#endif /* MDBX_ASSUME_MALLOC_OVERHEAD */
|
|
|
|
|
|
|
|
|
|
/** If defined then enables integration with Valgrind,
|
|
|
|
|
* a memory analyzing tool. */
|
2023-11-02 16:54:32 +03:00
|
|
|
|
#ifndef ENABLE_MEMCHECK
|
|
|
|
|
#endif /* ENABLE_MEMCHECK */
|
2021-04-30 02:01:22 +03:00
|
|
|
|
|
|
|
|
|
/** If defined then enables use C11 atomics,
|
|
|
|
|
* otherwise detects ones availability automatically. */
|
|
|
|
|
#ifndef MDBX_HAVE_C11ATOMICS
|
|
|
|
|
#endif /* MDBX_HAVE_C11ATOMICS */
|
|
|
|
|
|
2022-08-26 18:52:35 +03:00
|
|
|
|
/** If defined then enables use the GCC's `__builtin_cpu_supports()`
|
2023-02-14 12:09:44 +03:00
|
|
|
|
* for runtime dispatching depending on the CPU's capabilities.
|
|
|
|
|
* \note Defining `MDBX_HAVE_BUILTIN_CPU_SUPPORTS` to `0` should avoided unless
|
|
|
|
|
* build for particular single-target platform, since on AMD64/x86 this disables
|
|
|
|
|
* dynamic choice (at runtime) of SSE2 / AVX2 / AVX512 instructions
|
|
|
|
|
* with fallback to non-accelerated baseline code. */
|
2022-08-26 18:52:35 +03:00
|
|
|
|
#ifndef MDBX_HAVE_BUILTIN_CPU_SUPPORTS
|
|
|
|
|
#if defined(__APPLE__) || defined(BIONIC)
|
|
|
|
|
/* Never use any modern features on Apple's or Google's OSes
|
|
|
|
|
* since a lot of troubles with compatibility and/or performance */
|
|
|
|
|
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
|
2022-10-06 20:50:49 +03:00
|
|
|
|
#elif defined(__e2k__)
|
|
|
|
|
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
|
2022-08-26 18:52:35 +03:00
|
|
|
|
#elif __has_builtin(__builtin_cpu_supports) || \
|
|
|
|
|
defined(__BUILTIN_CPU_SUPPORTS__) || \
|
|
|
|
|
(defined(__ia32__) && __GNUC_PREREQ(4, 8) && __GLIBC_PREREQ(2, 23))
|
|
|
|
|
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0
|
|
|
|
|
#endif
|
|
|
|
|
#elif !(MDBX_HAVE_BUILTIN_CPU_SUPPORTS == 0 || \
|
|
|
|
|
MDBX_HAVE_BUILTIN_CPU_SUPPORTS == 1)
|
|
|
|
|
#error MDBX_HAVE_BUILTIN_CPU_SUPPORTS must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_HAVE_BUILTIN_CPU_SUPPORTS */
|
|
|
|
|
|
2019-11-13 20:14:17 +03:00
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** Win32 File Locking API for \ref MDBX_LOCKING */
|
|
|
|
|
#define MDBX_LOCKING_WIN32FILES -1
|
|
|
|
|
|
|
|
|
|
/** SystemV IPC semaphores for \ref MDBX_LOCKING */
|
|
|
|
|
#define MDBX_LOCKING_SYSV 5
|
|
|
|
|
|
|
|
|
|
/** POSIX-1 Shared anonymous semaphores for \ref MDBX_LOCKING */
|
|
|
|
|
#define MDBX_LOCKING_POSIX1988 1988
|
|
|
|
|
|
|
|
|
|
/** POSIX-2001 Shared Mutexes for \ref MDBX_LOCKING */
|
|
|
|
|
#define MDBX_LOCKING_POSIX2001 2001
|
|
|
|
|
|
|
|
|
|
/** POSIX-2008 Robust Mutexes for \ref MDBX_LOCKING */
|
|
|
|
|
#define MDBX_LOCKING_POSIX2008 2008
|
|
|
|
|
|
|
|
|
|
/** BeOS Benaphores, aka Futexes for \ref MDBX_LOCKING */
|
|
|
|
|
#define MDBX_LOCKING_BENAPHORE 1995
|
2019-11-13 20:14:17 +03:00
|
|
|
|
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** Advanced: Choices the locking implementation (autodetection by default). */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
|
#define MDBX_LOCKING MDBX_LOCKING_WIN32FILES
|
|
|
|
|
#else
|
|
|
|
|
#ifndef MDBX_LOCKING
|
|
|
|
|
#if defined(_POSIX_THREAD_PROCESS_SHARED) && \
|
|
|
|
|
_POSIX_THREAD_PROCESS_SHARED >= 200112L && !defined(__FreeBSD__)
|
|
|
|
|
|
|
|
|
|
/* Some platforms define the EOWNERDEAD error code even though they
|
|
|
|
|
* don't support Robust Mutexes. If doubt compile with -MDBX_LOCKING=2001. */
|
|
|
|
|
#if defined(EOWNERDEAD) && _POSIX_THREAD_PROCESS_SHARED >= 200809L && \
|
2020-04-13 22:46:55 +03:00
|
|
|
|
((defined(_POSIX_THREAD_ROBUST_PRIO_INHERIT) && \
|
|
|
|
|
_POSIX_THREAD_ROBUST_PRIO_INHERIT > 0) || \
|
|
|
|
|
(defined(_POSIX_THREAD_ROBUST_PRIO_PROTECT) && \
|
|
|
|
|
_POSIX_THREAD_ROBUST_PRIO_PROTECT > 0) || \
|
2019-11-13 20:14:17 +03:00
|
|
|
|
defined(PTHREAD_MUTEX_ROBUST) || defined(PTHREAD_MUTEX_ROBUST_NP)) && \
|
|
|
|
|
(!defined(__GLIBC__) || \
|
|
|
|
|
__GLIBC_PREREQ(2, 10) /* troubles with Robust mutexes before 2.10 */)
|
|
|
|
|
#define MDBX_LOCKING MDBX_LOCKING_POSIX2008
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_LOCKING MDBX_LOCKING_POSIX2001
|
|
|
|
|
#endif
|
|
|
|
|
#elif defined(__sun) || defined(__SVR4) || defined(__svr4__)
|
|
|
|
|
#define MDBX_LOCKING MDBX_LOCKING_POSIX1988
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_LOCKING MDBX_LOCKING_SYSV
|
|
|
|
|
#endif
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_LOCKING_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_LOCKING)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_LOCKING_CONFIG MDBX_STRINGIFY(MDBX_LOCKING)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif /* MDBX_LOCKING */
|
|
|
|
|
#endif /* !Windows */
|
|
|
|
|
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** Advanced: Using POSIX OFD-locks (autodetection by default). */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#ifndef MDBX_USE_OFDLOCKS
|
2022-10-12 20:47:22 +03:00
|
|
|
|
#if ((defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && \
|
|
|
|
|
defined(F_OFD_GETLK)) || \
|
|
|
|
|
(defined(F_OFD_SETLK64) && defined(F_OFD_SETLKW64) && \
|
|
|
|
|
defined(F_OFD_GETLK64))) && \
|
2019-11-13 20:14:17 +03:00
|
|
|
|
!defined(MDBX_SAFE4QEMU) && \
|
|
|
|
|
!defined(__sun) /* OFD-lock are broken on Solaris */
|
|
|
|
|
#define MDBX_USE_OFDLOCKS 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_USE_OFDLOCKS 0
|
|
|
|
|
#endif
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_USE_OFDLOCKS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_USE_OFDLOCKS == 0 || MDBX_USE_OFDLOCKS == 1)
|
|
|
|
|
#error MDBX_USE_OFDLOCKS must be defined as 0 or 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_USE_OFDLOCKS_CONFIG MDBX_STRINGIFY(MDBX_USE_OFDLOCKS)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif /* MDBX_USE_OFDLOCKS */
|
|
|
|
|
|
2020-09-20 20:16:26 +03:00
|
|
|
|
/** Advanced: Using sendfile() syscall (autodetection by default). */
|
|
|
|
|
#ifndef MDBX_USE_SENDFILE
|
2020-09-20 20:49:53 +03:00
|
|
|
|
#if ((defined(__linux__) || defined(__gnu_linux__)) && \
|
2020-09-27 12:50:13 +03:00
|
|
|
|
!defined(__ANDROID_API__)) || \
|
2020-09-20 20:49:53 +03:00
|
|
|
|
(defined(__ANDROID_API__) && __ANDROID_API__ >= 21)
|
2020-09-20 20:16:26 +03:00
|
|
|
|
#define MDBX_USE_SENDFILE 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_USE_SENDFILE 0
|
|
|
|
|
#endif
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_USE_SENDFILE == 0 || MDBX_USE_SENDFILE == 1)
|
|
|
|
|
#error MDBX_USE_SENDFILE must be defined as 0 or 1
|
2020-09-20 20:16:26 +03:00
|
|
|
|
#endif /* MDBX_USE_SENDFILE */
|
|
|
|
|
|
|
|
|
|
/** Advanced: Using copy_file_range() syscall (autodetection by default). */
|
|
|
|
|
#ifndef MDBX_USE_COPYFILERANGE
|
2020-09-20 20:49:53 +03:00
|
|
|
|
#if __GLIBC_PREREQ(2, 27) && defined(_GNU_SOURCE)
|
2020-09-20 20:16:26 +03:00
|
|
|
|
#define MDBX_USE_COPYFILERANGE 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_USE_COPYFILERANGE 0
|
|
|
|
|
#endif
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_USE_COPYFILERANGE == 0 || MDBX_USE_COPYFILERANGE == 1)
|
|
|
|
|
#error MDBX_USE_COPYFILERANGE must be defined as 0 or 1
|
2020-09-20 20:16:26 +03:00
|
|
|
|
#endif /* MDBX_USE_COPYFILERANGE */
|
|
|
|
|
|
2020-09-21 03:03:20 +03:00
|
|
|
|
/** Advanced: Using sync_file_range() syscall (autodetection by default). */
|
|
|
|
|
#ifndef MDBX_USE_SYNCFILERANGE
|
2020-09-27 12:50:13 +03:00
|
|
|
|
#if ((defined(__linux__) || defined(__gnu_linux__)) && \
|
|
|
|
|
defined(SYNC_FILE_RANGE_WRITE) && !defined(__ANDROID_API__)) || \
|
2020-09-21 03:27:40 +03:00
|
|
|
|
(defined(__ANDROID_API__) && __ANDROID_API__ >= 26)
|
2020-09-21 03:03:20 +03:00
|
|
|
|
#define MDBX_USE_SYNCFILERANGE 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_USE_SYNCFILERANGE 0
|
|
|
|
|
#endif
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_USE_SYNCFILERANGE == 0 || MDBX_USE_SYNCFILERANGE == 1)
|
|
|
|
|
#error MDBX_USE_SYNCFILERANGE must be defined as 0 or 1
|
2020-09-21 03:03:20 +03:00
|
|
|
|
#endif /* MDBX_USE_SYNCFILERANGE */
|
|
|
|
|
|
2019-11-13 20:14:17 +03:00
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#ifndef MDBX_CPU_WRITEBACK_INCOHERENT
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#if defined(__ia32__) || defined(__e2k__) || defined(__hppa) || \
|
2020-07-28 15:05:35 +03:00
|
|
|
|
defined(__hppa__) || defined(DOXYGEN)
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#define MDBX_CPU_WRITEBACK_INCOHERENT 0
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#define MDBX_CPU_WRITEBACK_INCOHERENT 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_CPU_WRITEBACK_INCOHERENT == 0 || \
|
|
|
|
|
MDBX_CPU_WRITEBACK_INCOHERENT == 1)
|
|
|
|
|
#error MDBX_CPU_WRITEBACK_INCOHERENT must be defined as 0 or 1
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#endif /* MDBX_CPU_WRITEBACK_INCOHERENT */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#ifndef MDBX_MMAP_INCOHERENT_FILE_WRITE
|
|
|
|
|
#ifdef __OpenBSD__
|
|
|
|
|
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_MMAP_INCOHERENT_FILE_WRITE 0
|
|
|
|
|
#endif
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_MMAP_INCOHERENT_FILE_WRITE == 0 || \
|
|
|
|
|
MDBX_MMAP_INCOHERENT_FILE_WRITE == 1)
|
|
|
|
|
#error MDBX_MMAP_INCOHERENT_FILE_WRITE must be defined as 0 or 1
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#endif /* MDBX_MMAP_INCOHERENT_FILE_WRITE */
|
|
|
|
|
|
|
|
|
|
#ifndef MDBX_MMAP_INCOHERENT_CPU_CACHE
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#if defined(__mips) || defined(__mips__) || defined(__mips64) || \
|
|
|
|
|
defined(__mips64__) || defined(_M_MRX000) || defined(_MIPS_) || \
|
|
|
|
|
defined(__MWERKS__) || defined(__sgi)
|
|
|
|
|
/* MIPS has cache coherency issues. */
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
|
|
|
|
/* LY: assume no relevant mmap/dcache issues. */
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#define MDBX_MMAP_INCOHERENT_CPU_CACHE 0
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_MMAP_INCOHERENT_CPU_CACHE == 0 || \
|
|
|
|
|
MDBX_MMAP_INCOHERENT_CPU_CACHE == 1)
|
|
|
|
|
#error MDBX_MMAP_INCOHERENT_CPU_CACHE must be defined as 0 or 1
|
2019-11-13 22:12:09 +03:00
|
|
|
|
#endif /* MDBX_MMAP_INCOHERENT_CPU_CACHE */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
|
2022-12-13 20:04:37 +03:00
|
|
|
|
#ifndef MDBX_MMAP_USE_MS_ASYNC
|
|
|
|
|
#if MDBX_MMAP_INCOHERENT_FILE_WRITE || MDBX_MMAP_INCOHERENT_CPU_CACHE
|
|
|
|
|
#define MDBX_MMAP_USE_MS_ASYNC 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_MMAP_USE_MS_ASYNC 0
|
|
|
|
|
#endif
|
|
|
|
|
#elif !(MDBX_MMAP_USE_MS_ASYNC == 0 || MDBX_MMAP_USE_MS_ASYNC == 1)
|
|
|
|
|
#error MDBX_MMAP_USE_MS_ASYNC must be defined as 0 or 1
|
|
|
|
|
#endif /* MDBX_MMAP_USE_MS_ASYNC */
|
|
|
|
|
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#ifndef MDBX_64BIT_ATOMIC
|
2020-07-28 15:05:35 +03:00
|
|
|
|
#if MDBX_WORDBITS >= 64 || defined(DOXYGEN)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#define MDBX_64BIT_ATOMIC 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_64BIT_ATOMIC 0
|
|
|
|
|
#endif
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_64BIT_ATOMIC_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_64BIT_ATOMIC == 0 || MDBX_64BIT_ATOMIC == 1)
|
|
|
|
|
#error MDBX_64BIT_ATOMIC must be defined as 0 or 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_64BIT_ATOMIC_CONFIG MDBX_STRINGIFY(MDBX_64BIT_ATOMIC)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif /* MDBX_64BIT_ATOMIC */
|
|
|
|
|
|
|
|
|
|
#ifndef MDBX_64BIT_CAS
|
2022-10-13 17:36:53 +03:00
|
|
|
|
#if defined(__GCC_ATOMIC_LLONG_LOCK_FREE)
|
|
|
|
|
#if __GCC_ATOMIC_LLONG_LOCK_FREE > 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#define MDBX_64BIT_CAS 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_64BIT_CAS 0
|
|
|
|
|
#endif
|
2022-10-13 17:36:53 +03:00
|
|
|
|
#elif defined(__CLANG_ATOMIC_LLONG_LOCK_FREE)
|
|
|
|
|
#if __CLANG_ATOMIC_LLONG_LOCK_FREE > 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#define MDBX_64BIT_CAS 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_64BIT_CAS 0
|
|
|
|
|
#endif
|
2022-10-13 17:36:53 +03:00
|
|
|
|
#elif defined(ATOMIC_LLONG_LOCK_FREE)
|
|
|
|
|
#if ATOMIC_LLONG_LOCK_FREE > 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#define MDBX_64BIT_CAS 1
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_64BIT_CAS 0
|
|
|
|
|
#endif
|
2020-07-28 15:05:35 +03:00
|
|
|
|
#elif defined(_MSC_VER) || defined(__APPLE__) || defined(DOXYGEN)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#define MDBX_64BIT_CAS 1
|
2022-12-13 19:44:36 +03:00
|
|
|
|
#elif !(MDBX_64BIT_CAS == 0 || MDBX_64BIT_CAS == 1)
|
|
|
|
|
#error MDBX_64BIT_CAS must be defined as 0 or 1
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
|
|
|
|
#define MDBX_64BIT_CAS MDBX_64BIT_ATOMIC
|
|
|
|
|
#endif
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_64BIT_CAS_CONFIG "AUTO=" MDBX_STRINGIFY(MDBX_64BIT_CAS)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#else
|
2021-07-25 15:11:05 +03:00
|
|
|
|
#define MDBX_64BIT_CAS_CONFIG MDBX_STRINGIFY(MDBX_64BIT_CAS)
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif /* MDBX_64BIT_CAS */
|
|
|
|
|
|
2021-05-03 14:22:01 +03:00
|
|
|
|
#ifndef MDBX_UNALIGNED_OK
|
2022-07-11 23:06:09 +03:00
|
|
|
|
#if defined(__ALIGNED__) || defined(__SANITIZE_UNDEFINED__) || \
|
|
|
|
|
defined(ENABLE_UBSAN)
|
2022-02-09 13:30:23 +03:00
|
|
|
|
#define MDBX_UNALIGNED_OK 0 /* no unaligned access allowed */
|
|
|
|
|
#elif defined(__ARM_FEATURE_UNALIGNED)
|
|
|
|
|
#define MDBX_UNALIGNED_OK 4 /* ok unaligned for 32-bit words */
|
|
|
|
|
#elif defined(__e2k__) || defined(__elbrus__)
|
|
|
|
|
#if __iset__ > 4
|
|
|
|
|
#define MDBX_UNALIGNED_OK 8 /* ok unaligned for 64-bit words */
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_UNALIGNED_OK 4 /* ok unaligned for 32-bit words */
|
|
|
|
|
#endif
|
|
|
|
|
#elif defined(__ia32__)
|
|
|
|
|
#define MDBX_UNALIGNED_OK 8 /* ok unaligned for 64-bit words */
|
2022-07-11 23:06:09 +03:00
|
|
|
|
#elif __CLANG_PREREQ(5, 0) || __GNUC_PREREQ(5, 0)
|
|
|
|
|
/* expecting an optimization will well done, also this
|
|
|
|
|
* hushes false-positives from UBSAN (undefined behaviour sanitizer) */
|
|
|
|
|
#define MDBX_UNALIGNED_OK 0
|
2022-02-09 13:30:23 +03:00
|
|
|
|
#else
|
|
|
|
|
#define MDBX_UNALIGNED_OK 0 /* no unaligned access allowed */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
#endif
|
2022-02-09 13:30:23 +03:00
|
|
|
|
#elif MDBX_UNALIGNED_OK == 1
|
|
|
|
|
#undef MDBX_UNALIGNED_OK
|
|
|
|
|
#define MDBX_UNALIGNED_OK 32 /* any unaligned access allowed */
|
|
|
|
|
#endif /* MDBX_UNALIGNED_OK */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
|
|
|
|
|
#ifndef MDBX_CACHELINE_SIZE
|
|
|
|
|
#if defined(SYSTEM_CACHE_ALIGNMENT_SIZE)
|
|
|
|
|
#define MDBX_CACHELINE_SIZE SYSTEM_CACHE_ALIGNMENT_SIZE
|
|
|
|
|
#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
|
|
|
|
|
#define MDBX_CACHELINE_SIZE 128
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_CACHELINE_SIZE 64
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* MDBX_CACHELINE_SIZE */
|
|
|
|
|
|
2020-07-28 15:05:35 +03:00
|
|
|
|
/** @} end of build options */
|
2019-11-13 20:14:17 +03:00
|
|
|
|
/*******************************************************************************
|
|
|
|
|
*******************************************************************************
|
|
|
|
|
******************************************************************************/
|
2021-04-30 02:01:22 +03:00
|
|
|
|
|
2022-05-03 12:05:16 +03:00
|
|
|
|
#ifndef DOXYGEN
|
|
|
|
|
|
|
|
|
|
/* In case the MDBX_DEBUG is undefined set it corresponding to NDEBUG */
|
|
|
|
|
#ifndef MDBX_DEBUG
|
|
|
|
|
#ifdef NDEBUG
|
|
|
|
|
#define MDBX_DEBUG 0
|
|
|
|
|
#else
|
|
|
|
|
#define MDBX_DEBUG 1
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* MDBX_DEBUG */
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
/* !!! Actually this is a fake definitions for Doxygen !!! */
|
2021-04-30 02:01:22 +03:00
|
|
|
|
|
|
|
|
|
/** Controls enabling of debugging features.
|
|
|
|
|
*
|
|
|
|
|
* - `MDBX_DEBUG = 0` (by default) Disables any debugging features at all,
|
|
|
|
|
* including logging and assertion controls.
|
|
|
|
|
* Logging level and corresponding debug flags changing
|
|
|
|
|
* by \ref mdbx_setup_debug() will not have effect.
|
|
|
|
|
* - `MDBX_DEBUG > 0` Enables code for the debugging features (logging,
|
|
|
|
|
* assertions checking and internal audit).
|
|
|
|
|
* Simultaneously sets the default logging level
|
|
|
|
|
* to the `MDBX_DEBUG` value.
|
|
|
|
|
* Also enables \ref MDBX_DBG_AUDIT if `MDBX_DEBUG >= 2`.
|
|
|
|
|
*
|
|
|
|
|
* \ingroup build_option */
|
|
|
|
|
#define MDBX_DEBUG 0...7
|
|
|
|
|
|
|
|
|
|
/** Disables using of GNU libc extensions. */
|
|
|
|
|
#define MDBX_DISABLE_GNU_SOURCE 0 or 1
|
|
|
|
|
|
|
|
|
|
#endif /* DOXYGEN */
|