Add a filesystem locking primitive
Summary:
This is a simple wrapper around flock() that gives us sensible semantics.
These locks behave well and are released when the process exits, even if it kill -9'd, so we don't need to do any kind of lock recovery or timeouts. This is really nice since handling that stuff is awful.
Test Plan: Ran unit tests, which provide reasonably extensive coverage of behavior.
Reviewers: jungejason, nh, vrana
Reviewed By: nh
CC: aran
Maniphest Tasks: T1400
Differential Revision: https://secure.phabricator.com/D2853