mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-02 22:54:44 +08:00
mdbx: добавление ignore_enosys_and_einval()
и её использование для отказа от OFD-блокировок (backport).
This commit is contained in:
parent
9c1f3aa4b5
commit
6318ca701a
@ -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) {
|
MDBX_MAYBE_UNUSED MDBX_CONST_FUNCTION static inline int ignore_enosys_and_eagain(int err) {
|
||||||
return (err == EAGAIN) ? MDBX_RESULT_TRUE : ignore_enosys(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) */
|
#endif /* defined(_WIN32) || defined(_WIN64) */
|
||||||
|
|
||||||
static inline int check_env(const MDBX_env *env, const bool wanna_active) {
|
static inline int check_env(const MDBX_env *env, const bool wanna_active) {
|
||||||
|
@ -133,7 +133,8 @@ static int lck_op(const mdbx_filehandle_t fd, int cmd, const int lck, const off_
|
|||||||
}
|
}
|
||||||
rc = errno;
|
rc = errno;
|
||||||
#if MDBX_USE_OFDLOCKS
|
#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 */
|
/* fallback to non-OFD locks */
|
||||||
if (cmd == MDBX_F_OFD_SETLK)
|
if (cmd == MDBX_F_OFD_SETLK)
|
||||||
cmd = MDBX_F_SETLK;
|
cmd = MDBX_F_SETLK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user