aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2021-06-20 19:36:10 +0000
committerKyle Evans <kevans@FreeBSD.org>2021-07-19 04:06:19 +0000
commitdb0f26439357b78863e61985acd1e5acf75ce73d (patch)
tree9a30a6481206e81ec1b726294398fdd41c88896c /lib/libc
parent7a129c973b5ba0fa916dfa658d523bec66dbd02d (diff)
downloadsrc-db0f26439357b78863e61985acd1e5acf75ce73d.tar.gz
src-db0f26439357b78863e61985acd1e5acf75ce73d.zip
kenv: allow listing of static kernel environments
The early environment is typically cleared, so these new options need the PRESERVE_EARLY_KENV kernel config(8) option. These environments are reported as missing by kenv(1) if the option is not present in the running kernel. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30835
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/kenv.224
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/libc/sys/kenv.2 b/lib/libc/sys/kenv.2
index 06f708170a2f..a1f994569111 100644
--- a/lib/libc/sys/kenv.2
+++ b/lib/libc/sys/kenv.2
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 20, 2017
+.Dd June 20, 2021
.Dt KENV 2
.Os
.Sh NAME
@@ -49,7 +49,7 @@ the kernel environment.
The
.Fa action
argument can be one of the following:
-.Bl -tag -width ".Dv KENV_UNSET"
+.Bl -tag -width ".Dv KENV_DUMP_LOADER"
.It Dv KENV_GET
Get the
.Fa value
@@ -90,7 +90,7 @@ and
arguments are ignored.
This option is only available to the superuser.
.It Dv KENV_DUMP
-Dump as much of the kernel environment as will fit in
+Dump as much of the dynamic kernel environment as will fit in
.Fa value ,
whose size is given in
.Fa len .
@@ -103,6 +103,18 @@ will return the number of bytes required to copy out the entire environment.
The
.Fa name
is ignored.
+.It Dv KENV_DUMP_LOADER
+Dump the static environment provided by
+.Xr loader 8 ,
+with semantics identical to
+.Dv KENV_DUMP .
+Duplicate and malformed variables originally present in this environment are
+discarded by the kernel and will not appear in the output.
+.It Dv KENV_DUMP_STATIC
+Dump the static environment defined by the kernel
+.Xr config 5 .
+The semantics are identical to
+.Dv KENV_DUMP_LOADER .
.El
.Sh RETURN VALUES
The
@@ -142,6 +154,12 @@ for a
.Dv KENV_GET
or
.Dv KENV_UNSET .
+.It Bq Er ENOENT
+The requested environment is not available for a
+.Dv KENV_DUMP_LOADER
+or
+.Dv KENV_DUMP_STATIC .
+The kernel is configured to destroy these environments by default.
.It Bq Er EPERM
A user other than the superuser attempted to set or unset a kernel
environment variable.