diff options
Diffstat (limited to 'base/file_util_linux.cc')
-rw-r--r-- | base/file_util_linux.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/base/file_util_linux.cc b/base/file_util_linux.cc index f776c91..d2a6870 100644 --- a/base/file_util_linux.cc +++ b/base/file_util_linux.cc @@ -72,4 +72,16 @@ bool CopyFile(const FilePath& from_path, const FilePath& to_path) { return result; } +bool EvictFileFromSystemCache(const FilePath path) { + int fd = open(path.value().c_str(), O_RDONLY); + if (fd < 0) + return false; + if (fdatasync(fd) != 0) + return false; + if (posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED) != 0) + return false; + close(fd); + return true; +} + } // namespace file_util |