Files
containerd/vendor/github.com/docker/docker/pkg/system/process_unix.go
Lantao Liu fa91b905e9 Update vendors.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-02-16 23:23:47 +00:00

25 lines
425 B
Go

// +build linux freebsd solaris darwin
package system
import (
"syscall"
"golang.org/x/sys/unix"
)
// IsProcessAlive returns true if process with a given pid is running.
func IsProcessAlive(pid int) bool {
err := unix.Kill(pid, syscall.Signal(0))
if err == nil || err == unix.EPERM {
return true
}
return false
}
// KillProcess force-stops a process.
func KillProcess(pid int) {
unix.Kill(pid, unix.SIGKILL)
}