From owner-p4-projects@FreeBSD.ORG Mon Jan 5 14:30:25 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 76B6C16A4D2; Mon, 5 Jan 2004 14:30:25 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4AA3216A4D1 for ; Mon, 5 Jan 2004 14:30:25 -0800 (PST) Received: from mail3.speakeasy.net (mail3.speakeasy.net [216.254.0.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF64743D46 for ; Mon, 5 Jan 2004 14:30:12 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 11146 invoked from network); 5 Jan 2004 22:30:12 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 5 Jan 2004 22:30:12 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.10/8.12.10) with ESMTP id i05MU6M0021597; Mon, 5 Jan 2004 17:30:06 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20040102231149.GA69929@FreeBSD.org> Date: Mon, 05 Jan 2004 17:30:09 -0500 (EST) From: John Baldwin To: Juli Mallett X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: Sam Leffler cc: Perforce Change Reviews Subject: Re: PERFORCE change 44709 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2004 22:30:26 -0000 On 02-Jan-2004 Juli Mallett wrote: > * Sam Leffler [ Date: 2004-01-02 ] > [ w.r.t. Re: PERFORCE change 44709 for review ] >> On Friday 02 January 2004 02:04 pm, John Baldwin wrote: >> > http://perforce.freebsd.org/chv.cgi?CH=44709 >> > >> > Change 44709 by jhb@jhb_blue on 2004/01/02 14:04:27 >> > >> > Bah, stupid bug. >> > >> > Affected files ... >> > >> > .. //depot/projects/smpng/sys/modules/crash/crash.c#8 edit >> > >> > Differences ... >> > >> > ==== //depot/projects/smpng/sys/modules/crash/crash.c#8 (text+ko) ==== >> > >> > @@ -234,9 +234,9 @@ >> > break; >> > case 18: >> > bzero(&test1_mtx, sizeof(test1_mtx)); >> > - bzero(&test1_mtx, sizeof(test2_mtx)); >> > + bzero(&test2_mtx, sizeof(test2_mtx)); >> > mtx_init(&test1_mtx, "test1", NULL, MTX_DEF); >> > - mtx_init(&test1_mtx, "test2", NULL, MTX_DEF | >> > + mtx_init(&test2_mtx, "test2", NULL, MTX_DEF | >> > MTX_RECURSE); >> > #define TRYLOCK_TEST(lock, descr) do { \ >> > status = mtx_trylock((lock)); \ >> >> Bah bah, bogus assertions. > > Agreed. I want something to *initialize* these things. I hate one bit > of code I have at work: > > sc->[all fields] = [appropriate values for fields] > bzero(&sc->mtx, sizeof sc->mtx); > mtx_init(&sc->mtx, "blah", NULL, MTX_DEF); > > *shrug* My bug was a real one up there that the assertion caught. I had double-init'd test1 and never init'd test2. Perhaps I should break down and add a MTX_FRESH or MTX_NEW flag that skips the assertion. Of course, it just means that when someone does forget to init a mutex or dose a double init they just have a really hard to track down bug. :-/ -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/