svn commit: r367179 - in head: lib/libc/gen sys/kern sys/sys
Stefan Eßer
se at FreeBSD.org
Fri Oct 30 18:48:10 UTC 2020
Author: se
Date: Fri Oct 30 18:48:09 2020
New Revision: 367179
URL: https://svnweb.freebsd.org/changeset/base/367179
Log:
Add read only sysctl variable user.localbase
The value is provided by the C library as for other sysctl variables in
the user tree. It is compiled in and returns the value of _PATH_LOCALBASE
defined in paths.h.
Reviewed by: imp, scottl
Differential Revision: https://reviews.freebsd.org/D27009
Modified:
head/lib/libc/gen/sysctl.c
head/sys/kern/kern_mib.c
head/sys/sys/sysctl.h
Modified: head/lib/libc/gen/sysctl.c
==============================================================================
--- head/lib/libc/gen/sysctl.c Fri Oct 30 18:22:46 2020 (r367178)
+++ head/lib/libc/gen/sysctl.c Fri Oct 30 18:48:09 2020 (r367179)
@@ -87,6 +87,15 @@ sysctl(const int *name, u_int namelen, void *oldp, siz
if (oldp != NULL)
memmove(oldp, _PATH_STDPATH, sizeof(_PATH_STDPATH));
return (0);
+ case USER_LOCALBASE:
+ if (oldp && orig_oldlen < sizeof(_PATH_LOCALBASE)) {
+ errno = ENOMEM;
+ return -1;
+ }
+ *oldlenp = sizeof(_PATH_LOCALBASE);
+ if (oldp != NULL)
+ memmove(oldp, _PATH_LOCALBASE, sizeof(_PATH_LOCALBASE));
+ return(0);
}
if (oldp && *oldlenp < sizeof(int)) {
Modified: head/sys/kern/kern_mib.c
==============================================================================
--- head/sys/kern/kern_mib.c Fri Oct 30 18:22:46 2020 (r367178)
+++ head/sys/kern/kern_mib.c Fri Oct 30 18:48:09 2020 (r367179)
@@ -652,6 +652,8 @@ SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG
SYSCTL_NULL_INT_PTR, 0, "Min Maximum number of streams a process may have open at one time");
SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD,
SYSCTL_NULL_INT_PTR, 0, "Min Maximum number of types supported for timezone names");
+SYSCTL_STRING(_user, USER_LOCALBASE, localbase, CTLFLAG_RD,
+ "", 0, "Prefix used to install and locate add-on packages");
#include <sys/vnode.h>
SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD,
Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h Fri Oct 30 18:22:46 2020 (r367178)
+++ head/sys/sys/sysctl.h Fri Oct 30 18:48:09 2020 (r367179)
@@ -1070,6 +1070,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
+#define USER_LOCALBASE 21 /* string: _PATH_LOCALBASE */
#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */
#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */
More information about the svn-src-all
mailing list