Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Sep 2006 12:55:28 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        freebsd-net@FreeBSD.ORG, sivakumar.subramani@wipro.com
Subject:   Re: How to access the values of the kenv variables in driver code?
Message-ID:  <200609191055.k8JAtSeJ067912@lurza.secnetix.de>
In-Reply-To: <956E7FA2615F3B4595FC5F22870A72210817F1@blr-m3-msg.wipro.com>

next in thread | previous in thread | raw e-mail | index | archive | help
sivakumar.subramani@wipro.com wrote:
 > I would like to have some of the configuration parameters of my driver
 > to be present as part of the /boot/device.hints file. After adding a
 > variable I could see that variable and it's value as part of kevn's
 > ouput.
 > 
 > Can any one please let me know how to access the value of these
 > variables in my drive code?

>From sys/kern/kern_environment.c:

/*
 * The unified bootloader passes us a pointer to a preserved copy of
 * bootstrap/kernel environment variables.  We convert them to a
 * dynamic array of strings later when the VM subsystem is up.
 *
 * We make these available through the kenv(2) syscall for userland
 * and through getenv()/freeenv() setenv() unsetenv() testenv() for
 * the kernel.
 */

The following shell command will give you lots of examples:

find /usr/src/sys -name "*.c" | xargs grep -w getenv

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

C++: "an octopus made by nailing extra legs onto a dog"
        -- Steve Taylor, 1998



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