From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 5 15:54:30 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 567DB16A41F for ; Fri, 5 Aug 2005 15:54:30 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id B619A43D72 for ; Fri, 5 Aug 2005 15:54:25 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.40.201] (Not Verified[65.202.103.25]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Fri, 05 Aug 2005 12:09:01 -0400 From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 5 Aug 2005 11:01:32 -0400 User-Agent: KMail/1.8 References: <20050805005543.5bd947f2.thib@mi.is> <20050805145046.GB78669@dan.emsphone.com> In-Reply-To: <20050805145046.GB78669@dan.emsphone.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200508051101.33927.jhb@FreeBSD.org> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: Dan Nelson Subject: Re: Checking sysctl values from within the kernel. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2005 15:54:30 -0000 On Friday 05 August 2005 10:50 am, Dan Nelson wrote: > In the last episode (Aug 05), Thordur I. Bjornsson said: > > If I want to check a sysctl value from within the kernel (e.g. an > > KLD), should I use the system calls described in sysctl(3) ? > > > > If not, what is the propper way to do so ? > > Since most sysctls are direct mappings onto integer variables in the > kernel, just check the variable directly. There's also a kernel_sysctl() function available in the kernel for in-kernel access to sysctls. You might have to lookup the OID for a given name yourself though. Actually, there's a kernel_sysctlbyname() as well. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org