]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Make sysctl user.local a tunable that can be written at run-time
authorStefan Eßer <se@FreeBSD.org>
Sat, 31 Oct 2020 23:48:41 +0000 (23:48 +0000)
committerStefan Eßer <se@FreeBSD.org>
Sat, 31 Oct 2020 23:48:41 +0000 (23:48 +0000)
commit1ebef47735cbe16360fc456cc88971e5cc4cee22
treea9155c14dd08d7f6477d9f90a605f6e4c9e93b2a
parent113ec54c58a90f3bd71778b869e9cff5849ee9dc
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