I am playing around with the patchset “my” student generated during this years GSoC (the code for all projects is available from Google). In short, it gives you the possibility to query from userland, which optional kernel features are available. I have let him mostly do those features, which are not so easy to detect from userland, or where the detection could trigger an autoload of a kernel module.
I let the output speak for himself, first the output before his patchset:
kern.features.compat_freebsd7: 1
kern.features.compat_freebsd6: 1
kern.features.posix_shm: 1
And now with his patchset:
kern.features.compat_freebsd6: 1
kern.features.compat_freebsd7: 1
kern.features.ffs_snapshot: 1
kern.features.geom_label: 1
kern.features.geom_mirror: 1
kern.features.geom_part_bsd: 1
kern.features.geom_part_ebr: 1
kern.features.geom_part_ebr_compat: 1
kern.features.geom_part_mbr: 1
kern.features.geom_vol: 1
kern.features.invariant_support: 1
kern.features.kdtrace_hooks: 1
kern.features.kposix_priority_scheduling: 1
kern.features.ktrace: 1
kern.features.nfsclient: 1
kern.features.nfsserver: 1
kern.features.posix_shm: 1
kern.features.pps_sync: 1
kern.features.quota: 1
kern.features.scbus: 1
kern.features.softupdates: 1
kern.features.stack: 1
kern.features.sysv_msg: 1
kern.features.sysv_sem: 1
kern.features.sysv_shm: 1
kern.features.ufs_acl: 1
With his patches we have a total of 84 kernel features which can be queried (obviously I do not have all optional options enabled in the kernel which produces this output). All of the features also have a description, and it is easy to add more features. As an example I present what is necessary to produce the kern.features.stack output:
./kern/subr_stack.c:FEATURE(stack, “Support for capturing kernel stack”);
There is also a little userland application (and a library interface) which allows to query several features from scripts/applications with the possibility to pretend a feature is not there (the requirement for this was for ports; pretending a feature is there if it is not was ruled out because such run-time detection is only necessary for things which have to run soon and pretending some feature is there while it is not will cause big problems). Unfortunately the man page for the application is not yet ready, but I’m sure you can figure out how to use it.
The names of the features and the description follows an easy scheme, what is written down in NOTES is used as a name and a description for the feature (an exception is geom_part_X, there we decided to use a common theme (“GEOM partitioning class for XXX”) which is distinct from the corresponding geom_X class). If you have complains about what is used in a specific feature, do not complain to him: change it in NOTES and the feature will follow.
If you have questions, suggestions, or some other interest to contact him, his FreeBSD address is kibab@. Feel free to encourage him to go ahead with the next steps (finishing the man page, splitting up the patches into sensible pieces and presenting them on appropriate mailinglists for review). 🙂