From owner-freebsd-arch Mon Jan 15 23:13:52 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mass.osd.bsdi.com (mass.dis.org [216.240.45.41]) by hub.freebsd.org (Postfix) with ESMTP id C0A8B37B401 for ; Mon, 15 Jan 2001 23:13:35 -0800 (PST) Received: from mass.osd.bsdi.com (localhost [127.0.0.1]) by mass.osd.bsdi.com (8.11.1/8.11.1) with ESMTP id f0G7Rss00920; Mon, 15 Jan 2001 23:27:54 -0800 (PST) (envelope-from msmith@mass.osd.bsdi.com) Message-Id: <200101160727.f0G7Rss00920@mass.osd.bsdi.com> X-Mailer: exmh version 2.1.1 10/15/1999 To: Kirk McKusick Cc: arch@FreeBSD.ORG Subject: Re: dynamic vs static sysctls? In-reply-to: Your message of "Mon, 15 Jan 2001 15:45:35 PST." <200101152345.PAA22257@beastie.mckusick.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 15 Jan 2001 23:27:54 -0800 From: Mike Smith Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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'm not convinced that sysctl is the "right" way to go about doing this, really. But I can't think of a better one. 8) > 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. This functionality already exists; it's simply undocumented and doesn't have a convenient library wrapper function. See eg. the sysctlbyname implementation, kenv, ifconfig, etc. > 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. It is. It's also useful in the case where you use trailing fields in the MIB to pass arguments to the sysctl handler. -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message