git: 52122fa0968f - stable/12 - Add `kern.features.witness`

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Mon, 11 Apr 2022 02:07:47 UTC
The branch stable/12 has been updated by ngie:

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

commit 52122fa0968fdaaacf3803e711604d4600d489ff
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2020-06-24 18:51:01 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2022-04-11 01:29:17 +0000

    Add `kern.features.witness`
    
    Adding `kern.features.witness` helps expose whether or not the kernel has
    `options WITNESS` enabled, so the `feature_present(3)` API can be used
    to query whether or not witness(9) is built into the kernel.
    
    This support is helpful with userspace applications (generally speaking,
    tests), as it can be queried to determine whether or not tests related
    to WITNESS should be run.
    
    MFC after:      1 week
    Reviewed by: cem, darrick.freebsd_gmail.com
    Differential Revision: https://reviews.freebsd.org/D25302
    Sponsored by:   DellEMC Isilon
    
    Conflicts:
            sys/kern/subr_witness.c
    
    (cherry picked from commit d6701b6c8ccf35c66d357fe02494d0f60ee62f4e)
---
 sys/kern/subr_witness.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 3d140beb70cf..e88535f69b69 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -360,6 +360,8 @@ static int	witness_output(const char *fmt, ...) __printflike(1, 2);
 static int	witness_voutput(const char *fmt, va_list ap) __printflike(1, 0);
 static void	witness_setflag(struct lock_object *lock, int flag, int set);
 
+FEATURE(witness, "kernel has witness(9) support");
+
 static SYSCTL_NODE(_debug, OID_AUTO, witness, CTLFLAG_RW, NULL,
     "Witness Locking");