Add flock(2)ing on dex-cache files to prevent races
Bug: 9071417
Change-Id: I1ee9ff281867f90fba7a8ed8bbf06b33ac29d511
diff --git a/runtime/os.h b/runtime/os.h
index 6767566..6248d5f 100644
--- a/runtime/os.h
+++ b/runtime/os.h
@@ -29,8 +29,17 @@
class OS {
public:
- // Open a file. The returned pointer must be deleted by the caller.
- static File* OpenFile(const char* name, bool writable, bool create = true);
+ // Open an existing file with read only access.
+ static File* OpenFileForReading(const char* name);
+
+ // Open an existing file with read/write access.
+ static File* OpenFileReadWrite(const char* name);
+
+ // Create an empty file with read/write access.
+ static File* CreateEmptyFile(const char* name);
+
+ // Open a file with the specified open(2) flags.
+ static File* OpenFileWithFlags(const char* name, int flags);
// Check if a file exists.
static bool FileExists(const char* name);