Date: Sun, 15 Nov 2020 14:34:46 -0600 From: Kyle Evans <kevans@freebsd.org> To: Stefan Esser <se@freebsd.org> Cc: Guy Yur <guyyur@gmail.com>, Scott Long <scottl@samsco.org>, freebsd-current <freebsd-current@freebsd.org>, kaktus@freebsd.org Subject: Re: pkg.c revision 367687 breaks pkg Message-ID: <CACNAnaEYb2WEMWje36oaz-CY=MVFuvNXMD8L3O7PZFU_1o9iKg@mail.gmail.com> In-Reply-To: <d6cc7841-3e27-deca-496e-38b5cad58920@freebsd.org> References: <A3B7709B-8C16-48E0-9A6C-E45D206F6DE6@gmail.com> <EC6FF21B-109A-45EE-97F2-A04B1F195DFA@samsco.org> <4e5fe0a6-7325-d413-f68f-2c0ebaa34763@gmail.com> <CACNAnaEGMBze8-XD61KB0ckH0__YJYPAEpQML3B0BesCeRUxFQ@mail.gmail.com> <d6cc7841-3e27-deca-496e-38b5cad58920@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 15, 2020 at 2:05 PM Stefan Esser <se@freebsd.org> wrote: > > Am 15.11.20 um 20:41 schrieb Kyle Evans: > > This is a separate (valid) problem, but not directly related to > > Scott's work here. sysctlbyname now goes directly to the kernel with > > no chance for the user.* sysctls to intercept. That should > > independently be fixed to maintain the illusion that they're real > > sysctl's. > > user.localbase is a real sysctl, but with a default value returned > when sysctl(3) is used. > Yup. > The getlocalbase() function should not depend on this default value, > since it contains an identicl default value that can be returned if > sysctlbyname fails (or rather returns a zero length string in case > no other value has been written to the kernel). > I don't care about this particular application, to be honest, but about the general problem. libc has a sizable chunk of code in sysctl(3) dealing with user.* sysctls, and sysctlbyname will never see it. This isn't documented in the manpage, and IMO it's really just an oversight; libc should still be able to provide the values as seen in ^/lib/libc/gen/sysctl.c whether you've invoked sysctl() or sysctlbyname(). At a glance, it looks like localbase is the only one that's also tunable, most of these don't really even need to take a trip to the kernel to read. Thanks, Kyle Evans
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaEYb2WEMWje36oaz-CY=MVFuvNXMD8L3O7PZFU_1o9iKg>