The mutex_owned() macro should operate on kmutex_t and not on mutex_t.

This fixes 'zdb <poolname>' crash.

Reported by:	avg
Approved by:	re (kib)
This commit is contained in:
Pawel Jakub Dawidek 2009-07-09 20:22:05 +00:00
parent adb1423aa6
commit 075ec356df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195515
3 changed files with 10 additions and 1 deletions

View File

@ -53,7 +53,6 @@ typedef pthread_rwlock_t rwlock_t;
#define mutex_lock(l) pthread_mutex_lock(l)
#define mutex_trylock(l) pthread_mutex_trylock(l)
#define mutex_unlock(l) pthread_mutex_unlock(l)
#define mutex_owned(l) pthread_mutex_isowned_np(l)
#define rwlock_init(l,f,a) pthread_rwlock_init(l,NULL)
#define rwlock_destroy(l) pthread_rwlock_destroy(l)
#define rw_rdlock(l) pthread_rwlock_rdlock(l)

View File

@ -115,6 +115,14 @@ zmutex_destroy(kmutex_t *mp)
mp->initialized = B_FALSE;
}
int
zmutex_owned(kmutex_t *mp)
{
ASSERT(mp->initialized == B_TRUE);
return (mp->m_owner == curthread);
}
void
mutex_enter(kmutex_t *mp)
{

View File

@ -237,9 +237,11 @@ typedef struct kmutex {
#define mutex_init(mp, b, c, d) zmutex_init((kmutex_t *)(mp))
#define mutex_destroy(mp) zmutex_destroy((kmutex_t *)(mp))
#define mutex_owned(mp) zmutex_owned((kmutex_t *)(mp))
extern void zmutex_init(kmutex_t *mp);
extern void zmutex_destroy(kmutex_t *mp);
extern int zmutex_owned(kmutex_t *mp);
extern void mutex_enter(kmutex_t *mp);
extern void mutex_exit(kmutex_t *mp);
extern int mutex_tryenter(kmutex_t *mp);