make futexWaitUntil tolerant of invalid time_point-s
authorNathan Bronson <ngbronson@fb.com>
Wed, 24 Dec 2014 04:46:39 +0000 (20:46 -0800)
committerDave Watson <davejwatson@fb.com>
Mon, 29 Dec 2014 18:40:26 +0000 (10:40 -0800)
commit69433ef3053ca1635c99dc1da712af8784200063
treee88d3976b7e0400903acc9182314c219d47b576b
parentef2fa20f75bca8b00d4fd8a12e75ce14a0a30040
make futexWaitUntil tolerant of invalid time_point-s

Summary:
futexWaitUntil could generate an invalid timespec when presented
with a time_point from before the epoch, which resulted in an EINVAL from
the futex syscall.  Debug builds crashed on this unexpected return value,
while release builds soldiered on.  This path happened to be exercised
by the unit test.  This diff fixes the unintentional deadline overflow
in the test, adds explicit testing of overflow behavior, and makes
futexWaitUntil handle invalid time_points in a sensible manner.

Test Plan:
1. new unit tests
2. fbmake runtests_dbg

Reviewed By: mssarang@fb.com

Subscribers: strager, njormrod, folly-diffs@

FB internal diff: D1747972

Tasks: 5853949

Signature: t1:1747972:1419382193:862c193a13428d96acb33c85f962f59203661f40
folly/detail/Futex.cpp
folly/test/FutexTest.cpp