2018-02-05 16:05:59 -05:00
|
|
|
package system // import "github.com/docker/docker/pkg/system"
|
2014-03-20 11:52:00 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
|
|
|
"unsafe"
|
2017-05-23 10:22:32 -04:00
|
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
2014-03-20 11:52:00 -04:00
|
|
|
)
|
|
|
|
|
2015-07-28 12:13:12 -04:00
|
|
|
// LUtimesNano is used to change access and modification time of the specified path.
|
2017-05-23 10:22:32 -04:00
|
|
|
// It's used for symbol link file because unix.UtimesNano doesn't support a NOFOLLOW flag atm.
|
2014-03-20 11:52:00 -04:00
|
|
|
func LUtimesNano(path string, ts []syscall.Timespec) error {
|
|
|
|
var _path *byte
|
2017-05-23 10:22:32 -04:00
|
|
|
_path, err := unix.BytePtrFromString(path)
|
2014-03-20 11:52:00 -04:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-05-23 10:22:32 -04:00
|
|
|
if _, _, err := unix.Syscall(unix.SYS_LUTIMES, uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), 0); err != 0 && err != unix.ENOSYS {
|
2014-03-20 11:52:00 -04:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|