diff --git a/lib/libc/gen/sysctl.c b/lib/libc/gen/sysctl.c index 274e199dad5f..4495010332c8 100644 --- a/lib/libc/gen/sysctl.c +++ b/lib/libc/gen/sysctl.c @@ -87,6 +87,15 @@ sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, 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)) { diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index 090f3ff3aeef..47923da113d3 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -652,6 +652,8 @@ SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFLAG_RD, 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 SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD, diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index bc09fa9a7783..9e9bd723f4bd 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -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 */