mirror of
https://github.com/isar/libmdbx.git
synced 2025-05-21 20:47:46 +08:00
mdbx: добавление ignore_enosys_and_einval()
и её использование для отказа от OFD-блокировок.
This commit is contained in:
parent
c88c51d33c
commit
e03b8e1227
@ -385,6 +385,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) {
|
||||||
|
@ -128,7 +128,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