Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2001 23:27:54 -0800
From:      Mike Smith <msmith@freebsd.org>
To:        Kirk McKusick <mckusick@mckusick.com>
Cc:        arch@FreeBSD.ORG
Subject:   Re: dynamic vs static sysctls? 
Message-ID:  <200101160727.f0G7Rss00920@mass.osd.bsdi.com>
In-Reply-To: Your message of "Mon, 15 Jan 2001 15:45:35 PST." <200101152345.PAA22257@beastie.mckusick.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101160727.f0G7Rss00920>