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
44 .Nd API for manipulation of the kernel environment
48 .Fn kfreeenv "char *env"
50 .Fn kgetenv "const char *name"
52 .Fn kgetenv_int "const char *name" "int *data"
54 .Fn kgetenv_quad "const char *name" "quad_t *data"
56 .Fn kgetenv_string "const char *name" "char *data" "int size"
58 .Fn kgetenv_ulong "const char *name" "unsigned long *data"
60 .Fn ksetenv "const char *name" "const char *value"
62 .Fn ktestenv "const char *name"
64 .Fn kunsetenv "const char *name"
67 provides an API for manipulation of the kernel environment of a live system by
69 (other kernel subsystems).
70 Upon boot, the kernel environment is inherited from
72 The static environment inherited is converted to a dynamic array at the end of
75 subsystem configure phase of the kernel booting process.
79 function reclaims an array of characters earlier allocated by one of the
81 functions for use by the caller.
85 functions look up a given entry in the kernel environment, and return it if
97 if successful, and return the found value in the given destination.
101 function returns the value string or
107 function sets a given environment key to the given value. It returns
113 arguments were too large, the maxmimum number of entries in the dynamic
114 environment was reached, or if the dynamic environment was not setup yet.
115 The latter can happen when calling
119 subsystem is initialized.
123 function tests whether a given key exists in the kernel environment, returning
131 function removes a given key and its associated value from the dynamic kernel
135 if the key does not exist, or if the dynamic was not setup yet.
136 If successful, it returns
139 .Bl -tag -width indent
140 .It Va kern.environment
141 Current static kernel environment query OID.
144 .Bl -tag -width ".Pa sys/kern/kern_environment.c"
145 .It Pa sys/kern/kern_environment.c
155 function first appeared in
166 and other functions first appeared in
174 implementation was written by
176 It was subsequently extended by
181 This manual page was written by
182 .An Thomas E. Spanjaard .
186 sysctl OID currently only reports information about the static kernel
187 environment, not the dynamic one.
189 The return values from various functions could do with some standardisation,
190 using the error codes from