Make several improvements and corrections in the kenv(2) man page
MFC after: 3 days Sponsored by: Dell EMC
This commit is contained in:
parent
43549bdaf4
commit
c0a36e0c71
@ -26,7 +26,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd April 17, 2002
|
.Dd February 20, 2017
|
||||||
.Dt KENV 2
|
.Dt KENV 2
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -51,71 +51,59 @@ The
|
|||||||
argument can be one of the following:
|
argument can be one of the following:
|
||||||
.Bl -tag -width ".Dv KENV_UNSET"
|
.Bl -tag -width ".Dv KENV_UNSET"
|
||||||
.It Dv KENV_GET
|
.It Dv KENV_GET
|
||||||
Returns the value associated with the named kernel environment variable.
|
Get the
|
||||||
If the variable is not found, \-1 is returned and
|
|
||||||
the global variable
|
|
||||||
.Va errno
|
|
||||||
is set to
|
|
||||||
.Er ENOENT .
|
|
||||||
Only the number of bytes available in
|
|
||||||
.Fa value
|
.Fa value
|
||||||
are copied out.
|
of the variable with the given
|
||||||
|
.Fa name .
|
||||||
|
The size of the
|
||||||
|
.Fa value
|
||||||
|
buffer is given by
|
||||||
|
.Fa len ,
|
||||||
|
which should be at least
|
||||||
|
.Dv KENV_MVALLEN
|
||||||
|
+ 1 bytes to avoid truncation and to ensure NUL termination.
|
||||||
.It Dv KENV_SET
|
.It Dv KENV_SET
|
||||||
Sets or adds a new kernel environment variable.
|
Set or add a variable.
|
||||||
|
The
|
||||||
|
.Fa name
|
||||||
|
and
|
||||||
|
.Fa value
|
||||||
|
are limited to
|
||||||
|
.Dv KENV_MNAMELEN
|
||||||
|
and
|
||||||
|
.Dv KENV_MVALLEN
|
||||||
|
characters, respectively
|
||||||
|
.Pq not including the NUL terminator.
|
||||||
|
The
|
||||||
|
.Fa len
|
||||||
|
argument indicates the length of the
|
||||||
|
.Fa value
|
||||||
|
and must include the NUL terminator.
|
||||||
This option is only available to the superuser.
|
This option is only available to the superuser.
|
||||||
.It Dv KENV_UNSET
|
.It Dv KENV_UNSET
|
||||||
Unsets the kernel environment variable
|
Unset the variable with the given
|
||||||
.Fa name .
|
.Fa name .
|
||||||
If the variable does not exist, \-1 is returned and
|
The
|
||||||
the global variable
|
.Fa value
|
||||||
.Va errno
|
and
|
||||||
is set to
|
.Fa len
|
||||||
.Er EINVAL .
|
arguments are ignored.
|
||||||
This option is only available to the superuser.
|
This option is only available to the superuser.
|
||||||
.It Dv KENV_DUMP
|
.It Dv KENV_DUMP
|
||||||
Dumps as much of the kernel environment as will fit in
|
Dump as much of the kernel environment as will fit in
|
||||||
.Fa value .
|
.Fa value ,
|
||||||
|
whose size is given in
|
||||||
|
.Fa len .
|
||||||
If
|
If
|
||||||
.Fa value
|
.Fa value
|
||||||
is
|
is
|
||||||
.Dv NULL ,
|
.Dv NULL ,
|
||||||
.Fn kenv
|
.Fn kenv
|
||||||
will return the number of bytes required to copy out the entire environment.
|
will return the number of bytes required to copy out the entire environment.
|
||||||
|
The
|
||||||
|
.Fa name
|
||||||
|
is ignored.
|
||||||
.El
|
.El
|
||||||
.Pp
|
|
||||||
The
|
|
||||||
.Fa name
|
|
||||||
argument is the name of the environment variable to be affected.
|
|
||||||
In the case of
|
|
||||||
.Dv KENV_DUMP
|
|
||||||
it is ignored.
|
|
||||||
.Pp
|
|
||||||
The
|
|
||||||
.Fa value
|
|
||||||
argument contains either the value to set the environment variable
|
|
||||||
.Fa name
|
|
||||||
to in the case of
|
|
||||||
.Dv KENV_SET ,
|
|
||||||
or it points to the location where
|
|
||||||
.Fn kenv
|
|
||||||
should copy return data to in the case of
|
|
||||||
.Dv KENV_DUMP
|
|
||||||
and
|
|
||||||
.Dv KENV_GET .
|
|
||||||
If
|
|
||||||
.Fa value
|
|
||||||
is
|
|
||||||
.Dv NULL
|
|
||||||
in the case of
|
|
||||||
.Dv KENV_DUMP ,
|
|
||||||
.Fn kenv
|
|
||||||
will return the number of bytes required to copy out the entire environment.
|
|
||||||
.Pp
|
|
||||||
The
|
|
||||||
.Fa len
|
|
||||||
argument indicates how many bytes of storage
|
|
||||||
.Fa value
|
|
||||||
points to.
|
|
||||||
.Sh RETURN VALUES
|
.Sh RETURN VALUES
|
||||||
The
|
The
|
||||||
.Fn kenv
|
.Fn kenv
|
||||||
@ -148,23 +136,31 @@ is not a valid option, or the length of the
|
|||||||
is less than 1 for a
|
is less than 1 for a
|
||||||
.Dv KENV_SET .
|
.Dv KENV_SET .
|
||||||
.It Bq Er ENOENT
|
.It Bq Er ENOENT
|
||||||
no value could be found for
|
No value could be found for
|
||||||
.Fa name
|
.Fa name
|
||||||
for a
|
for a
|
||||||
.Dv KENV_SET
|
.Dv KENV_GET
|
||||||
or
|
or
|
||||||
.Dv KENV_UNSET .
|
.Dv KENV_UNSET .
|
||||||
.It Bq Er EPERM
|
.It Bq Er EPERM
|
||||||
a user other than the superuser attempted to set or unset a kernel
|
A user other than the superuser attempted to set or unset a kernel
|
||||||
environment variable.
|
environment variable.
|
||||||
.It Bq Er EFAULT
|
.It Bq Er EFAULT
|
||||||
bad address was encountered while attempting to copy in user arguments,
|
A bad address was encountered while attempting to copy in user arguments
|
||||||
or copy out value(s).
|
or copy out value(s).
|
||||||
.It Bq Er ENAMETOOLONG
|
.It Bq Er ENAMETOOLONG
|
||||||
the name of a variable supplied by the user is longer than
|
The
|
||||||
|
.Fa name
|
||||||
|
or the
|
||||||
|
.Fa value
|
||||||
|
is longer than
|
||||||
.Dv KENV_MNAMELEN
|
.Dv KENV_MNAMELEN
|
||||||
or the value of a variable is longer than
|
or
|
||||||
.Dv KENV_MVALLEN .
|
.Dv KENV_MVALLEN
|
||||||
|
characters, respectively, or
|
||||||
|
.Fa len
|
||||||
|
did not include the NUL terminator for a
|
||||||
|
.Dv KENV_SET .
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr kenv 1
|
.Xr kenv 1
|
||||||
|
Loading…
Reference in New Issue
Block a user