Implement some of the missing LFS64 support.

This gives us:

* <dirent.h>
  struct dirent64
  readdir64, readdir64_r, alphasort64, scandir64

* <fcntl.h>
  creat64, openat64, open64.

* <sys/stat.h>
  struct stat64
  fstat64, fstatat64, lstat64, stat64.

* <sys/statvfs.h>
  struct statvfs64
  statvfs64, fstatvfs64.

* <sys/vfs.h>
  struct statfs64
  statfs64, fstatfs64.

This also removes some of the incorrect #define hacks we've had in the
past (for stat64, for example, which we promised to clean up way back
in bug 8472078).

Bug: 11865851
Bug: 8472078
Change-Id: Ia46443521918519f2dfa64d4621027dfd13ac566
diff --git a/libc/bionic/dirent.cpp b/libc/bionic/dirent.cpp
index 0565698..0f9b26a 100644
--- a/libc/bionic/dirent.cpp
+++ b/libc/bionic/dirent.cpp
@@ -105,6 +105,7 @@
   ScopedPthreadMutexLocker locker(&d->mutex_);
   return __readdir_locked(d);
 }
+__strong_alias(readdir64, readdir);
 
 int readdir_r(DIR* d, dirent* entry, dirent** result) {
   ErrnoRestorer errno_restorer;
@@ -125,6 +126,7 @@
   }
   return 0;
 }
+__strong_alias(readdir64_r, readdir_r);
 
 int closedir(DIR* d) {
   if (d == NULL) {
@@ -147,3 +149,4 @@
 int alphasort(const dirent** a, const dirent** b) {
   return strcoll((*a)->d_name, (*b)->d_name);
 }
+__strong_alias(alphasort64, alphasort);
diff --git a/libc/bionic/legacy_32_bit_support.cpp b/libc/bionic/legacy_32_bit_support.cpp
index 411daa0..73f77be 100644
--- a/libc/bionic/legacy_32_bit_support.cpp
+++ b/libc/bionic/legacy_32_bit_support.cpp
@@ -59,11 +59,13 @@
 int fstatfs(int fd, struct statfs* stat) {
   return __fstatfs64(fd, sizeof(*stat), stat);
 }
+__strong_alias(fstatfs64, fstatfs);
 
 // For statfs we need to add the extra argument giving the kernel the size of the buffer.
 int statfs(const char* path, struct statfs* stat) {
   return __statfs64(path, sizeof(*stat), stat);
 }
+__strong_alias(statfs64, statfs);
 
 // For lseek64 we need to use the llseek system call which splits the off64_t in two and
 // returns the off64_t result via a pointer because 32-bit kernels can't return 64-bit results.
diff --git a/libc/bionic/lstat.cpp b/libc/bionic/lstat.cpp
index 300d7fa..84d17e2 100644
--- a/libc/bionic/lstat.cpp
+++ b/libc/bionic/lstat.cpp
@@ -34,3 +34,4 @@
 int lstat(const char* path, struct stat* sb) {
   return fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW);
 }
+__strong_alias(lstat64, lstat);
diff --git a/libc/bionic/open.cpp b/libc/bionic/open.cpp
index 986ed1c..bd832c0 100644
--- a/libc/bionic/open.cpp
+++ b/libc/bionic/open.cpp
@@ -43,6 +43,11 @@
 #endif
 }
 
+int creat(const char* pathname, mode_t mode) {
+  return open(pathname, O_CREAT | O_TRUNC | O_WRONLY, mode);
+}
+__strong_alias(creat64, creat);
+
 int open(const char* pathname, int flags, ...) {
   mode_t mode = 0;
 
@@ -55,6 +60,7 @@
 
   return __openat(AT_FDCWD, pathname, force_O_LARGEFILE(flags), mode);
 }
+__strong_alias(open64, open);
 
 int __open_2(const char* pathname, int flags) {
   if (__predict_false((flags & O_CREAT) != 0)) {
@@ -76,6 +82,7 @@
 
   return __openat(fd, pathname, force_O_LARGEFILE(flags), mode);
 }
+__strong_alias(openat64, openat);
 
 int __openat_2(int fd, const char* pathname, int flags) {
   if ((flags & O_CREAT) != 0) {
diff --git a/libc/bionic/scandir.cpp b/libc/bionic/scandir.cpp
index dd22b22..25d5200 100644
--- a/libc/bionic/scandir.cpp
+++ b/libc/bionic/scandir.cpp
@@ -113,3 +113,4 @@
   *name_list = names.release();
   return size;
 }
+__strong_alias(scandir64, scandir);
diff --git a/libc/bionic/stat.cpp b/libc/bionic/stat.cpp
index 62387c5..e71d9d4 100644
--- a/libc/bionic/stat.cpp
+++ b/libc/bionic/stat.cpp
@@ -34,3 +34,4 @@
 int stat(const char* path, struct stat* sb) {
   return fstatat(AT_FDCWD, path, sb, 0);
 }
+__strong_alias(stat64, stat);
diff --git a/libc/bionic/statvfs.cpp b/libc/bionic/statvfs.cpp
index 39c9332..f1e2833 100644
--- a/libc/bionic/statvfs.cpp
+++ b/libc/bionic/statvfs.cpp
@@ -53,6 +53,7 @@
   __statfs_to_statvfs(tmp, result);
   return 0;
 }
+__strong_alias(statvfs64, statvfs);
 
 int fstatvfs(int fd, struct statvfs* result) {
   struct statfs tmp;
@@ -63,3 +64,4 @@
   __statfs_to_statvfs(tmp, result);
   return 0;
 }
+__strong_alias(fstatvfs64, fstatvfs);