From b3129d9d1021adc2ccdcef30c56ce00e4f4b1132 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Wed, 20 Oct 2021 07:16:16 +0900 Subject: [PATCH] unix: fix difference Stat_t type and Statfs_t type per GOARCH on darwin In darwin/arm64, has the libc_fstat{fs} trampoline, not libc_fstat{fs}64. But types_darwin.go defined same C types. Change-Id: Ia33c60029eb59360e421f42ef79efe890eba3e3e Reviewed-on: https://go-review.googlesource.com/c/sys/+/357071 Reviewed-by: Ian Lance Taylor Trust: Tobias Klauser --- unix/types_darwin.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/unix/types_darwin.go b/unix/types_darwin.go index 3f3db3b9..f6162cc7 100644 --- a/unix/types_darwin.go +++ b/unix/types_darwin.go @@ -74,6 +74,13 @@ struct sockaddr_any { char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; }; +#if defined(__x86_64__) +typedef struct stat64 stat_t; +typedef struct statfs64 statfs_t; +#else // __arm__ +typedef struct stat stat_t; +typedef struct statfs statfs_t; +#endif */ import "C" @@ -114,9 +121,9 @@ type _Gid_t C.gid_t // Files -type Stat_t C.struct_stat64 +type Stat_t C.stat_t -type Statfs_t C.struct_statfs64 +type Statfs_t C.statfs_t type Flock_t C.struct_flock