svn commit: r221597 - head/sys/kern

Kostik Belousov kostikbel at gmail.com
Sat May 7 12:41:31 UTC 2011


On Sat, May 07, 2011 at 03:20:48PM +0300, Jaakko Heinonen wrote:
> 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?
Most likely, at least this is exactly what I meant.

> 
> %%%
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20110507/708d0316/attachment.pgp


More information about the svn-src-all mailing list