From owner-freebsd-arch Mon Jan 15 22:34: 2 2001 Delivered-To: freebsd-arch@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 3A05B37B400 for ; Mon, 15 Jan 2001 22:33:43 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f0G6XgG00716; Mon, 15 Jan 2001 22:33:42 -0800 (PST) Date: Mon, 15 Jan 2001 22:33:42 -0800 From: Alfred Perlstein To: Kirk McKusick Cc: arch@FreeBSD.ORG Subject: Re: dynamic vs static sysctls? Message-ID: <20010115223342.L7240@fw.wintelcom.net> References: <20010115103757.B7240@fw.wintelcom.net> <200101152345.PAA22257@beastie.mckusick.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200101152345.PAA22257@beastie.mckusick.com>; from mckusick@mckusick.com on Mon, Jan 15, 2001 at 03:45:35PM -0800 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Kirk McKusick [010115 20:23] wrote: > Date: Mon, 15 Jan 2001 10:37:57 -0800 > From: Alfred Perlstein > To: Hajimu UMEMOTO > Cc: arch@FreeBSD.ORG > Subject: dynamic vs static sysctls? > > [moved to -arch] > > ... > > No one I know wants to use sysctl instead of getsysctlbyname afaik, > however, I would like to know if my opinions are the what we're > aiming for. > > ... > > -- > -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] > "I have the heart of a child; I keep it in a jar on my desk." > > I have an example where sysctl is still useful. In my work on a > background version of fsck, I have used sysctl to allow me to > pass information into the kernel that I want to have updated in > the filesystem. In the case of lost blocks, there may be hundreds > or even thousands of blocks that need to be put back into the > bit maps. Each non-contiguous block is passed in separately > which results in hundreds or thousands of sysctl calls. I want > to do one call to sysctlnametomib (a new, but obviously trivial > function) to return the numeric mib, and then use that mib on all > the subsequent sysctl calls. That dramatically cuts down on the > time it takes to return the blocks since I do not have to translate > the same name repeatedly (which takes far longer than the block > release itself). I would think that this might be an issue for > any application that uses sysctl to get/set the same information > repeatedly. I like this optimization, the only problem is that there's a chance that a dynamic sysctl may disapear out from under you, and even worse, replaced by an unrelated writeable one. Perhaps you should include a generation count within the sysctl to prevent this sort of potential problem? So besideds passing the sysctl number, you would include a generation count and error out if both numbers didn't match? -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message