2 .\" Copyright (C) 2002 Chad David <davidc@FreeBSD.org>. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice(s), this list of conditions and the following disclaimer as
9 .\" the first lines of this file unmodified other than the possible
10 .\" addition of one or more copyright notices.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice(s), this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
16 .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 .\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
19 .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 .\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
32 .Nd kernel environment
38 .Fn kenv "int action" "const char *name" "char *value" "int len"
42 system call manipulates kernel environment variables.
43 It supports the well known userland actions of getting, setting and unsetting
44 environment variables, as well as the ability to dump all of the entries in
45 the kernel environment.
49 argument can be one of the following:
50 .Bl -tag -width ".Dv KENV_DUMP_LOADER"
54 of the variable with the given
60 which should be at least
62 + 1 bytes to avoid truncation and to ensure NUL termination.
64 Set or add a variable.
73 characters, respectively
74 .Pq not including the NUL terminator.
77 argument indicates the length of the
79 and must include the NUL terminator.
80 This option is only available to the superuser.
82 Unset the variable with the given
88 arguments are ignored.
89 This option is only available to the superuser.
91 Dump as much of the dynamic kernel environment as will fit in
93 whose size is given in
100 will return the number of bytes required to copy out the entire environment.
104 .It Dv KENV_DUMP_LOADER
105 Dump the static environment provided by
107 with semantics identical to
109 Duplicate and malformed variables originally present in this environment are
110 discarded by the kernel and will not appear in the output.
111 .It Dv KENV_DUMP_STATIC
112 Dump the static environment defined by the kernel
114 The semantics are identical to
115 .Dv KENV_DUMP_LOADER .
120 system call returns 0 if successful in the case of
124 and the number of bytes copied into
130 If an error occurs, a value of \-1 is returned and
133 is set to indicate the error.
144 is not a valid option, or the length of the
149 No value could be found for
156 The requested environment is not available for a
159 .Dv KENV_DUMP_STATIC .
160 The kernel is configured to destroy these environments by default.
162 A user other than the superuser attempted to set or unset a kernel
163 environment variable.
165 A bad address was encountered while attempting to copy in user arguments
166 or copy out value(s).
167 .It Bq Er ENAMETOOLONG
176 characters, respectively, or
178 did not include the NUL terminator for a
185 This manual page was written by
186 .An Chad David Aq Mt davidc@FreeBSD.org .
190 system call was written by
191 .An Maxime Henrion Aq Mt mux@FreeBSD.org .