summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2007-12-31 21:12:05 +0000
committerjhb <jhb@FreeBSD.org>2007-12-31 21:12:05 +0000
commit2a7210a6c49146c206dc44b0c63af34cadf19cce (patch)
tree84f901f44ba4d356a8f256e4db9667b99b2122b6
parent72360ebb8e6378002b99b7d37452110a63ff1d26 (diff)
downloadFreeBSD-src-2a7210a6c49146c206dc44b0c63af34cadf19cce.zip
FreeBSD-src-2a7210a6c49146c206dc44b0c63af34cadf19cce.tar.gz
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
-rw-r--r--sys/sys/sysctl.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 653dfd5..7c314e2 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -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);
OpenPOWER on IntegriCloud