Commit 6ba918b2 authored by Max Kellermann's avatar Max Kellermann

input/file: don't use posix_fadvise() on Android

Requires Android API 21, but we want to support older versions as well.
parent e8b70dbc
...@@ -65,10 +65,13 @@ OpenFileInputStream(Path path, ...@@ -65,10 +65,13 @@ 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(),
std::move(reader), info.GetSize(), std::move(reader), info.GetSize(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment