]>
Commit | Line | Data |
---|---|---|
9b12e4fe JC |
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 | // These are not currently available in syscall | |
12 | atFdCwd := -100 | |
13 | atSymLinkNoFollow := 0x100 | |
14 | ||
15 | var _path *byte | |
16 | _path, err := syscall.BytePtrFromString(path) | |
17 | if err != nil { | |
18 | return err | |
19 | } | |
20 | ||
21 | if _, _, err := syscall.Syscall6(syscall.SYS_UTIMENSAT, uintptr(atFdCwd), uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), uintptr(atSymLinkNoFollow), 0, 0); err != 0 && err != syscall.ENOSYS { | |
22 | return err | |
23 | } | |
24 | ||
25 | return nil | |
26 | } |