github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/pkg/system/utimes_freebsd.go (about)

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