Date: Sat, 7 May 2011 14:48:56 +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: <20110507114856.GN48734@deviant.kiev.zoral.com.ua> In-Reply-To: <201105071110.p47BAwmU096094@svn.freebsd.org> References: <201105071110.p47BAwmU096094@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--afReowZ/oS2gITrV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 07, 2011 at 11:10:58AM +0000, Jaakko Heinonen wrote: > Author: jh > Date: Sat May 7 11:10:58 2011 > New Revision: 221597 > URL: http://svn.freebsd.org/changeset/base/221597 >=20 > Log: > Add WITNESS_WARN() to getenv() to explicitly note that the function may > sleep. This helps to expose bugs when the requested environment variable > doesn't exist. >=20 > Modified: > head/sys/kern/kern_environment.c >=20 > Modified: head/sys/kern/kern_environment.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/kern_environment.c Sat May 7 11:05:16 2011 (r221596) > +++ head/sys/kern/kern_environment.c Sat May 7 11:10:58 2011 (r221597) > @@ -310,6 +310,7 @@ getenv(const char *name) > int len; > =20 > if (dynamic_kenv) { > + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "getenv"); > mtx_lock(&kenv_lock); > cp =3D _getenv_dynamic(name, NULL); > if (cp !=3D NULL) { This might be somewhat excessive. Since malloc() warns or panics anyway, what about moving the WITNESS_WARN into "not found" branch ? --afReowZ/oS2gITrV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk3FMagACgkQC3+MBN1Mb4hWEgCfWYpcAcycS6aL0BxxYbcqtD9N X+IAoMBpaqjPbDS4DIQVJ9J8ilImprmx =YH2G -----END PGP SIGNATURE----- --afReowZ/oS2gITrV--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110507114856.GN48734>