6b292bf034
Implement system.LUtimesNano and system.UtimesNano. The latter might be removed in future because it's basically same as os.Chtimes. That's why the test is mainly focusing LUtimesNano. Docker-DCO-1.1-Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com> (github: kzys)
24 lines
498 B
Go
24 lines
498 B
Go
package system
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
func LUtimesNano(path string, ts []syscall.Timespec) error {
|
|
var _path *byte
|
|
_path, err := syscall.BytePtrFromString(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if _, _, err := syscall.Syscall(syscall.SYS_LUTIMES, uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), 0); err != 0 && err != syscall.ENOSYS {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func UtimesNano(path string, ts []syscall.Timespec) error {
|
|
return syscall.UtimesNano(path, ts)
|
|
}
|