Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jun 2000 21:06:04 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        hackers@freebsd.org
Subject:   Re: getting the kernel environment? 
Message-ID:  <200006120406.VAA16187@mass.cdrom.com>
In-Reply-To: Your message of "Sun, 11 Jun 2000 20:28:25 PDT." <20000611202824.U18462@fw.wintelcom.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> How does one get the environment passed from the loader to the
> kernel from userland?
> 
> Yes, I see the sysctl_kernenv in kern_environment.c, but I'm having
> trouble decyphering as how to use it.

Use the sysctl lookup function to get the OID for kern.environment, then 
tack an integer on the end and start incrementing it until you get ENOENT.

Basically the same way you get the list of network interfaces.

-- 
\\ Give a man a fish, and you feed him for a day. \\  Mike Smith
\\ Tell him he should learn how to fish himself,  \\  msmith@freebsd.org
\\ and he'll hate you for a lifetime.             \\  msmith@cdrom.com




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006120406.VAA16187>