[Sanitizer] Add sanitizer_win.cc for windows-specific implementations of libc functions. Add internal_open.

llvm-svn: 157985
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
index f105ff0..aa0558c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
@@ -16,7 +16,9 @@
 #include "sanitizer_defs.h"
 #include "sanitizer_libc.h"
 
+#include <fcntl.h>
 #include <sys/mman.h>
+#include <sys/stat.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -32,6 +34,11 @@
 #endif
 }
 
+fd_t internal_open(const char *filename, bool write) {
+  return syscall(__NR_open, filename,
+      write ? O_WRONLY | O_CREAT | O_CLOEXEC : O_RDONLY, 0660);
+}
+
 }  // namespace __sanitizer
 
 #endif  // __linux__