git: c724b26acd59 - stable/15 - exterror: advertise error strings via kern.features.exterr_strings

Alexander Leidinger <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.devel.stable.scm
Message-ID <[email protected]>
The branch stable/15 has been updated by netchild:

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

commit c724b26acd59fe5078c5e64e707303ef9c2c522c
Author:     Alexander Leidinger <[email protected]>
AuthorDate: 2026-07-21 20:39:56 +0000
Commit:     Alexander Leidinger <[email protected]>
CommitDate: 2026-07-28 10:04:41 +0000

    exterror: advertise error strings via kern.features.exterr_strings
    
    Allow userland, in particular test cases for EXTERROR conversions,
    to detect at run time whether extended errors include the
    descriptive message strings, which depends on the EXTERR_STRINGS
    kernel option and cannot be probed in any other way.
    
    Reviewed by:            kib
    MFC after:              1 week
    Assisted-by:            Claude Code (Fable 5)
    Differential Revision:  https://reviews.freebsd.org/D58321
    
    (cherry picked from commit c8db6d4b63f18c81557628ad0d3f715bea46cc99)
---
 share/man/man9/exterror.9 | 13 ++++++++++++-
 sys/kern/sys_generic.c    |  4 ++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/share/man/man9/exterror.9 b/share/man/man9/exterror.9
index 47ffda065d43..2c9dc73f7616 100644
--- a/share/man/man9/exterror.9
+++ b/share/man/man9/exterror.9
@@ -6,7 +6,7 @@
 .\" Konstantin Belousov <[email protected]> under sponsorship
 .\" from the FreeBSD Foundation.
 .\"
-.Dd November 5, 2025
+.Dd July 21, 2026
 .Dt EXTERROR 9
 .Os
 .Sh NAME
@@ -171,6 +171,17 @@ were modified to print the extended information if it is available
 in addition to the usual
 .Va errno
 decoding.
+.Pp
+Kernels built with the
+.Cd option EXTERR_STRINGS
+advertise the
+.Va kern.features.exterr_strings
+.Xr sysctl 8
+variable, see
+.Xr feature_present 3 ,
+indicating that the reported errors include the descriptive message strings.
+Without it, only the numeric information (error code, category,
+source line number and parameters) is available.
 .Sh ASYNCHRONOUS INPUT/OUTPUT
 Due to the nature of the
 .Fx
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 1b88581714d2..b829a70f26aa 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -112,6 +112,10 @@ static MALLOC_DEFINE(M_IOCTLOPS, "ioctlops", "ioctl data buffer");
 static MALLOC_DEFINE(M_SELECT, "select", "select() buffer");
 MALLOC_DEFINE(M_IOV, "iov", "large iov's");
 
+#ifdef EXTERR_STRINGS
+FEATURE(exterr_strings, "Extended error reporting includes message strings");
+#endif
+
 static int	pollout(struct thread *, struct pollfd *, struct pollfd *,
 		    u_int);
 static int	pollscan(struct thread *, struct pollfd *, u_int);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.