aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/syscall_linux.go
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2021-09-01 15:24:01 +0200
committerTobias Klauser <tobias.klauser@gmail.com>2021-09-02 09:24:59 +0000
commit17e9d148d3354f8da745e6533213ca5b348b719e (patch)
tree68e0ea8f1346f802d550e2a42644c69e1978c2ea /src/syscall/syscall_linux.go
parentd13d62c49adca86f2101bc0b7d5a394197ece81b (diff)
downloadgo-17e9d148d3354f8da745e6533213ca5b348b719e.tar.xz
syscall: drop fallback to utimes in UtimesNano on Linux
The minimum required Linux kernel version for Go 1.18 will be changed to 2.6.32, see #45964. The current minimum required version is 2.6.23 and utimensat was added in 2.6.22, so the fallback isn't even necessary for the current minimum supported version. Remove the fallback to utimes. For #45964 Change-Id: I5536f6ea7a34944dd9165f1533c10692171fb0c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/346790 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/syscall/syscall_linux.go')
-rw-r--r--src/syscall/syscall_linux.go13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go
index dfce3d0a4b..a2dba54b97 100644
--- a/src/syscall/syscall_linux.go
+++ b/src/syscall/syscall_linux.go
@@ -204,18 +204,7 @@ func UtimesNano(path string, ts []Timespec) (err error) {
if len(ts) != 2 {
return EINVAL
}
- err = utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
- if err != ENOSYS {
- return err
- }
- // If the utimensat syscall isn't available (utimensat was added to Linux
- // in 2.6.22, Released, 8 July 2007) then fall back to utimes
- var tv [2]Timeval
- for i := 0; i < 2; i++ {
- tv[i].Sec = ts[i].Sec
- tv[i].Usec = ts[i].Nsec / 1000
- }
- return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
+ return utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
}
func Futimesat(dirfd int, path string, tv []Timeval) (err error) {