From e7864cd0c5adc707f036682ef3eeed05fcdd51f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Tue, 3 Mar 2026 21:41:01 +0100 Subject: [PATCH] Fix the fstatat declaration on macOS/x64. The x64 version of fstatat() needs to be mangled with the "INODE64" suffix in order to match the stat_t layout defined by Druntime. See https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/stat.h#L573 --- druntime/src/core/sys/posix/sys/stat.d | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/druntime/src/core/sys/posix/sys/stat.d b/druntime/src/core/sys/posix/sys/stat.d index 762d6fcc76ed..9c1d873c7d6e 100644 --- a/druntime/src/core/sys/posix/sys/stat.d +++ b/druntime/src/core/sys/posix/sys/stat.d @@ -2008,12 +2008,14 @@ else version (Darwin) version (AArch64) { int fstat(int, stat_t*); + int fstatat(int, const scope char*, stat_t*, int); int lstat(const scope char*, stat_t*); int stat(const scope char*, stat_t*); } else { pragma(mangle, "fstat$INODE64") int fstat(int, stat_t*); + pragma(mangle, "fstatat$INODE64") int fstatat(int, const scope char*, stat_t*, int); pragma(mangle, "lstat$INODE64") int lstat(const scope char*, stat_t*); pragma(mangle, "stat$INODE64") int stat(const scope char*, stat_t*); } @@ -2021,11 +2023,11 @@ else version (Darwin) else { int fstat(int, stat_t*); + int fstatat(int, const scope char*, stat_t*, int); int lstat(const scope char*, stat_t*); int stat(const scope char*, stat_t*); } int fchmodat(int, const scope char*, mode_t, int); - int fstatat(int, const scope char*, stat_t*, int); int futimens(int, ref const(timespec)[2]); int mkdirat(int, const scope char*, mode_t); int mkfifoat(int, const scope char*, mode_t);