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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to