Handle some nasty TOCTOU bugs

Summary:
There are some circumstances under which watchman can miss events. The prime suspect is TOCTOU bugs. This attempts to fix some of them.

- On Linux: We've found that our internal map sometimes preserves stale watch descriptors. To fix this, call `inotify_add_watch` unconditionally and see if the descriptor is stale. If it
is, schedule a recrawl.
- On Linux: add a state called `dir_pending_ignored`. This is set in the `wd_to_dir` map when we know that a directory doesn't exist, yet might not have processed all the inotify events leading up to it going away.
- On Linux: Call `opendir` after calling `inotify_add_watch`. This means we hopefully won't miss events that happen between the two.
- On BSD: Double check that we're dealing with the same directory across `opendir` and `open`.
- On Solaris: Use `fstat(2)` on the directory's file descriptor instead of `lstat(2)`.

Test Plan: `arc unit --everything`, `WATCHMAN_VALGRIND=1 arc unit --everything`, and the Mercurial test suite with `-j32` and checking the logs to see that nothing strange happened.

Reviewers: wez

Reviewed By: wez

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

--HG--
extra : rebase_source : 13dcff85c8302d875c370b4afb4c02e0f8d7c847
extra : amend_source : 3993c428d1c5b7714f385c8e1b9ef01c07f4844f