From 816c20393743590d7e57cf1b32e9e07a1c14dcf7 Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Sat, 7 May 2011 11:10:58 +0000 Subject: [PATCH] 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. --- sys/kern/kern_environment.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/kern_environment.c b/sys/kern/kern_environment.c index 73551f4b00d6..ce8e778feb66 100644 --- a/sys/kern/kern_environment.c +++ b/sys/kern/kern_environment.c @@ -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) {