Date: Sat, 7 May 2011 15:41:27 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Jaakko Heinonen <jh@freebsd.org> 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: <20110507124127.GP48734@deviant.kiev.zoral.com.ua> In-Reply-To: <20110507122048.GA1846@a91-153-123-205.elisa-laajakaista.fi> References: <201105071110.p47BAwmU096094@svn.freebsd.org> <20110507114856.GN48734@deviant.kiev.zoral.com.ua> <20110507122048.GA1846@a91-153-123-205.elisa-laajakaista.fi>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)
iEYEARECAAYFAk3FPfcACgkQC3+MBN1Mb4itqgCgji+tg0Ghytbr7QggkpqKFmPP
HC4AnjMTMUq6lLF7yg8i1QpIeLDzsz19
=2pTf
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110507124127.GP48734>
