diff options
author | cem <cem@FreeBSD.org> | 2016-06-01 16:12:26 +0000 |
---|---|---|
committer | cem <cem@FreeBSD.org> | 2016-06-01 16:12:26 +0000 |
commit | 6a53a3dd42a3a167fc3c526e686e4f318a87dc75 (patch) | |
tree | 642e082d766685b4166839b0a83ba0a2a5044e0f /lib/libthr/thread/thr_mutex.c | |
parent | 51037ae517bcc9a8a275eb7ff07c708d803a9173 (diff) | |
download | FreeBSD-src-6a53a3dd42a3a167fc3c526e686e4f318a87dc75.zip FreeBSD-src-6a53a3dd42a3a167fc3c526e686e4f318a87dc75.tar.gz |
libthr: Use formatted PANIC()
No functional change, although _thread_printf() may be slightly less functional
or render some values differently from libc snprintf(3). No ABI change.
Reviewed by: kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6672
Diffstat (limited to 'lib/libthr/thread/thr_mutex.c')
-rw-r--r-- | lib/libthr/thread/thr_mutex.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index 2d507e7..5a99605 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -135,13 +135,9 @@ mutex_assert_is_owned(struct pthread_mutex *m __unused) { #if defined(_PTHREADS_INVARIANTS) - if (__predict_false(m->m_qe.tqe_prev == NULL)) { - char msg[128]; - snprintf(msg, sizeof(msg), - "mutex %p own %#x is not on list %p %p", + if (__predict_false(m->m_qe.tqe_prev == NULL)) + PANIC("mutex %p own %#x is not on list %p %p", m, m->m_lock.m_owner, m->m_qe.tqe_prev, m->m_qe.tqe_next); - PANIC(msg); - } #endif } @@ -152,27 +148,20 @@ mutex_assert_not_owned(struct pthread *curthread __unused, #if defined(_PTHREADS_INVARIANTS) if (__predict_false(m->m_qe.tqe_prev != NULL || - m->m_qe.tqe_next != NULL)) { - char msg[128]; - snprintf(msg, sizeof(msg), - "mutex %p own %#x is on list %p %p", + m->m_qe.tqe_next != NULL)) + PANIC("mutex %p own %#x is on list %p %p", m, m->m_lock.m_owner, m->m_qe.tqe_prev, m->m_qe.tqe_next); - PANIC(msg); - } if (__predict_false(is_robust_mutex(m) && (m->m_lock.m_rb_lnk != 0 || m->m_rb_prev != NULL || (is_pshared_mutex(m) && curthread->robust_list == (uintptr_t)&m->m_lock) || (!is_pshared_mutex(m) && curthread->priv_robust_list == - (uintptr_t)&m->m_lock)))) { - char msg[128]; - snprintf(msg, sizeof(msg), + (uintptr_t)&m->m_lock)))) + PANIC( "mutex %p own %#x is on robust linkage %p %p head %p phead %p", m, m->m_lock.m_owner, (void *)m->m_lock.m_rb_lnk, m->m_rb_prev, (void *)curthread->robust_list, (void *)curthread->priv_robust_list); - PANIC(msg); - } #endif } |