Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: base/file_util_linux.cc

Issue 9774: * Revert "Por rt flush_cache tool." (Closed)
Patch Set: Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/file_util.h ('k') | base/file_util_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 if (close(infile) < 0) 67 if (close(infile) < 0)
68 result = false; 68 result = false;
69 if (close(outfile) < 0) 69 if (close(outfile) < 0)
70 result = false; 70 result = false;
71 71
72 return result; 72 return result;
73 } 73 }
74 74
75 bool EvictFileFromSystemCache(const FilePath path) {
76 int fd = open(path.value().c_str(), O_RDONLY);
77 if (fd < 0)
78 return false;
79 if (fdatasync(fd) != 0)
80 return false;
81 if (posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED) != 0)
82 return false;
83 close(fd);
84 return true;
85 }
86
87 } // namespace file_util 75 } // namespace file_util
OLDNEW
« no previous file with comments | « base/file_util.h ('k') | base/file_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698