From 6ba918b20346056294c15bdf1abd207f1dca84b4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 9 Feb 2018 22:37:12 +0100 Subject: [PATCH] input/file: don't use posix_fadvise() on Android Requires Android API 21, but we want to support older versions as well. --- src/input/plugins/FileInputPlugin.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/input/plugins/FileInputPlugin.cxx b/src/input/plugins/FileInputPlugin.cxx index 2d2850c74..518de233a 100644 --- a/src/input/plugins/FileInputPlugin.cxx +++ b/src/input/plugins/FileInputPlugin.cxx @@ -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(),