From a207e41bef089b8849a230f44088a562d0b5d19f Mon Sep 17 00:00:00 2001 From: mux Date: Wed, 17 Apr 2002 13:06:36 +0000 Subject: 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 --- sys/ia64/ia64/machdep.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/ia64') diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index dbd66e4..95d18fa 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -479,6 +479,7 @@ ia64_init(u_int64_t arg1, u_int64_t arg2) if (strcmp(p, "yes") == 0 || strcmp(p, "YES") == 0) { boothowto |= RB_VERBOSE; } + freeenv(p); } if (boothowto & RB_VERBOSE) @@ -543,8 +544,10 @@ ia64_init(u_int64_t arg1, u_int64_t arg2) init_param1(); p = getenv("kernelname"); - if (p) + if (p) { strncpy(kernelname, p, sizeof(kernelname) - 1); + freeenv(p); + } kernstartpfn = atop(IA64_RR_MASK(kernstart)); kernendpfn = atop(IA64_RR_MASK(kernend)); -- cgit v1.1