HomeFreeBSD

Add getenv(9) boolean parsing functions

Description

Add getenv(9) boolean parsing functions

This adds the getenv_bool() function, to parse a boolean value from a
kernel environment variable or tunable. This works for traditional
boolean values like "0" and "1", and also "true" and "false"
(case-insensitive). These semantics do not yet apply to sysctls declared
using SYSCTL_BOOL with CTLFLAG_TUN (they still only parse 1 and 0).

Also added are two wrapper functions, getenv_is_true() and
getenv_is_false(). These are slightly simpler for callers wishing to
perform a single check of a configuration variable.

Reviewed by: jhb (slightly earlier version)
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26270

Details

Provenance
mhorneAuthored on
Reviewer
jhb
Differential Revision
D26270: Add getenv_is_true() and getenv_is_false()
Parents
rS365944: MFS r365667,r365920: extend kern.geom.part.check_integrity to work on GPT
Branches
Unknown
Tags
Unknown