From ef977fce66369e11769eaba0839dca19d4ddb484 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Fri, 26 Mar 2021 17:45:12 +0000 Subject: [PATCH] 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 Signed-off-by: Jessica Clarke Closes #11771 --- lib/libspl/include/os/freebsd/sys/stat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/libspl/include/os/freebsd/sys/stat.h b/lib/libspl/include/os/freebsd/sys/stat.h index 07f9762f09..38c684d62a 100644 --- a/lib/libspl/include/os/freebsd/sys/stat.h +++ b/lib/libspl/include/os/freebsd/sys/stat.h @@ -29,6 +29,7 @@ #include_next /* Note: this file can be used on linux/macOS when bootstrapping tools. */ + #if defined(__FreeBSD__) #include /* for BLKGETSIZE64 */ @@ -71,4 +72,14 @@ fstat64_blk(int fd, struct stat64 *st) return (0); } #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 */