Subject: Re: sysctl granularity guidelines?
To: None <tech-kern@netbsd.org>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 04/09/2004 14:38:30
On Fri, Apr 09, 2004 at 12:45:13PM -0500, David Young wrote:
>Can anybody suggest principles of sysctl granularity? Even if they are
>purely extemporaneous, I think that it will help.  I ask because I am
>mulling this idea of exposing the ieee80211 node database using sysctl,
>but I'm still not sure what the granularity should be.

imho, for this you should probably put together an interface similar
to that of kern.proc (or kern.proc2 or kern.lwp or kern.buf, etc)
where the leaf node you "create" has type "node", and the caller
specifies four extra mib numbers that allow picking a subset vs a
criterion, the number requested, and the size.

as for the "extemporaneous" aspect, you can add and remove them
whenever you wish, but (a) only from a context where you can sleep and
(b) i would strongly urge you to avoid a situation where you are
rapidly adding and removing nodes as much as you can (eg, when a
802.11 peer appears for a split second and disappears again).

>Just to give you some idea what the dilemma is, there are a bunch of
>fields in each client/peer's ieee80211_node structure that I would like
>for somebody to be able to examine.  I had thought at first that a user
>would examine them with sysctl -a, but that's really a very bushy sysctl
>tree, with lots of sysctl_node overhead!  So I thought that I would
>expose all the essential variables using an ieee80211_node_ex. But how
>to index that?  I could put paths into the sysctl tree containing the
>BSSID and MAC,
>
>	hw.wi0.nodes.02:0a:2f:39:48.00:2d:aa:fe:50.<ieee80211_node_ex>
>
>That helps random access to the nodes (I have in mind a daemon that will
>need random access), however, there is still the sysctl_node overhead.

(1) the ':' character is not allowed in sysctl node names in order to
avoid the possibility of parse errors.  use '_' or '-' instead.

(2) those strings (00:2d:aa:fe:50 for example) seem a tad short.  i
presume you missing an octet there, yes?

(3) a new netstat option might make sense for dumping your 802.11 peer
information, somewhat akin to how it does the kern.mbuf.stats and
kern.mbuf.mowners stuff.  that way you get get better formatting than
the sysctl(8) output (which is one line per datum), and you can also
avoid adding yet another fooctl or fooconfig type program.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
werdna@squooshy.com       * "information is power -- share the wealth."