diff --git a/osfs/os_posix.go b/osfs/os_posix.go index 144cde1..021ca7d 100644 --- a/osfs/os_posix.go +++ b/osfs/os_posix.go @@ -1,4 +1,4 @@ -// +build !windows +// +build !windows,!solaris package osfs diff --git a/osfs/os_solaris.go b/osfs/os_solaris.go new file mode 100644 index 0000000..8e2c21e --- /dev/null +++ b/osfs/os_solaris.go @@ -0,0 +1,19 @@ +// +build solaris + +package osfs + +import "syscall" + +func (f *file) Lock() error { + f.m.Lock() + defer f.m.Unlock() + + return syscall.Flock(int(f.File.Fd()), syscall.LOCK_EX) +} + +func (f *file) Unlock() error { + f.m.Lock() + defer f.m.Unlock() + + return syscall.Flock(int(f.File.Fd()), syscall.LOCK_UN) +}