mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
ITS#8339 Solaris 10/11 robust mutex fixes
Check for PTHREAD_MUTEX_ROBUST_NP definition (this doesn't work on Linux/glibc because they used an enum). Zero out mutex before initing.
This commit is contained in:
parent
86e9de588c
commit
0aa4cc8028
1 changed files with 9 additions and 1 deletions
10
external/db_drivers/liblmdb/mdb.c
vendored
10
external/db_drivers/liblmdb/mdb.c
vendored
|
@ -304,7 +304,8 @@ union semun {
|
||||||
# else
|
# else
|
||||||
# define MDB_USE_ROBUST 1
|
# define MDB_USE_ROBUST 1
|
||||||
/* glibc < 2.12 only provided _np API */
|
/* glibc < 2.12 only provided _np API */
|
||||||
# if defined(__GLIBC__) && GLIBC_VER < 0x02000c
|
# if (defined(__GLIBC__) && GLIBC_VER < 0x02000c) || \
|
||||||
|
(defined(PTHREAD_MUTEX_ROBUST_NP) && !defined(PTHREAD_MUTEX_ROBUST))
|
||||||
# define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST_NP
|
# define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST_NP
|
||||||
# define pthread_mutexattr_setrobust(attr, flag) pthread_mutexattr_setrobust_np(attr, flag)
|
# define pthread_mutexattr_setrobust(attr, flag) pthread_mutexattr_setrobust_np(attr, flag)
|
||||||
# define pthread_mutex_consistent(mutex) pthread_mutex_consistent_np(mutex)
|
# define pthread_mutex_consistent(mutex) pthread_mutex_consistent_np(mutex)
|
||||||
|
@ -4977,6 +4978,13 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
|
||||||
#else /* MDB_USE_POSIX_MUTEX: */
|
#else /* MDB_USE_POSIX_MUTEX: */
|
||||||
pthread_mutexattr_t mattr;
|
pthread_mutexattr_t mattr;
|
||||||
|
|
||||||
|
/* Solaris needs this before initing a robust mutex. Otherwise
|
||||||
|
* it may skip the init and return EBUSY "seems someone already
|
||||||
|
* inited" or EINVAL "it was inited differently".
|
||||||
|
*/
|
||||||
|
memset(env->me_txns->mti_rmutex, 0, sizeof(*env->me_txns->mti_rmutex));
|
||||||
|
memset(env->me_txns->mti_wmutex, 0, sizeof(*env->me_txns->mti_wmutex));
|
||||||
|
|
||||||
if ((rc = pthread_mutexattr_init(&mattr))
|
if ((rc = pthread_mutexattr_init(&mattr))
|
||||||
|| (rc = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED))
|
|| (rc = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED))
|
||||||
#ifdef MDB_ROBUST_SUPPORTED
|
#ifdef MDB_ROBUST_SUPPORTED
|
||||||
|
|
Loading…
Reference in a new issue