[Sanitizer] extend internal libc with stat/fstat/lstat functions

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@174316 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cc
index a7bde03..1bd50ca 100644
--- a/lib/sanitizer_common/sanitizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_mac.cc
@@ -69,9 +69,21 @@
   return write(fd, buf, count);
 }
 
+int internal_stat(const char *path, void *buf) {
+  return stat(path, buf);
+}
+
+int internal_lstat(const char *path, void *buf) {
+  return lstat(path, buf);
+}
+
+int internal_fstat(fd_t fd, void *buf) {
+  return fstat(fd, buf);
+}
+
 uptr internal_filesize(fd_t fd) {
   struct stat st;
-  if (fstat(fd, &st))
+  if (internal_fstat(fd, &st))
     return -1;
   return (uptr)st.st_size;
 }