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:
Max Kellermann 2018-02-09 22:37:12 +01:00
parent e8b70dbca4
commit 6ba918b203

View File

@ -65,9 +65,12 @@ OpenFileInputStream(Path path,
throw FormatRuntimeError("Not a regular file: %s",
path.c_str());
#if !defined(__BIONIC__) || __ANDROID_API__ >= 21
/* posix_fadvise() requires Android API 21 */
#ifdef POSIX_FADV_SEQUENTIAL
posix_fadvise(reader.GetFD().Get(), (off_t)0, info.GetSize(),
POSIX_FADV_SEQUENTIAL);
#endif
#endif
return InputStreamPtr(new FileInputStream(path.ToUTF8().c_str(),