case CTLTYPE_STRING: {
unsigned char buf[1024], *tbuf;
tbuf = buf;
sz = sizeof(buf);
rc = prog_sysctl([0], namelen, tbuf, , NULL, 0);
The sysctl command first tries with a buffer of 1024 bytes
and retries with the
On Sat, Jan 20, 2024 at 10:48:12AM +0100, Emile 'iMil' Heitor wrote:
Hi,
that's from sysctl.c:
case CTLTYPE_STRING: {
unsigned char buf[1024], *tbuf;
tbuf = buf;
sz = sizeof(buf);
rc = prog_sysctl([0], namelen, tbuf, ,
The helper function produces the value that is returned in *oldlenp.
If you happen to use CTL_DESCRIBE (e.g. running sysctl -d), it's
not your helper function being called but the sysctl_describe helper
that returns a value of 1024.
Maybe you can show your helper routine and how you call sysctl
i...@home.imil.net (Emile 'iMil' Heitor) writes:
>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