Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/kenv.2
Show All 20 Lines | |||||
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||||
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||||
.\" DAMAGE. | .\" DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd February 20, 2017 | .Dd June 20, 2021 | ||||
.Dt KENV 2 | .Dt KENV 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm kenv | .Nm kenv | ||||
.Nd kernel environment | .Nd kernel environment | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In kenv.h | .In kenv.h | ||||
.Ft int | .Ft int | ||||
.Fn kenv "int action" "const char *name" "char *value" "int len" | .Fn kenv "int action" "const char *name" "char *value" "int len" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Fn kenv | .Fn kenv | ||||
system call manipulates kernel environment variables. | system call manipulates kernel environment variables. | ||||
It supports the well known userland actions of getting, setting and unsetting | It supports the well known userland actions of getting, setting and unsetting | ||||
environment variables, as well as the ability to dump all of the entries in | environment variables, as well as the ability to dump all of the entries in | ||||
the kernel environment. | the kernel environment. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fa action | .Fa action | ||||
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_DUMP_LOADER" | ||||
.It Dv KENV_GET | .It Dv KENV_GET | ||||
Get the | Get the | ||||
.Fa value | .Fa value | ||||
of the variable with the given | of the variable with the given | ||||
.Fa name . | .Fa name . | ||||
The size of the | The size of the | ||||
.Fa value | .Fa value | ||||
buffer is given by | buffer is given by | ||||
Show All 24 Lines | |||||
.Fa name . | .Fa name . | ||||
The | The | ||||
.Fa value | .Fa value | ||||
and | and | ||||
.Fa len | .Fa len | ||||
arguments are ignored. | 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 | ||||
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 , | .Fa value , | ||||
whose size is given in | whose size is given in | ||||
.Fa len . | .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 | The | ||||
.Fa name | .Fa name | ||||
is ignored. | 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 | .El | ||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||
The | The | ||||
.Fn kenv | .Fn kenv | ||||
system call returns 0 if successful in the case of | system call returns 0 if successful in the case of | ||||
.Dv KENV_SET | .Dv KENV_SET | ||||
and | and | ||||
.Dv KENV_UNSET , | .Dv KENV_UNSET , | ||||
Show All 23 Lines | |||||
.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_GET | .Dv KENV_GET | ||||
or | or | ||||
.Dv KENV_UNSET . | .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 | .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 | ||||
A 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 | The | ||||
Show All 23 Lines |