You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

os_posix.go 388B

123456789101112131415161718192021222324252627
  1. // +build !plan9,!windows
  2. package osfs
  3. import (
  4. "os"
  5. "golang.org/x/sys/unix"
  6. )
  7. func (f *file) Lock() error {
  8. f.m.Lock()
  9. defer f.m.Unlock()
  10. return unix.Flock(int(f.File.Fd()), unix.LOCK_EX)
  11. }
  12. func (f *file) Unlock() error {
  13. f.m.Lock()
  14. defer f.m.Unlock()
  15. return unix.Flock(int(f.File.Fd()), unix.LOCK_UN)
  16. }
  17. func rename(from, to string) error {
  18. return os.Rename(from, to)
  19. }