Kqueue works (sort-of), it needs a few minor fixes

- nulled pointers from reallocarray.
- Small other fixes.