1
0
mirror of https://github.com/Luzifer/duplicity-backup.git synced 2024-09-20 08:52:54 +00:00
duplicity-backup/vendor/github.com/nightlyone/lockfile/lockfile_unix.go
2016-05-22 15:04:37 +02:00

29 lines
431 B
Go

// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
package lockfile
import (
"os"
"syscall"
)
func isProcessAlive(p *os.Process) error {
err := p.Signal(os.Signal(syscall.Signal(0)))
if err == nil {
return nil
}
errno, ok := err.(syscall.Errno)
if !ok {
return ErrDeadOwner
}
switch errno {
case syscall.ESRCH:
return ErrDeadOwner
case syscall.EPERM:
return nil
default:
return err
}
}