First pass of ImageWriter

Change-Id: I4f189587a2e3cc1c265200b8fa64321b299947eb
diff --git a/src/os_linux.cc b/src/os_linux.cc
new file mode 100644
index 0000000..da8ea38
--- /dev/null
+++ b/src/os_linux.cc
@@ -0,0 +1,43 @@
+// Copyright 2010 Google Inc. All Rights Reserved.
+
+#include "os.h"
+
+#include <cstddef>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "file_linux.h"
+
+namespace art {
+
+File* OS::OpenBinaryFile(const char* name, bool writable) {
+  int flags = O_RDONLY;
+  if (writable) {
+    flags = (O_RDWR | O_CREAT | O_TRUNC);
+  }
+  int fd = open(name, flags, 0666);
+  if (fd < 0) {
+    return NULL;
+  }
+  return new LinuxFile(name, fd, true);
+}
+
+File* OS::OpenTextFile(const char* name, bool writable) {
+  return OpenBinaryFile(name, writable);
+}
+
+File* OS::FileFromFd(const char* name, int fd) {
+  return new LinuxFile(name, fd, false);
+}
+
+bool OS::FileExists(const char* name) {
+  struct stat st;
+  if (stat(name, &st) == 0) {
+    return S_ISREG(st.st_mode);  // TODO Deal with symlinks?
+  } else {
+    return false;
+  }
+}
+
+}  // namespace art