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
34 .Nd kernel environment
40 .Fn kenv "int action" "const char *name" "char *value" "int len"
44 system call manipulates kernel environment variables.
45 It supports the well known userland actions of getting, setting and unsetting
46 environment variables, as well as the ability to dump all of the entries in
47 the kernel environment.
51 argument can be one of the following:
52 .Bl -tag -width ".Dv KENV_UNSET"
56 of the variable with the given
62 which should be at least
64 + 1 bytes to avoid truncation and to ensure NUL termination.
66 Set or add a variable.
75 characters, respectively
76 .Pq not including the NUL terminator.
79 argument indicates the length of the
81 and must include the NUL terminator.
82 This option is only available to the superuser.
84 Unset the variable with the given
90 arguments are ignored.
91 This option is only available to the superuser.
93 Dump as much of the kernel environment as will fit in
95 whose size is given in
102 will return the number of bytes required to copy out the entire environment.
110 system call returns 0 if successful in the case of
114 and the number of bytes copied into
120 If an error occurs, a value of \-1 is returned and
123 is set to indicate the error.
134 is not a valid option, or the length of the
139 No value could be found for
146 A user other than the superuser attempted to set or unset a kernel
147 environment variable.
149 A bad address was encountered while attempting to copy in user arguments
150 or copy out value(s).
151 .It Bq Er ENAMETOOLONG
160 characters, respectively, or
162 did not include the NUL terminator for a
169 This manual page was written by
170 .An Chad David Aq Mt davidc@FreeBSD.org .
174 system call was written by
175 .An Maxime Henrion Aq Mt mux@FreeBSD.org .