input/file: don't use posix_fadvise() on Android
Requires Android API 21, but we want to support older versions as well.
This commit is contained in:
parent
e8b70dbca4
commit
6ba918b203
@ -65,9 +65,12 @@ OpenFileInputStream(Path path,
|
|||||||
throw FormatRuntimeError("Not a regular file: %s",
|
throw FormatRuntimeError("Not a regular file: %s",
|
||||||
path.c_str());
|
path.c_str());
|
||||||
|
|
||||||
|
#if !defined(__BIONIC__) || __ANDROID_API__ >= 21
|
||||||
|
/* posix_fadvise() requires Android API 21 */
|
||||||
#ifdef POSIX_FADV_SEQUENTIAL
|
#ifdef POSIX_FADV_SEQUENTIAL
|
||||||
posix_fadvise(reader.GetFD().Get(), (off_t)0, info.GetSize(),
|
posix_fadvise(reader.GetFD().Get(), (off_t)0, info.GetSize(),
|
||||||
POSIX_FADV_SEQUENTIAL);
|
POSIX_FADV_SEQUENTIAL);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return InputStreamPtr(new FileInputStream(path.ToUTF8().c_str(),
|
return InputStreamPtr(new FileInputStream(path.ToUTF8().c_str(),
|
||||||
|
Loading…
Reference in New Issue
Block a user