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.9 2008/08/30 17:11:42 swildner Exp $
46 .Nd API for manipulation of the kernel environment
50 .Fn kfreeenv "char *env"
52 .Fn kgetenv "const char *name"
54 .Fn kgetenv_int "const char *name" "int *data"
56 .Fn kgetenv_quad "const char *name" "quad_t *data"
58 .Fn kgetenv_string "const char *name" "char *data" "int size"
60 .Fn kgetenv_ulong "const char *name" "unsigned long *data"
62 .Fn ksetenv "const char *name" "const char *value"
64 .Fn ktestenv "const char *name"
66 .Fn kunsetenv "const char *name"
69 provides an API for manipulation of the kernel environment of a live system by
71 (other kernel subsystems).
72 Upon boot, the kernel environment is inherited from
74 The static environment inherited is converted to a dynamic array at the end of
77 subsystem configure phase of the kernel booting process.
81 function reclaims an array of characters earlier allocated by one of the
83 functions for use by the caller.
87 functions look up a given entry in the kernel environment, and return it if
99 if successful, and return the
100 found value in the given destination.
104 function returns the value string or
110 function sets a given environment key to the given value. It returns
116 arguments were too large, the maxmimum number of entries in the dynamic
117 environment was reached, or if the dynamic environment was not setup yet.
118 The latter can happen when calling
122 subsystem is initialized.
126 function tests whether a given key exists in the kernel environment, returning
134 function removes a given key and its associated value from the dynamic kernel
138 if the key does not exist, or if the dynamic was not setup yet.
139 If successful, it returns
142 .Bl -tag -width indent
143 .It Va kern.environment
144 Current static kernel environment query OID.
147 .Bl -tag -width ".Pa sys/kern/kern_environment.c"
148 .It Pa sys/kern/kern_environment.c
158 function first appeared in
169 and other functions first appeared in
177 implementation was written by
179 It was subsequently extended by
184 This manual page was written by
185 .An Thomas E. Spanjaard .
189 sysctl OID currently only reports information about the static kernel
190 environment, not the dynamic one.
192 The return values from various functions could do with some standardisation,
193 using the error codes from