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/include/dirent.h b/libc/include/dirent.h
index 129cdfa..bfe4ea4 100644
--- a/libc/include/dirent.h
+++ b/libc/include/dirent.h
@@ -46,27 +46,33 @@
 #define DT_WHT 14
 #endif
 
-struct dirent {
-  uint64_t         d_ino;
-  int64_t          d_off;
-  unsigned short   d_reclen;
-  unsigned char    d_type;
-  char             d_name[256];
-};
+#define __DIRENT64_BODY \
+    uint64_t         d_ino; \
+    int64_t          d_off; \
+    unsigned short   d_reclen; \
+    unsigned char    d_type; \
+    char             d_name[256]; \
+
+struct dirent { __DIRENT64_BODY };
+struct dirent64 { __DIRENT64_BODY };
+
 #define d_fileno d_ino
-#define dirent64 dirent
 
 typedef struct DIR DIR;
 
 extern DIR* opendir(const char*);
 extern DIR* fdopendir(int);
 extern struct dirent* readdir(DIR*);
+extern struct dirent64* readdir64(DIR*);
 extern int readdir_r(DIR*, struct dirent*, struct dirent**);
+extern int readdir64_r(DIR*, struct dirent64*, struct dirent64**);
 extern int closedir(DIR*);
 extern void rewinddir(DIR*);
 extern int dirfd(DIR*);
 extern int alphasort(const struct dirent**, const struct dirent**);
+extern int alphasort64(const struct dirent64**, const struct dirent64**);
 extern int scandir(const char*, struct dirent***, int (*)(const struct dirent*), int (*)(const struct dirent**, const struct dirent**));
+extern int scandir64(const char*, struct dirent64***, int (*)(const struct dirent64*), int (*)(const struct dirent64**, const struct dirent64**));
 extern int getdents(unsigned int, struct dirent*, unsigned int);
 
 __END_DECLS