tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

*oldlenp comes back with wrong value in helper sysctl_createv() function




I am creating a sysctl entry for TSLOG https://man.freebsd.org/cgi/man.cgi?query=tslog&sektion=4&manpath=freebsd-release

In every example I see in our source tree, I read that when oldp is
NULL, *oldlenp should be set to desired size, return 0, and the
sysctl_createv() helper function will be again called with the right
*oldlenp value.
Except it does not, the first time it calls back the helper function,
*oldlenp value is 1024 no matter what I set it to before.
But if I return once again (either with ENOMEM or 0, doesn't matter),
the helper function will now be called with the right *oldlenp value.

I fail to see where this behavior comes from and I'd like to
understand the logic behind it.

--
------------------------------------------------------------------------
Emile `iMil' Heitor <imil@{home.imil.net,NetBSD.org}> | https://imil.net


Home | Main Index | Thread Index | Old Index