mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
7e420ad850
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
28 lines
807 B
Go
28 lines
807 B
Go
package system
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
// LUtimesNano is used to change access and modification time of the specified path.
|
|
// It's used for symbol link file because syscall.UtimesNano doesn't support a NOFOLLOW flag atm.
|
|
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
|
|
}
|
|
|
|
// UtimesNano is used to change access and modification time of the specified path.
|
|
// It can't be used for symbol link file.
|
|
func UtimesNano(path string, ts []syscall.Timespec) error {
|
|
return syscall.UtimesNano(path, ts)
|
|
}
|