From 23fdd7f0f75bca03a092faeeef60d8b0b804bf8d Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 25 Oct 2021 07:48:12 +0200 Subject: syscall: add utimensat libc wrapper on darwin Add utimensat as a wrapper around the libc function of the same name. utimensat was added in macOS 10.13 which is the minimum supported release since Go 1.17 dropped support for macOS 10.12. This also allows to drop the fallback to setattrlistTimes which was used to set timestamps with nanosecond resolution before utimensat could be used, see #22528 and CL 74952. Updates #22528 Change-Id: I87b6a76acf1d642ceede9254f7d9d06dddc3fd71 Reviewed-on: https://go-review.googlesource.com/c/go/+/358274 Trust: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- src/syscall/syscall_bsd.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/syscall/syscall_bsd.go') diff --git a/src/syscall/syscall_bsd.go b/src/syscall/syscall_bsd.go index 595e705856..40b1c07a90 100644 --- a/src/syscall/syscall_bsd.go +++ b/src/syscall/syscall_bsd.go @@ -524,12 +524,7 @@ func UtimesNano(path string, ts []Timespec) error { if len(ts) != 2 { return EINVAL } - // Darwin setattrlist can set nanosecond timestamps - err := setattrlistTimes(path, ts) - if err != ENOSYS { - return err - } - err = utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) + err := utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) if err != ENOSYS { return err } -- cgit v1.3-5-g9baa