svn commit: r221597 - head/sys/kern
Kostik Belousov
kostikbel at gmail.com
Sat May 7 11:49:03 UTC 2011
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
>
> 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.
>
> Modified:
> head/sys/kern/kern_environment.c
>
> Modified: head/sys/kern/kern_environment.c
> ==============================================================================
> --- 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;
>
> 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 ?
-------------- 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-head/attachments/20110507/3c9d6274/attachment.pgp
More information about the svn-src-head
mailing list