Versioning support for kernel<>userland sysctl interface

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Nov 2 22:18:16 UTC 2020


--------
John-Mark Gurney writes:
> Alexander V. Chernikov wrote this message on Sun, Nov 01, 2020 at 12:47 +0000
> :
> > I would like to propose a change [1] that introduces versioning support for
>  the data structures exposed to userland by sysctl interface.
> > 
> > We have dozens of interfaces exposing various statistics and control data b
> y filling in and exporting structures.
> > net.inet6.icmp6.stats or net.inet6.icmp6.nd6_prlist can be a good examples 
> of such interaction.
>
> We also need to decide the policy on dealing w/ support for these
> data structures going forward...  Because if we do the simple, default
> policy of all userland apps can handle all structures, and kernel can
> produce all structures, we now have an unbounded growth of complexity
> and testing...

Seriously...

We should stop exporting binary structures precisely because they
give us all this trouble to deal with in the first place.

It is cheaper, in terms of source lines, developer effort, code, bugs, and 
documentation to marshal these data into a defined format in the kernel
and export that same format on all archs & versions.

For data which seldomly changes, I will argue the format should be
ascii.

See also: 18 year old kernl.geom.conf{txt|xml|dot}

Statistics data and other high-frequency-change data, should be exported
via mmap(2), so that frequency of interrogation does not cause more
system calls on the system.

See also:  gstat(8), after pressing '<' a number of times.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list