Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 May 2011 15:20:48 +0300
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r221597 - head/sys/kern
Message-ID:  <20110507122048.GA1846@a91-153-123-205.elisa-laajakaista.fi>
In-Reply-To: <20110507114856.GN48734@deviant.kiev.zoral.com.ua>
References:  <201105071110.p47BAwmU096094@svn.freebsd.org> <20110507114856.GN48734@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110507122048.GA1846>