where if_iterate (if_fn fn, void *private) does buf = alloca (bufsize); if (__sysctl (request, 6, buf, &bufsize, NULL, 0) >= 0) Are you still saying that it should pass zero as third argument?
No ;-) The code is different on plain FreeBSD and GNU/kFreeBSD. The FreeBSD one 1st passes zero, to get right buffer size, while our code uses doubling of buffer size. Sorry, wrong guess. BTW, for your pet project, the kernel syscall convention on kfreebsd-amd64 is the same as syscall convention on (linux-)amd64: syscall number rax arg 1 rdi arg 2 rsi arg 3 rdx arg 4 r10 arg 5 r8 arg 6 r9 Petr