darwin: Refactor some getpidfdinfo logic for later

What a pain.  There's no way to get the fdtype for a specific pid/fd combo
without completely re-traversing all the fds for a given pid.

In any case, let's refactor this so we can call it from inside stat_pid_fd
Support remote stat of pipes and sockets

Fixes #5
unittest: Fix leak on unhandled exception in kqueue test