From owner-freebsd-net@FreeBSD.ORG Tue Sep 19 10:55:37 2006 Return-Path: X-Original-To: freebsd-net@FreeBSD.ORG Delivered-To: freebsd-net@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7AE2616A51B for ; Tue, 19 Sep 2006 10:55:37 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id C3D4943D53 for ; Tue, 19 Sep 2006 10:55:36 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (bqjylq@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k8JAtTU4067913; Tue, 19 Sep 2006 12:55:34 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k8JAtSeJ067912; Tue, 19 Sep 2006 12:55:28 +0200 (CEST) (envelope-from olli) Date: Tue, 19 Sep 2006 12:55:28 +0200 (CEST) Message-Id: <200609191055.k8JAtSeJ067912@lurza.secnetix.de> From: Oliver Fromme To: freebsd-net@FreeBSD.ORG, sivakumar.subramani@wipro.com In-Reply-To: <956E7FA2615F3B4595FC5F22870A72210817F1@blr-m3-msg.wipro.com> X-Newsgroups: list.freebsd-net User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Tue, 19 Sep 2006 12:55:35 +0200 (CEST) Cc: Subject: Re: How to access the values of the kenv variables in driver code? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-net@FreeBSD.ORG, sivakumar.subramani@wipro.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Sep 2006 10:55:37 -0000 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