Add ability to daemonize program, update sample config, README.md, add .gitignore
This commit is contained in:
24
vendor/github.com/sevlyar/go-daemon/lock_file_unix.go
generated
vendored
Normal file
24
vendor/github.com/sevlyar/go-daemon/lock_file_unix.go
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || plan9
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd plan9
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user