mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 15:17:31 -04:00
unix: use setattrlist for UtimesNanoAt on Darwin
Use to setarrlist to implement UtimesNanoAt with nanosecond precision (on Mac OS 10.13 with APFS). Translate AT_SYMLINK_NOFOLLOW to FSOPT_NOFOLLOW correspondingly. Change-Id: I1468a1f4eecb53b2280ff6329b1ec64e204701f1 Reviewed-on: https://go-review.googlesource.com/75650 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
feaf45c67f
commit
46eaec7899
+5
-1
@@ -571,7 +571,7 @@ func UtimesNano(path string, ts []Timespec) error {
|
||||
return EINVAL
|
||||
}
|
||||
// Darwin setattrlist can set nanosecond timestamps
|
||||
err := setattrlistTimes(path, ts)
|
||||
err := setattrlistTimes(path, ts, 0)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
@@ -595,6 +595,10 @@ func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||
if len(ts) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
err := setattrlistTimes(path, ts, flags)
|
||||
if err != ENOSYS {
|
||||
return err
|
||||
}
|
||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user