Subject: Re: dynamic sysctl
To: None <tech-kern@NetBSD.org>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 11/16/2003 22:12:45
>> how often do you think nodes will be added to (or removed from) the
>> tree? i figured on four generic "times":
>>
>> when the kernel boots (autoconfig has not yet happened)
>> during autoconfig or when a new device is detected
>> by an lkm when its loaded
>> by a process
>>
>> what were you thinking of?
>
>I had thought about using sysctl to show 802.11 peers/clients/APs.
ah.
>Clearly that would be an abuse of sysctl. Nevermind. =)
no, not necessarily.
suppose you plugged in your 802.11 card and the driver created the
sysctl node known as "dev.wi0.peers". it could, when queried, return
a structure (or an array of structures) that described the current
peer list. how does that sound? this would be something geared to a
specific purpose and not necessarily "printable" by the sysctl(8)
program. sysctl(8) handles the simple types, and can display a few of
the mildly more complex ones, but nowhere near all of them.
if you were looking for something like this:
dev.wi0.peer0.name
dev.wi0.peer1.name
dev.wi0.peer2.name
dev.wi0.peer3.name
dev.wi0.peer4.name
...
then when a new peer arrived, it would get a new mib number.
likewise, when it left, that number would become defunct. if they're
arriving and departing too quickly for your program to keep up, then
you either want to be able to ask for a snapshot of the current peer
list (as above) or (imho) you need to acknowledge that knowing the
name of a peer who was around for 2.7 milliseconds isn't really all
that worthwhile.
this is sort of the same as how i'm writing email to "david" right
now. in a few minutes, i might be writing email to "david" as well,
but "david" and "david" are not the same. i know a lot of people
named "david" (six off the top of my head :-).
also, if you unplug and replug your 802.11 card, it gets a new
interface number, and if it pops new entries into the mib, they *all*
get new numbers. the card might be the same, but the location might
be different, and the peers might be different, too.
does this sound at all convincing?
--
|-----< "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."