FreeBSD kqueue file monitor fixes: the complex parts
Moved from !57 (merged).
This merge request fixes testfilemonitor test, which requires a lot of changes in kqueue file monitor backend. The test itself is also heavily modified to allow event loss, which is sometimes unavoidable with kqueue API. Please see commit messages for detailed changes description.