Make detail/Futex.cpp bionic-safe
authorDelyan Kratunov <delyank@fb.com>
Fri, 29 May 2015 00:30:59 +0000 (17:30 -0700)
committerNoam Lerner <noamler@fb.com>
Wed, 3 Jun 2015 16:50:55 +0000 (09:50 -0700)
commit7a4c7813e2ea74b19fb2872b4f43a6ee304e1d49
tree00dcb105cbca8fddc0fd5d135272571bae2d418f
parentfff701bfc7db2f23becae9da222a63a7ad86177b
Make detail/Futex.cpp bionic-safe

Summary:
The headers that the Android NDK exports are all sorts of screwed up.
In particular, they expose a subset of the `futex.h`, so, even though the
kernel supports newer options, we can't reference them from the NDK headers.

This diff ensures Futex.cpp redefines all the things it uses, if the headers
are lacking.

It also transitions away from `SYS_` to `__NR_` which is apparently the newer
convention.

Lastly, the duration usage is made explicitly `time_t`-safe for use on 32-bit
platforms where `time_t` is `long int` but `std::chrono:seconds` is stored as
`long long int`.

Test Plan:
Existing tests, sample app compiled and ran cleanly on Android as well
(tests not verified on Android due to folly largely being unported to Android yet).

Reviewed By: ngbronson@fb.com

Subscribers: folly-diffs@, yfeldblum, chalfant

FB internal diff: D2069306

Signature: t1:2069306:1431721711:36c77b1afe8dd9259c1050f11a87511dcf7dd25f
folly/detail/Futex.cpp