git: 4bf2e34a35ec - releng/14.0 - fd: Add sysctl flag CTLFLAG_TUN to loader tunables

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Thu, 12 Oct 2023 15:02:51 UTC
The branch releng/14.0 has been updated by zlei:

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

commit 4bf2e34a35ec10eaa43a3eb867f8e8fd34974264
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-10-09 10:30:21 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-10-12 14:59:52 +0000

    fd: Add sysctl flag CTLFLAG_TUN to loader tunables
    
    The following sysctl variables are actually loader tunables. Add sysctl
    flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.
    
     1. kern.maxfiles
     2. kern.maxfilesperproc
    
    No functional change intended.
    
    Reviewed by:    kib, imp
    Approved by:    re (gjb)
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D42113
    
    (cherry picked from commit 2af5ce5b5efb0cf6514acdc4a8b4058221641c39)
    (cherry picked from commit d9aa723347825418c742164c3e9a77d1e4b6943d)
---
 sys/kern/kern_descrip.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 35046c856d54..6ed824e229d6 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -5090,10 +5090,11 @@ DB_SHOW_COMMAND_FLAGS(files, db_show_files, DB_CMD_MEMSAFE)
 }
 #endif
 
-SYSCTL_INT(_kern, KERN_MAXFILESPERPROC, maxfilesperproc, CTLFLAG_RW,
+SYSCTL_INT(_kern, KERN_MAXFILESPERPROC, maxfilesperproc,
+    CTLFLAG_RWTUN | CTLFLAG_NOFETCH,
     &maxfilesperproc, 0, "Maximum files allowed open per process");
 
-SYSCTL_INT(_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RW,
+SYSCTL_INT(_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RWTUN | CTLFLAG_NOFETCH,
     &maxfiles, 0, "Maximum number of files");
 
 SYSCTL_INT(_kern, OID_AUTO, openfiles, CTLFLAG_RD,