Finished my day job, so I can come back to fixing my personal projects. And this time, I have a "funny" story! :3
Just fixed a segfault in my Rust sysinfo
crate on FreeBSD. So, apparently, in some FreeBSD types, a pointer isn't actually a pointer but a kernel pointer. So to get access to the data, you need to use kvm_read
function... And it might return types that also have kernel pointers and so on.
Lost a few hours trying to understand why my non-null pointers were out of my memory to discover by reading FreeBSD source code what was going on (because if there is documentation about this, didn't find it).
Anyway, I think this whole API is awful. FreeBSD making breaking changes in structs layout between each version is also a nightmare. Of all platforms I wrote Rust bindings for, this is the worst by far.
PR is here: https://github.com/GuillaumeGomez/sysinfo/pull/1499
@imperio How do you test on FreeBSD?
@hywan virtual machine