Add very basic support for the kernel to export a list of features. Each

feature is represented by a node in the new 'kern.features' sysctl node.
A feature is present if the corresponding node is present and evaluates to
true.

A FEATURE() wrapper macro is added which takes the sysctl node name and
a description of the feature as the sole arguments and creates a read-only
sysctl node with a value of 1.

Discussed on:	arch
This commit is contained in:
John Baldwin 2007-12-31 21:12:05 +00:00
parent 315f04614c
commit df67e9f2f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175019

View File

@ -322,6 +322,13 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
sysctl_add_oid(ctx, parent, nbr, name, (access), \
ptr, arg, handler, fmt, __DESCR(descr))
/*
* A macro to generate a read-only sysctl to indicate the presense of optional
* kernel features.
*/
#define FEATURE(name, desc) \
SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD, 0, 1, desc)
#endif /* _KERNEL */
/*
@ -621,6 +628,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
*/
extern struct sysctl_oid_list sysctl__children;
SYSCTL_DECL(_kern);
SYSCTL_DECL(_kern_features);
SYSCTL_DECL(_kern_ipc);
SYSCTL_DECL(_kern_proc);
SYSCTL_DECL(_sysctl);