From 6318ca701ad4ba94cd823da50c24d35958b23d6e 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: Sat, 17 May 2025 15:44:38 +0300 Subject: [PATCH] =?UTF-8?q?mdbx:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20`ignore=5Fenosys=5Fand=5Feinval()`?= =?UTF-8?q?=20=D0=B8=20=D0=B5=D1=91=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BA=D0=B0=D0=B7=D0=B0=20=D0=BE=D1=82=20OFD-?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8=D1=80=D0=BE=D0=B2=D0=BE=D0=BA=20?= =?UTF-8?q?(backport).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cogs.h | 4 ++++ src/lck-posix.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cogs.h b/src/cogs.h index 0e370750..ec2ff6f3 100644 --- a/src/cogs.h +++ b/src/cogs.h @@ -379,6 +379,10 @@ MDBX_CONST_FUNCTION static inline int ignore_enosys(int err) { MDBX_MAYBE_UNUSED MDBX_CONST_FUNCTION static inline int ignore_enosys_and_eagain(int err) { return (err == EAGAIN) ? MDBX_RESULT_TRUE : ignore_enosys(err); } + +MDBX_MAYBE_UNUSED MDBX_CONST_FUNCTION static inline int ignore_enosys_and_einval(int err) { + return (err == EINVAL) ? MDBX_RESULT_TRUE : ignore_enosys(err); +} #endif /* defined(_WIN32) || defined(_WIN64) */ static inline int check_env(const MDBX_env *env, const bool wanna_active) { diff --git a/src/lck-posix.c b/src/lck-posix.c index 335725ec..a9c15c48 100644 --- a/src/lck-posix.c +++ b/src/lck-posix.c @@ -133,7 +133,8 @@ static int lck_op(const mdbx_filehandle_t fd, int cmd, const int lck, const off_ } rc = errno; #if MDBX_USE_OFDLOCKS - if (rc == EINVAL && (cmd == MDBX_F_OFD_SETLK || cmd == MDBX_F_OFD_SETLKW || cmd == MDBX_F_OFD_GETLK)) { + if (ignore_enosys_and_einval(rc) == MDBX_RESULT_TRUE && + (cmd == MDBX_F_OFD_SETLK || cmd == MDBX_F_OFD_SETLKW || cmd == MDBX_F_OFD_GETLK)) { /* fallback to non-OFD locks */ if (cmd == MDBX_F_OFD_SETLK) cmd = MDBX_F_SETLK;