github.com/jingleWang/moby@v1.13.1/pkg/system/utimes_freebsd.go (about)

     1  package system
     2  
     3  import (
     4  	"syscall"
     5  	"unsafe"
     6  )
     7  
     8  // LUtimesNano is used to change access and modification time of the specified path.
     9  // It's used for symbol link file because syscall.UtimesNano doesn't support a NOFOLLOW flag atm.
    10  func LUtimesNano(path string, ts []syscall.Timespec) error {
    11  	var _path *byte
    12  	_path, err := syscall.BytePtrFromString(path)
    13  	if err != nil {
    14  		return err
    15  	}
    16  
    17  	if _, _, err := syscall.Syscall(syscall.SYS_LUTIMES, uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), 0); err != 0 && err != syscall.ENOSYS {
    18  		return err
    19  	}
    20  
    21  	return nil
    22  }