Subject: Re: new sysctl(KERN_PROC, ...) interface (was: sysinfo(2))
To: None <tech-kern@netbsd.org>
From: None <erh@nimenees.com>
List: tech-kern
Date: 04/15/2000 17:41:57
On Sat, Apr 15, 2000 at 03:27:17PM -0400, Aidan Cully wrote:
> After thinking a bit more about the versioning, I think a hybrid
> approach is best: When elements are removed from the structure, or
> change sizes, or get re-sorted, bump the KERN_PROC2 constant and
> provide a compatibility function[*]. But also provide the 'elemsize'
> argument, for dealing with adding fields to the structure. Best of
> both worlds, right? The 'flag/flaglen' thing, I don't care about.
This idea sounds ok but I think emphasis should be placed on
keeping the interface (==the structure returned) as static as possible
(and keep the interface simpler)
How about dropping the elemsize argument because it makes it to
easy to add stuff to the structure. Instead, have the kernel code, if
compiled with support for previous versions of KERN_PROC2, know how big
the structure should be and use that instead. (keep track of each different
struct and use the right one, with the obvious optimization for additions
of elements)
The idea here is that if it is a little more difficult to change
the structure it is more likely to stay the same.
eric