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

Emile 'iMil' Heitor <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.