From owner-svn-src-all@freebsd.org Wed Jun 1 16:12:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12A98B61555; Wed, 1 Jun 2016 16:12:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E18E91D24; Wed, 1 Jun 2016 16:12:27 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u51GCRvo025646; Wed, 1 Jun 2016 16:12:27 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u51GCQAP025643; Wed, 1 Jun 2016 16:12:26 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201606011612.u51GCQAP025643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Wed, 1 Jun 2016 16:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301136 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2016 16:12:28 -0000 Author: cem Date: Wed Jun 1 16:12:26 2016 New Revision: 301136 URL: https://svnweb.freebsd.org/changeset/base/301136 Log: 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 Modified: head/lib/libthr/thread/thr_cond.c head/lib/libthr/thread/thr_exit.c head/lib/libthr/thread/thr_mutex.c Modified: head/lib/libthr/thread/thr_cond.c ============================================================================== --- head/lib/libthr/thread/thr_cond.c Wed Jun 1 16:11:09 2016 (r301135) +++ head/lib/libthr/thread/thr_cond.c Wed Jun 1 16:12:26 2016 (r301136) @@ -258,7 +258,7 @@ cond_wait_user(struct pthread_cond *cvp, curthread = _get_curthread(); if (curthread->wchan != NULL) - PANIC("thread was already on queue."); + PANIC("thread %p was already on queue.", curthread); if (cancel) _thr_testcancel(curthread); Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Wed Jun 1 16:11:09 2016 (r301135) +++ head/lib/libthr/thread/thr_exit.c Wed Jun 1 16:12:26 2016 (r301136) @@ -209,13 +209,10 @@ _pthread_exit_mask(void *status, sigset_ struct pthread *curthread = _get_curthread(); /* Check if this thread is already in the process of exiting: */ - if (curthread->cancelling) { - char msg[128]; - snprintf(msg, sizeof(msg), "Thread %p has called " + if (curthread->cancelling) + PANIC("Thread %p has called " "pthread_exit() from a destructor. POSIX 1003.1 " "1996 s16.2.5.2 does not allow this!", curthread); - PANIC(msg); - } /* Flag this thread as exiting. */ curthread->cancelling = 1; @@ -312,7 +309,7 @@ exit_thread(void) #if defined(_PTHREADS_INVARIANTS) if (THR_IN_CRITICAL(curthread)) - PANIC("thread exits with resources held!"); + PANIC("thread %p exits with resources held!", curthread); #endif /* * Kernel will do wakeup at the address, so joiner thread Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Wed Jun 1 16:11:09 2016 (r301135) +++ head/lib/libthr/thread/thr_mutex.c Wed Jun 1 16:12:26 2016 (r301136) @@ -135,13 +135,9 @@ mutex_assert_is_owned(struct pthread_mut { #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 *c #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 }