Subject: Re: dynamic sysctl
To: David Laight <email@example.com>
From: Andrew Brown <firstname.lastname@example.org>
Date: 11/16/2003 20:41:44
>> > sysctlnametomib() will use sysctl() to ask the kernel for the
>> > name<->number mapping at a given level (eg kern.* or net.inet.*). i
>> What does this sysctl() call look like? There is no option of sysctl to
>> tell the name<->number mapping currently. Will there also be a way to
>> enumerate all subnodes of a given node?
>Why not just make:
> sysctl((void *)"kern.maxproc", 0, &buf, sizeof buf, NULL, 0);
>return the value of kern.maxproc (etc).
sounds nice, but how does that communicate the type of the returned
data to the caller? or maybe buf could then consist of a type number,
followed by a length number, followed by the actual data...
we can do that later.
>Return EISDIR if there are extra levels, and make "kern.*" return
>the list of names at the next level.
exactly. most of the groundwork for doing something like this is in
what i've got.
>All you need then is some heuristic in sysctl(1) to work out how to
>format unknown items.
you mean like the structs? i still say that sysctl(8) shouldn't need
to know how to display arbitrary structs.
|-----< "CODE WARRIOR" >-----|
email@example.com * "ah! i see you have the internet
firstname.lastname@example.org (Andrew Brown) that goes *ping*!"
email@example.com * "information is power -- share the wealth."