]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Make sysctl user.local a tunable that can be written at run-time
authorse <se@FreeBSD.org>
Sat, 31 Oct 2020 23:48:41 +0000 (23:48 +0000)
committerse <se@FreeBSD.org>
Sat, 31 Oct 2020 23:48:41 +0000 (23:48 +0000)
commit8faaaf33250ce419067be3e8f28ea0e215b22411
treea9155c14dd08d7f6477d9f90a605f6e4c9e93b2a
parent1d346b5b450302fac1ae63d531d08c51c1ab39ed
Make sysctl user.local a tunable that can be written at run-time

This sysctl value had been provided as a read-only variable that is
compiled into the C library based on the value of _PATH_LOCALBASE in
paths.h.

After this change, the value is compiled into the kernel as an empty
string, which is translated to _PATH_LOCALBASE by the C library.

This empty string can be overridden at boot time or by a privileged
user at run time and will then be returned by sysctl.

When set to an empty string, the value returned by sysctl reverts to
_PATH_LOCALBASE.

This update does not change the behavior on any system that does
not modify the default value of user.localbase.

I consider this change as experimental and would prefer if the run-time
write permission was reconsidered and the sysctl variable defined with
CLFLAG_RDTUN instead to restrict it to be set at boot time.

MFC after: 1 month
lib/libc/gen/sysctl.c
sys/kern/kern_mib.c