mirror of
https://github.com/rclone/rclone.git
synced 2024-11-27 02:34:21 +08:00
6427029c4e
* Update all dependencies * Remove all `[[constraint]]` from Gopkg.toml * Add in the minimum number of `[[override]]` to build * Remove go get of github.com/inconshreveable/mousetrap as it is vendored * Update docs with new policy on constraints
24 lines
437 B
Go
24 lines
437 B
Go
// +build darwin dragonfly freebsd linux netbsd openbsd plan9 solaris
|
|
|
|
package daemon
|
|
|
|
import (
|
|
"syscall"
|
|
)
|
|
|
|
func lockFile(fd uintptr) error {
|
|
err := syscall.Flock(int(fd), syscall.LOCK_EX|syscall.LOCK_NB)
|
|
if err == syscall.EWOULDBLOCK {
|
|
err = ErrWouldBlock
|
|
}
|
|
return err
|
|
}
|
|
|
|
func unlockFile(fd uintptr) error {
|
|
err := syscall.Flock(int(fd), syscall.LOCK_UN)
|
|
if err == syscall.EWOULDBLOCK {
|
|
err = ErrWouldBlock
|
|
}
|
|
return err
|
|
}
|