2 .\" Copyright (c) 2007 The DragonFly Project. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in
12 .\" the documentation and/or other materials provided with the
14 .\" 3. Neither the name of The DragonFly Project nor the names of its
15 .\" contributors may be used to endorse or promote products derived
16 .\" from this software without specific, prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
28 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" $DragonFly: src/share/man/man9/kenv.9,v 1.8 2007/11/25 00:13:28 swildner Exp $
45 .Nd API for manipulation of the kernel environment
49 .Fn kfreeenv "char *env"
51 .Fn kgetenv "const char *name"
53 .Fn kgetenv_int "const char *name" "int *data"
55 .Fn kgetenv_quad "const char *name" "quad_t *data"
57 .Fn kgetenv_string "const char *name" "char *data" "int size"
59 .Fn ksetenv "const char *name" "const char *value"
61 .Fn ktestenv "const char *name"
63 .Fn kunsetenv "const char *name"
66 provides an API for manipulation of the kernel environment of a live system by
68 (other kernel subsystems).
69 Upon boot, the kernel environment is inherited from
71 The static environment inherited is converted to a dynamic array at the end of
74 subsystem configure phase of the kernel booting process.
78 function reclaims an array of characters earlier allocated by one of the
80 functions for use by the caller.
84 functions look up a given entry in the kernel environment, and return it if
87 .Fn kgetenv_{int,quad,string}
92 if successful, and return the
93 found value in the given destination.
97 function returns the value string or
103 function sets a given environment key to the given value. It returns
109 arguments were too large, the maxmimum number of entries in the dynamic
110 environment was reached, or if the dynamic environment was not setup yet.
111 The latter can happen when calling
115 subsystem is initialized.
119 function tests whether a given key exists in the kernel environment, returning
127 function removes a given key and its associated value from the dynamic kernel
131 if the key does not exist, or if the dynamic was not setup yet.
132 If successful, it returns
135 .Bl -tag -width indent
136 .It Va kern.environment
137 Current static kernel environment query OID.
140 .Bl -tag -width ".Pa sys/kern/kern_environment.c"
141 .It Pa sys/kern/kern_environment.c
151 function first appeared in
162 and other functions first appeared in
170 implementation was written by
172 It was subsequently extended by
177 This manual page was written by
178 .An Thomas E. Spanjaard .
182 sysctl OID currently only reports information about the static kernel
183 environment, not the dynamic one.
185 The return values from various functions could do with some standardisation,
186 using the error codes from