svn commit: r221597 - head/sys/kern
Jaakko Heinonen
jh at FreeBSD.org
Sat May 7 12:20:55 UTC 2011
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
More information about the svn-src-head
mailing list