Skip to content

Commit

Permalink
Add support for solaris - fix #69
Browse files Browse the repository at this point in the history
Signed-off-by: kuba-- <[email protected]>
  • Loading branch information
kuba-- committed Mar 7, 2019
1 parent 40f7491 commit a72e1d3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion osfs/os_posix.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !windows
// +build !windows,!solaris

package osfs

Expand Down
19 changes: 19 additions & 0 deletions osfs/os_solaris.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit a72e1d3

Please sign in to comment.