From owner-svn-src-head@FreeBSD.ORG Sat May 7 12:20:55 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E4631065670; Sat, 7 May 2011 12:20:55 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw03.mail.saunalahti.fi (gw03.mail.saunalahti.fi [195.197.172.111]) by mx1.freebsd.org (Postfix) with ESMTP id 22B948FC18; Sat, 7 May 2011 12:20:54 +0000 (UTC) Received: from a91-153-123-205.elisa-laajakaista.fi (a91-153-123-205.elisa-laajakaista.fi [91.153.123.205]) by gw03.mail.saunalahti.fi (Postfix) with SMTP id 1B89D216754; Sat, 7 May 2011 15:20:49 +0300 (EEST) Date: Sat, 7 May 2011 15:20:48 +0300 From: Jaakko Heinonen To: Kostik Belousov Message-ID: <20110507122048.GA1846@a91-153-123-205.elisa-laajakaista.fi> References: <201105071110.p47BAwmU096094@svn.freebsd.org> <20110507114856.GN48734@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110507114856.GN48734@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221597 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 May 2011 12:20:55 -0000 On 2011-05-07, Kostik Belousov wrote: > > @@ -310,6 +310,7 @@ getenv(const char *name) > > int len; > > > > if (dynamic_kenv) { > > + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "getenv"); > > mtx_lock(&kenv_lock); > > cp = _getenv_dynamic(name, NULL); > > if (cp != NULL) { > > This might be somewhat excessive. Since malloc() warns or panics anyway, > what about moving the WITNESS_WARN into "not found" branch ? Is this better? %%% Index: sys/kern/kern_environment.c =================================================================== --- sys/kern/kern_environment.c (revision 221597) +++ sys/kern/kern_environment.c (working copy) @@ -310,7 +310,6 @@ getenv(const char *name) int len; if (dynamic_kenv) { - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "getenv"); mtx_lock(&kenv_lock); cp = _getenv_dynamic(name, NULL); if (cp != NULL) { @@ -322,6 +321,8 @@ getenv(const char *name) } else { mtx_unlock(&kenv_lock); ret = NULL; + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "getenv"); } } else ret = _getenv_static(name); %%% -- Jaakko