Stop using transitional LFS64 APIs

gn is already built with _FILE_OFFSET_BITS=64, so the unsuffixed
versions of these APIs are always the 64-bit versions on platforms
that provide the suffixed APIs anyway.

This fixes building for recent versions of musl, which have removed
the transitional suffixed APIs.

Change-Id: Ic4febbdebabedaa576a3931efcd80b80e26d2171
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/17720
Reviewed-by: David Turner <digit@google.com>
Reviewed-by: Takuto Ikuta <tikuta@google.com>
Commit-Queue: David Turner <digit@google.com>
diff --git a/src/base/files/file.h b/src/base/files/file.h
index 82c4f9e..4ee079c 100644
--- a/src/base/files/file.h
+++ b/src/base/files/file.h
@@ -21,14 +21,6 @@
 
 namespace base {
 
-#if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \
-    defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) ||  \
-    defined(OS_ANDROID) && __ANDROID_API__ < 21 || defined(OS_SERENITY)
-typedef struct stat stat_wrapper_t;
-#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
-typedef struct stat64 stat_wrapper_t;
-#endif
-
 // Thin wrapper around an OS-level file.
 // Note that this class does not provide any support for asynchronous IO.
 //
@@ -94,7 +86,7 @@
     ~Info();
 #if defined(OS_POSIX) || defined(OS_FUCHSIA)
     // Fills this struct with values from |stat_info|.
-    void FromStat(const stat_wrapper_t& stat_info);
+    void FromStat(const struct stat& stat_info);
 #endif
 
     // The size of the file in bytes.  Undefined when is_directory is true.
diff --git a/src/base/files/file_posix.cc b/src/base/files/file_posix.cc
index ade826b..249aafe 100644
--- a/src/base/files/file_posix.cc
+++ b/src/base/files/file_posix.cc
@@ -24,18 +24,6 @@
 
 namespace {
 
-#if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \
-    defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) ||  \
-    defined(OS_ANDROID) && __ANDROID_API__ < 21 || defined(OS_SERENITY)
-int CallFstat(int fd, stat_wrapper_t* sb) {
-  return fstat(fd, sb);
-}
-#else
-int CallFstat(int fd, stat_wrapper_t* sb) {
-  return fstat64(fd, sb);
-}
-#endif
-
 // Some systems don't provide the following system calls, so either simulate
 // them or wrap them in order to minimize the number of #ifdef's in this file.
 #if !defined(OS_AIX)
@@ -82,7 +70,7 @@
 
 }  // namespace
 
-void File::Info::FromStat(const stat_wrapper_t& stat_info) {
+void File::Info::FromStat(const struct stat& stat_info) {
   is_directory = S_ISDIR(stat_info.st_mode);
   is_symbolic_link = S_ISLNK(stat_info.st_mode);
   size = stat_info.st_size;
@@ -247,8 +235,8 @@
 int64_t File::GetLength() {
   DCHECK(IsValid());
 
-  stat_wrapper_t file_info;
-  if (CallFstat(file_.get(), &file_info))
+  struct stat file_info;
+  if (fstat(file_.get(), &file_info))
     return -1;
 
   return file_info.st_size;
@@ -263,8 +251,8 @@
 bool File::GetInfo(Info* info) {
   DCHECK(IsValid());
 
-  stat_wrapper_t file_info;
-  if (CallFstat(file_.get(), &file_info))
+  struct stat file_info;
+  if (fstat(file_.get(), &file_info))
     return false;
 
   info->FromStat(file_info);
diff --git a/src/base/files/file_util_posix.cc b/src/base/files/file_util_posix.cc
index 08de845..33b2be3 100644
--- a/src/base/files/file_util_posix.cc
+++ b/src/base/files/file_util_posix.cc
@@ -59,30 +59,12 @@
 
 namespace {
 
-#if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \
-    defined(OS_HAIKU) || defined(OS_MSYS) || defined(OS_ZOS) ||  \
-    defined(OS_ANDROID) && __ANDROID_API__ < 21 || defined(OS_SERENITY)
-int CallStat(const char* path, stat_wrapper_t* sb) {
-  return stat(path, sb);
-}
-int CallLstat(const char* path, stat_wrapper_t* sb) {
-  return lstat(path, sb);
-}
-#else
-int CallStat(const char* path, stat_wrapper_t* sb) {
-  return stat64(path, sb);
-}
-int CallLstat(const char* path, stat_wrapper_t* sb) {
-  return lstat64(path, sb);
-}
-#endif
-
 // Helper for VerifyPathControlledByUser.
 bool VerifySpecificPathControlledByUser(const FilePath& path,
                                         uid_t owner_uid,
                                         const std::set<gid_t>& group_gids) {
-  stat_wrapper_t stat_info;
-  if (CallLstat(path.value().c_str(), &stat_info) != 0) {
+  struct stat stat_info;
+  if (lstat(path.value().c_str(), &stat_info) != 0) {
     DPLOG(ERROR) << "Failed to get information on path " << path.value();
     return false;
   }
@@ -172,8 +154,8 @@
 // here.
 bool DeleteFile(const FilePath& path, bool recursive) {
   const char* path_str = path.value().c_str();
-  stat_wrapper_t file_info;
-  if (CallLstat(path_str, &file_info) != 0) {
+  struct stat file_info;
+  if (lstat(path_str, &file_info) != 0) {
     // The Windows version defines this condition as success.
     return (errno == ENOENT || errno == ENOTDIR);
   }
@@ -268,8 +250,8 @@
 }
 
 bool DirectoryExists(const FilePath& path) {
-  stat_wrapper_t file_info;
-  if (CallStat(path.value().c_str(), &file_info) != 0)
+  struct stat file_info;
+  if (stat(path.value().c_str(), &file_info) != 0)
     return false;
   return S_ISDIR(file_info.st_mode);
 }
@@ -311,10 +293,10 @@
 bool GetPosixFilePermissions(const FilePath& path, int* mode) {
   DCHECK(mode);
 
-  stat_wrapper_t file_info;
+  struct stat file_info;
   // Uses stat(), because on symbolic link, lstat() does not return valid
   // permission bits in st_mode
-  if (CallStat(path.value().c_str(), &file_info) != 0)
+  if (stat(path.value().c_str(), &file_info) != 0)
     return false;
 
   *mode = file_info.st_mode & FILE_PERMISSION_MASK;
@@ -325,8 +307,8 @@
   DCHECK_EQ(mode & ~FILE_PERMISSION_MASK, 0);
 
   // Calls stat() so that we can preserve the higher bits like S_ISGID.
-  stat_wrapper_t stat_buf;
-  if (CallStat(path.value().c_str(), &stat_buf) != 0)
+  struct stat stat_buf;
+  if (stat(path.value().c_str(), &stat_buf) != 0)
     return false;
 
   // Clears the existing permission bits, and adds the new ones.
@@ -492,17 +474,17 @@
 // TODO(rkc): Refactor GetFileInfo and FileEnumerator to handle symlinks
 // correctly. http://code.google.com/p/chromium-os/issues/detail?id=15948
 bool IsLink(const FilePath& file_path) {
-  stat_wrapper_t st;
+  struct stat st;
   // If we can't lstat the file, it's safe to assume that the file won't at
   // least be a 'followable' link.
-  if (CallLstat(file_path.value().c_str(), &st) != 0)
+  if (lstat(file_path.value().c_str(), &st) != 0)
     return false;
   return S_ISLNK(st.st_mode);
 }
 
 bool GetFileInfo(const FilePath& file_path, File::Info* results) {
-  stat_wrapper_t file_info;
-  if (CallStat(file_path.value().c_str(), &file_info) != 0)
+  struct stat file_info;
+  if (stat(file_path.value().c_str(), &file_info) != 0)
     return false;
 
   results->FromStat(file_info);