Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Dec 2007 18:17:00 +0100 (CET)
From:      "Max Laier" <max.laier@tm.uka.de>
To:        "John Baldwin" <jhb@FreeBSD.org>
Cc:        arch@freebsd.org
Subject:   Re: kernel features MIB
Message-ID:  <43684.2001:6f8:12c8:1:21d:60ff:fe0c:1771.1198862220.squirrel@router.laiers.local>
In-Reply-To: <200712271704.44796.jhb@FreeBSD.org>
References:  <200712271704.44796.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

Am Do, 27.12.2007, 23:04, schrieb John Baldwin:
> One of the things we have at work is a kern.features sysctl MIB that
> contains
> nodes to indicate if a named feature is present.  For example, on i386 we
> have kern.features.pae and we auto enable -DPAE for kernel modules if the
> currently running kernel is using PAE using that sysctl.
>
> One of the patches I want to commit soon is support for handling
> shm_open/shm_unlink directly in the kernel via swap-backed VM objects (the
> long-heralded memfd stuff).  I would like to have the sysctl MIB so that
> libc's for older releases (e.g. libc.so.6) could use the syscalls if they
> are
> available so that shm segments are shared between compat apps (e.g. 4.x or
> 6.x) and up-to-date apps.
>
> 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?

Sounds like a good idea indeed.  What about modules, though?  Would it
make sense to have something ident/strings parseable in the .kld to
identify features provided by that module?  feature_present (or
_available) could search the default module paths and return which module
needs to be loaded.  This could depend on FEATURE(kld, ...) and maybe
kern.securelevel.

-- 
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43684.2001:6f8:12c8:1:21d:60ff:fe0c:1771.1198862220.squirrel>