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"
54 Returns the value associated with the named kernel environment variable.
55 If the variable is not found, \-1 is returned and
60 Only the number of bytes available in
64 Sets or adds a new kernel environment variable.
65 This option is only available to the superuser.
67 Unsets the kernel environment variable
69 If the variable does not exist, \-1 is returned and
74 This option is only available to the superuser.
76 Dumps as much of the kernel environment as will fit in
83 will return the number of bytes required to copy out the entire environment.
88 argument is the name of the environment variable to be affected.
95 argument contains either the value to set the environment variable
99 or it points to the location where
101 should copy return data to in the case of
112 will return the number of bytes required to copy out the entire environment.
116 argument indicates how many bytes of storage
122 system call returns 0 if successful in the case of
126 and the number of bytes copied into
132 If an error occurs, a value of \-1 is returned and
135 is set to indicate the error.
146 is not a valid option, or the length of the
151 no value could be found for
158 a user other than the superuser attempted to set or unset a kernel
159 environment variable.
161 bad address was encountered while attempting to copy in user arguments,
162 or copy out value(s).
163 .It Bq Er ENAMETOOLONG
164 the name of a variable supplied by the user is longer than
166 or the value of a variable is longer than
173 This manual page was written by
174 .An Chad David Aq davidc@FreeBSD.org .
178 system call was written by
179 .An Maxime Henrion Aq mux@FreeBSD.org .