git: e056f6da6188 - stable/14 - sys/sysctl.h: FEATURE_ADD()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 28 Nov 2023 11:40:46 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=e056f6da61884ed4a1c8a06d1ddee846cc613a32

commit e056f6da61884ed4a1c8a06d1ddee846cc613a32
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-11-20 22:43:07 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-11-28 11:39:38 +0000

    sys/sysctl.h: FEATURE_ADD()
    
    (cherry picked from commit 46f3a29ee144a7d2e74c8b3d6c5c7b28562c29e2)
---
 sys/sys/sysctl.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 9176d2c3efdd..bc7a2bc601a1 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -927,6 +927,12 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
 #define	FEATURE(name, desc)						\
 	SYSCTL_INT_WITH_LABEL(_kern_features, OID_AUTO, name,		\
 	    CTLFLAG_RD | CTLFLAG_CAPRD, SYSCTL_NULL_INT_PTR, 1, desc, "feature")
+/* Same for the dynamic registration. */
+#define	FEATURE_ADD(name, desc)						\
+	sysctl_add_oid(NULL, SYSCTL_CHILDREN(&sysctl___kern_features),	\
+	    OID_AUTO, name,						\
+	    CTLFLAG_RD | CTLFLAG_CAPRD | CTLTYPE_INT | CTLFLAG_MPSAFE,	\
+	    NULL, 1, sysctl_handle_int, "I", desc, "feature");
 
 #endif /* _KERNEL */