sysctl vs procfs

Vadim Goncharov vadim_nuclight at
Wed Mar 12 10:06:44 UTC 2008


While it is good idea to prefer more consistent sysctl in favor of procfs, the
sysctl interface has some drawbacks. For example, procfs has good file
interface for big things, like VM map of the process. Imagine 800 megs... and
sysctl in-kernel interface locks value then copies it to in-kernel memory then
it can be copied to userspace. Not suitable for providing alternative to procfs
in reading big files and getting rid of procfs, of course.

So, what about adding sysctl interfaces allowing userland-application to read
large buffers in parts without copying? Application, of course, should be aware
of the fact that underlying buffer can change while copying, but many our base
utilities (like netstat) already work in these conditions.

Another proposal is about human-readable conversions. We already have C structs
and arrays parsing/unparsing code in netgraph (/sys/netgraph/ng_parse.c). What
about porting it userland (or leave in kernel, this should be thought) to allow
user-interpreting blobs which are even hidden to user without sysctl -A ? This
and previous can improve our KVM interactions, I think.

WBR, Vadim Goncharov. ICQ#166852181       mailto:vadim_nuclight at
[Moderator of RU.ANTI-ECOLOGY][FreeBSD][][LJ:/nuclight]

More information about the freebsd-arch mailing list