2014-03-20 15:52:00 +00:00
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
2015-07-28 16:13:12 +00:00
|
|
|
// 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.
|
2014-03-20 15:52:00 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2015-07-28 16:13:12 +00:00
|
|
|
// UtimesNano is used to change access and modification time of the specified path.
|
|
|
|
// It can't be used for symbol link file.
|
2014-03-20 15:52:00 +00:00
|
|
|
func UtimesNano(path string, ts []syscall.Timespec) error {
|
|
|
|
return syscall.UtimesNano(path, ts)
|
|
|
|
}
|