| 1 | //go:build wasip1 |
| 2 | |
| 3 | package osfs |
| 4 | |
| 5 | import ( |
| 6 | "os" |
| 7 | "syscall" |
| 8 | ) |
| 9 | |
| 10 | func (f *file) Lock() error { |
| 11 | f.m.Lock() |
| 12 | defer f.m.Unlock() |
| 13 | return nil |
| 14 | } |
| 15 | |
| 16 | func (f *file) Unlock() error { |
| 17 | f.m.Lock() |
| 18 | defer f.m.Unlock() |
| 19 | return nil |
| 20 | } |
| 21 | |
| 22 | func rename(from, to string) error { |
| 23 | return os.Rename(from, to) |
| 24 | } |
| 25 | |
| 26 | // umask sets umask to a new value, and returns a func which allows the |
| 27 | // caller to reset it back to what it was originally. |
| 28 | func umask(new int) func() { |
| 29 | old := syscall.Umask(new) |
| 30 | return func() { |
| 31 | syscall.Umask(old) |
| 32 | } |
| 33 | } |