Page MenuHomeFreeBSD

subr_hints: simplify a little bit
ClosedPublic

Authored by kevans on Jun 20 2018, 11:43 PM.

Details

Summary

(This simplification is driven by some other early environment changes I would like to make)

Some complexity exists in these bits that isn't needed. The sysctl handler, upon change to '2', runs through the current set of hints and sets them in the kenv.

However, this isn't at all necessary if we're pulling hints from the kenv, static or dynamic, as the former will get added to the latter in init_dynamic_kenv [https://svnweb.freebsd.org/base/head/sys/kern/kern_environment.c?view=markup#l271]. We can reduce this configuration to just adding static_hints to the kenv if we were previously using them.

The changes in res_find are minimal, and based on the observation that once use_kenv gets set to '1' it will never be reset to 0, and it gets set to 1 as soon as we hit fallback mode. Later work will refactor res_find a little bit and eliminate this now-local, because it's become clear that there's some funkiness revolving around use_kenv=1 and it being used to imply that we're certainly looking at the dynamic_kenv.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kevans created this revision.Jun 20 2018, 11:43 PM
ray accepted this revision.Jun 21 2018, 6:48 AM

Looks good.
Thank you!

This revision is now accepted and ready to land.Jun 21 2018, 6:48 AM
This revision was automatically updated to reflect the committed changes.