kernel features MIB
John Baldwin
jhb at freebsd.org
Wed Jan 9 14:00:44 PST 2008
On Friday 28 December 2007 05:45:07 pm John Baldwin wrote:
> On Thursday 27 December 2007 05:04:44 pm John Baldwin wrote:
> > At work we don't have a pretty API for this at all, but I'm thinking for
> > FreeBSD we can do this:
> >
> > FEATURE(foo, "description of foo")
> >
> > which is a macro to create the 'kern.features.foo' node and set it to 1.
Then
> > we could have a routine in libc:
> >
> > int feature_present(const char *name);
> >
> > That returns a boolean to indicate if a given feature is present or not by
> > invoking sysctlbyname(3), etc.
> >
> > Any objections to the idea?
>
> So here's a bikeshed question I have no idea for. Which header should
> feature_present()'s prototype go in? I anticipate this routine being
> used in libc itself, so I don't think it can go into libutil.
I went with the _BSD_VISIBLE portion of <unistd.h> since it is sort of similar
to sysconf(3) which is also in that header and we already have several other
prototypes in the _BSD_VISIBLE section. I think I still prefer
feature_present(3) to adding new sysconf(3) constants as this is simpler to
maintain (don't have to add a new constant that maps to a sysctl for each
feature). Patch is at
http://www.FreeBSD.org/~jhb/patches/feature_present.patch
--
John Baldwin
More information about the freebsd-arch
mailing list