Support running FreeBSD buildworld on Arm-based macOS hosts

Arm-based Macs are like FreeBSD and provide a full 64-bit stat from the
start, so have no stat64 variants. Thus, define stat64 and fstat64 as
aliases for the normal versions.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Closes #11771
This commit is contained in:
Jessica Clarke 2021-03-26 17:45:12 +00:00 committed by GitHub
parent 8a915ba1f6
commit ef977fce66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include_next <sys/stat.h> #include_next <sys/stat.h>
/* Note: this file can be used on linux/macOS when bootstrapping tools. */ /* Note: this file can be used on linux/macOS when bootstrapping tools. */
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#include <sys/mount.h> /* for BLKGETSIZE64 */ #include <sys/mount.h> /* for BLKGETSIZE64 */
@ -71,4 +72,14 @@ fstat64_blk(int fd, struct stat64 *st)
return (0); return (0);
} }
#endif /* defined(__FreeBSD__) */ #endif /* defined(__FreeBSD__) */
/*
* Only Intel-based Macs have a separate stat64; Arm-based Macs are like
* FreeBSD and have a full 64-bit stat from the start.
*/
#if defined(__APPLE__) && !(defined(__i386__) || defined(__x86_64__))
#define stat64 stat
#define fstat64 fstat
#endif
#endif /* _LIBSPL_SYS_STAT_H */ #endif /* _LIBSPL_SYS_STAT_H */