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