fix osx build + test

Summary:
OSX doesn't have fdopendir so do a poor-mans approximation.

Fixup use of $this in a lexical closure; this isn't broadly supported
in PHP, certainly not in the version deployed on my mac.

Fixup kqueue watching :-(

Test Plan: `arc unit --everything` on OSX

Reviewers: sid0, dsereni

Reviewed By: dsereni

Differential Revision: https://phabricator.fb.com/D912074

Blame Revision: rWAT5c21fc0b3b8854c71c5a7a5151f21fcff9eba5ed