Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2018 00:36:37 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336154 - head/sys/kern
Message-ID:  <201807100036.w6A0abAQ068283@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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++;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807100036.w6A0abAQ068283>