1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:26:15 -07:00

syscall: make Utimes on Solaris match all the other geese

Updates #14892

Change-Id: I640c6e1635ccdf611f219521a7d297a9885c4cb3
Reviewed-on: https://go-review.googlesource.com/31446
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Brad Fitzpatrick 2016-10-19 12:39:37 +00:00
parent 4859f6a416
commit 1e3dc3d5d4
2 changed files with 10 additions and 3 deletions

View File

@ -279,7 +279,7 @@ func UtimesNano(path string, ts []Timespec) (err error) {
tv[i].Sec = ts[i].Sec tv[i].Sec = ts[i].Sec
tv[i].Usec = ts[i].Nsec / 1000 tv[i].Usec = ts[i].Nsec / 1000
} }
return Utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
} }
//sys fcntl(fd int, cmd int, arg int) (val int, err error) //sys fcntl(fd int, cmd int, arg int) (val int, err error)
@ -494,7 +494,7 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
//sys Ftruncate(fd int, length int64) (err error) //sys Ftruncate(fd int, length int64) (err error)
//sys Umask(newmask int) (oldmask int) //sys Umask(newmask int) (oldmask int)
//sys Unlink(path string) (err error) //sys Unlink(path string) (err error)
//sys Utimes(path string, times *[2]Timeval) (err error) //sys utimes(path string, times *[2]Timeval) (err error)
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_bind //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_bind
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_connect //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_connect
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
@ -527,3 +527,10 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
} }
return return
} }
func Utimes(path string, tv []Timeval) error {
if len(tv) != 2 {
return EINVAL
}
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
}

View File

@ -953,7 +953,7 @@ func Unlink(path string) (err error) {
return return
} }
func Utimes(path string, times *[2]Timeval) (err error) { func utimes(path string, times *[2]Timeval) (err error) {
var _p0 *byte var _p0 *byte
_p0, err = BytePtrFromString(path) _p0, err = BytePtrFromString(path)
if err != nil { if err != nil {