summaryrefslogtreecommitdiffstats
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2002-04-17 13:06:36 +0000
committermux <mux@FreeBSD.org>2002-04-17 13:06:36 +0000
commita207e41bef089b8849a230f44088a562d0b5d19f (patch)
treecb447f9f2a04a764ece9fcefc6fa6b52d19870b8 /sys/kern/init_main.c
parentc79270302c4767b589a4fe70da3ba9866936358f (diff)
downloadFreeBSD-src-a207e41bef089b8849a230f44088a562d0b5d19f.zip
FreeBSD-src-a207e41bef089b8849a230f44088a562d0b5d19f.tar.gz
Rework the kernel environment subsystem. We now convert the static
environment needed at boot time to a dynamic subsystem when VM is up. The dynamic kernel environment is protected by an sx lock. This adds some new functions to manipulate the kernel environment : freeenv(), setenv(), unsetenv() and testenv(). freeenv() has to be called after every getenv() when you have finished using the string. testenv() only tests if an environment variable is present, and doesn't require a freeenv() call. setenv() and unsetenv() are self explanatory. The kenv(2) syscall exports these new functionalities to userland, mainly for kenv(1). Reviewed by: peter
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 4f0aa45..6904392 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -528,9 +528,12 @@ start_init(void *dummy)
if ((var = getenv("init_path")) != NULL) {
strncpy(init_path, var, sizeof init_path);
init_path[sizeof init_path - 1] = 0;
+ freeenv(var);
}
- if ((var = getenv("kern.fallback_elf_brand")) != NULL)
+ if ((var = getenv("kern.fallback_elf_brand")) != NULL) {
fallback_elf_brand = strtol(var, NULL, 0);
+ freeenv(var);
+ }
for (path = init_path; *path != '\0'; path = next) {
while (*path == ':')
OpenPOWER on IntegriCloud