git: 98af94cae78a - main - sysconf(3): add _SC_UEXTERR_LEN, the max length of the extended error string
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 31 May 2025 19:52:55 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=98af94cae78a01a62d1094e4f255f50af2e1269a
commit 98af94cae78a01a62d1094e4f255f50af2e1269a
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-05-24 11:10:48 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-05-31 19:52:42 +0000
sysconf(3): add _SC_UEXTERR_LEN, the max length of the extended error string
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D50483
---
include/unistd.h | 1 +
lib/libc/gen/sysconf.c | 3 +++
sys/sys/exterrvar.h | 2 ++
3 files changed, 6 insertions(+)
diff --git a/include/unistd.h b/include/unistd.h
index 8574b2ba9915..33dd983eb11a 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -292,6 +292,7 @@ typedef __useconds_t useconds_t;
#define _SC_NPROCESSORS_CONF 57
#define _SC_NPROCESSORS_ONLN 58
#define _SC_CPUSET_SIZE 122
+#define _SC_UEXTERR_MAXLEN 123 /* user */
#endif
/* Extensions found in Solaris and Linux. */
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index 6a838ddd58d8..d20b70590fb6 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -34,6 +34,7 @@
#include "namespace.h"
#include <sys/param.h>
+#include <sys/exterrvar.h>
#include <sys/time.h>
#include <sys/sysctl.h>
#include <sys/resource.h>
@@ -602,6 +603,8 @@ yesno:
return (-1);
return ((long)value);
#endif
+ case _SC_UEXTERR_MAXLEN:
+ return (UEXTERROR_MAXLEN);
default:
errno = EINVAL;
diff --git a/sys/sys/exterrvar.h b/sys/sys/exterrvar.h
index 5afcd82b136a..6eb08d63aa48 100644
--- a/sys/sys/exterrvar.h
+++ b/sys/sys/exterrvar.h
@@ -26,6 +26,8 @@ struct uexterror {
char msg[128];
};
+#define UEXTERROR_MAXLEN 256
+
#define UEXTERROR_VER 0x10010001
#define EXTERRCTL_ENABLE 1