svn commit: r336154 - head/sys/kern

Kyle Evans kevans at FreeBSD.org
Tue Jul 10 00:36:38 UTC 2018


Author: kevans
Date: Tue Jul 10 00:36:37 2018
New Revision: 336154
URL: https://svnweb.freebsd.org/changeset/base/336154

Log:
  subr_hints: Skip static_env and static_hints if they don't contain hints
  
  This is possible because, well, they're static. Both the dynamic environment
  and the MD-environment (generally loader(8) environment) can potentially
  have room for new variables to be set, and thus do not receive this
  treatment.

Modified:
  head/sys/kern/subr_hints.c

Modified: head/sys/kern/subr_hints.c
==============================================================================
--- head/sys/kern/subr_hints.c	Tue Jul 10 00:34:19 2018	(r336153)
+++ head/sys/kern/subr_hints.c	Tue Jul 10 00:36:37 2018	(r336154)
@@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$");
  * static_hints to the dynamic environment.
  */
 static bool	hintenv_merged;
-
+/* Static environment and static hints cannot change, so we'll skip known bad */
+static bool	stenv_skip;
+static bool	sthints_skip;
 /*
  * Access functions for device resources.
  */
@@ -179,17 +181,21 @@ fallback:
 			}
 			fbacklvl++;
 
-			if (fbacklvl <= FBACK_STENV &&
+			if (!stenv_skip && fbacklvl <= FBACK_STENV &&
 			    _res_checkenv(kern_envp)) {
 				hintp = kern_envp;
 				goto found;
-			}
+			} else
+				stenv_skip = true;
+
 			fbacklvl++;
 
 			/* We'll fallback to static_hints if needed/can */
-			if (fbacklvl <= FBACK_STATIC &&
+			if (!sthints_skip && fbacklvl <= FBACK_STATIC &&
 			    _res_checkenv(static_hints))
 				hintp = static_hints;
+			else
+				sthints_skip = true;
 found:
 			fbacklvl++;
 		}


More information about the svn-src-head mailing list