utimes_freebsd.go 581 B

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