From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 5 16:04:27 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 A4D5116A41F for ; Fri, 5 Aug 2005 16:04:27 +0000 (GMT) (envelope-from thib@mi.is) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B21043D68 for ; Fri, 5 Aug 2005 16:04:16 +0000 (GMT) (envelope-from thib@mi.is) Received: from caulfield ([85.220.64.242] [85.220.64.242]) by quasar.skima.is; Fri, 5 Aug 2005 16:04:14 Z Date: Fri, 5 Aug 2005 16:04:15 +0000 From: "Thordur I. Bjornsson" To: freebsd-hackers@freebsd.org Message-Id: <20050805160415.44b0b05e.thib@mi.is> In-Reply-To: <42F386B2.1010108@samsco.org> References: <20050805005543.5bd947f2.thib@mi.is> <20050805145046.GB78669@dan.emsphone.com> <42F386B2.1010108@samsco.org> Organization: n/a X-Mailer: Sylpheed version 1.0.5 (GTK+ 1.2.10; i386-portbld-freebsd5.4) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 16:04:27 -0000 On Fri, 05 Aug 2005 09:33:06 -0600 Scott Long wrote: > 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. > > > > Most of those integer values are also declared static, so they won't > be visible to external code, especially not kld's. > > There is no easy way to do this. I'm sure that you could hack up some > code to simulate a sysctl syscall from within the kernel, but that > would be really really gross, evil, and wrong. What values are you > trying to get at? Would it make more sense to export them via real > accessor functions? > > Scott I thought that would be a proplem. I'm trying to see the value of net.inet.tcp.drop_synfin . I could always just use the #ifdef TCP_DROP_SYNFIN wich gets set with the kernel option but that does not mean that the sysctl is set and the user/admin want's to drop SYNFIN packet's. Since I'm a novice/newbie when it comes to "kernel" programming any tips will be really good. I'll continue to search for this. PS: If you don't mind, what is a "real accessor function" ? -- Thordur I. Humppa!