Date: Sun, 15 Nov 2020 12:51:17 -0700 From: Scott Long <scottl@samsco.org> To: Kyle Evans <kevans@FreeBSD.org> Cc: Guy Yur <guyyur@gmail.com>, freebsd-current <freebsd-current@freebsd.org>, kaktus@freebsd.org Subject: Re: pkg.c revision 367687 breaks pkg Message-ID: <BEE5E27B-0964-4267-849C-F1C4B5252DAB@samsco.org> In-Reply-To: <CACNAnaEGMBze8-XD61KB0ckH0__YJYPAEpQML3B0BesCeRUxFQ@mail.gmail.com> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Nov 15, 2020, at 12:41 PM, Kyle Evans <kevans@FreeBSD.org> wrote: >=20 > On Sun, Nov 15, 2020 at 1:33 PM Guy Yur <guyyur@gmail.com> wrote: >>=20 >> On 15/11/20 8:55 pm, Scott Long wrote: >>> This is fixed in revision 367701 >>>=20 >>> Scott >>=20 >> Hi, >>=20 >> I am on revision 367710 (newer) and have the same problem. >> sysctlbyname() returns an empty string and length of 1. >> sysctl() with name converted to mib works fine. >>=20 >> ssize_t tmplen; >> char path[1000] =3D { 0 }; >>=20 >> tmplen =3D getlocalbase(path, sizeof(path)); >> printf("%s : %zd\n", path, tmplen); >>=20 >> tmplen =3D sizeof(path); >> if (sysctlbyname("user.localbase", path, (size_t *)&tmplen, NULL, 0) = =3D=3D 0) >> printf("%s : %zd\n", path, tmplen); >>=20 >> int mib[100] =3D { 0 }; >> size_t miblen; >> if (sysctlnametomib("user.localbase", mib, &miblen) =3D=3D 0) { >> for (int i =3D 0; i < miblen; i++) >> printf("%d ", mib[i]); >> printf("\n"); >> } >>=20 >> tmplen =3D sizeof(path); >> if (sysctl(mib, miblen, path, (size_t *)&tmplen, NULL, 0) =3D=3D 0) >> printf("%s : %zd\n", path, tmplen); >>=20 >> prints: >> : 1 >> : 1 >> 8 21 >> /usr/local : 11 >>=20 >> Thanks, >> Guy Yur >>=20 >=20 > 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=E2=80=99s It turns out the my userland, kernel, and startup scripts were out of sync and this was succeeding in error for me. Thanks for the hint, I think I have it working now. Scott
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BEE5E27B-0964-4267-849C-F1C4B5252DAB>