From a51bec9582771601cccc2fbeb63adc51d956b5b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Sun, 26 Oct 2025 17:50:49 +0300 Subject: [PATCH] mdbx: minor workaround for HarmonyOS's bug (backport). The libc from HarmonyOS SDK erroneously defines `EOWNERDEAD`, `_POSIX_THREAD_PROCESS_SHARED >= 200809` and `PTHREAD_MUTEX_ROBUST` but the same time doesn't provide `pthread_mutexattr_setrobust()` and `pthread_mutex_consistent()`. This commit add a minor workaround for such bug for successful building without explicitly defining `MDBX_LOCKING=2001`. Related to https://github.com/erthink/libmdbx/issues/285, https://github.com/vorot93/libmdbx-rs/issues/41, https://github.com/isar-community/isar-community/issues/28. --- src/options.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/options.h b/src/options.h index 9e6e8c9b..534dc2d1 100644 --- a/src/options.h +++ b/src/options.h @@ -295,7 +295,8 @@ ((defined(_POSIX_THREAD_ROBUST_PRIO_INHERIT) && _POSIX_THREAD_ROBUST_PRIO_INHERIT > 0) || \ (defined(_POSIX_THREAD_ROBUST_PRIO_PROTECT) && _POSIX_THREAD_ROBUST_PRIO_PROTECT > 0) || \ defined(PTHREAD_MUTEX_ROBUST) || defined(PTHREAD_MUTEX_ROBUST_NP)) && \ - (!defined(__GLIBC__) || __GLIBC_PREREQ(2, 10) /* troubles with Robust mutexes before 2.10 */) + (!defined(__GLIBC__) || __GLIBC_PREREQ(2, 10) /* troubles with Robust mutexes before 2.10 */) && \ + !defined(__OHOS__) /* Harmony OS doesn't support robust mutexes at the end of 2025 */ #define MDBX_LOCKING MDBX_LOCKING_POSIX2008 #else #define MDBX_LOCKING MDBX_LOCKING_POSIX2001