mdbx: backport - 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.

Change-Id: Ic618a6a72fbd7680dd76d5fd0aef06545dcba994
This commit is contained in:
Howard Chu 2016-06-02 21:01:27 +01:00 committed by Leo Yuriev
parent 3deb4577fb
commit 2806453b54

8
mdb.c
View File

@ -4815,8 +4815,14 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
return errno;
if (*excl > 0) {
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));
pthread_mutexattr_t mattr;
if ((rc = pthread_mutexattr_init(&mattr))
|| (rc = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED))
#if MDB_USE_ROBUST