GSoC: registration of optional kernel features via sysctl: a question to the community

John Baldwin jhb at freebsd.org
Fri Jun 11 12:25:03 UTC 2010


On Friday 11 June 2010 12:28:58 am Adrian Chadd wrote:
> How about exposing a simple userspace API for doing this, rather than
> doing it via sysctl?
> 
> That way you could "simply" tie alternative overrides in as needed for
> builds (eg, environment variables setting overrides; and/or pointing
> to a configuration file with such) but not affect any runtime
> detection the rest of the system is doing.

man 3 feature_present

I don't see much practical use for spoofing.  If there really was a desire for 
such a thing, then perhaps you could implement it in libc keyed off 
environment variables.

It would perhaps be useful to have a feature_present(1) for ports that uses 
the API instead of using the sysctls directly, but I really don't think there 
are any useful cases for spoofing.

At Y! we used kern.features.pae in kmod.mk to automatically enable PAE in 
standalone kernel module builds if the running kernel was using PAE since PAE 
alters the kernel ABI.

-- 
John Baldwin


More information about the freebsd-hackers mailing list