e95f4619cd
Changes most references of syscall to golang.org/x/sys/ Ones aren't changes include, Errno, Signal and SysProcAttr as they haven't been implemented in /x/sys/. Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com> [s390x] switch utsname from unsigned to signed per https://github.com/golang/sys/commit/33267e036fd93fcd26ea95b7bdaf2d8306cb743c char in s390x in the /x/sys/unix package is now signed, so change the buildtags Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com> Upstream-commit: 069fdc8a083cb1663e4f86fe3fd9b9a1aebc3e54 Component: engine
26 lines
416 B
Go
26 lines
416 B
Go
package pidfile
|
|
|
|
import (
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
const (
|
|
processQueryLimitedInformation = 0x1000
|
|
|
|
stillActive = 259
|
|
)
|
|
|
|
func processExists(pid int) bool {
|
|
h, err := windows.OpenProcess(processQueryLimitedInformation, false, uint32(pid))
|
|
if err != nil {
|
|
return false
|
|
}
|
|
var c uint32
|
|
err = windows.GetExitCodeProcess(h, &c)
|
|
windows.Close(h)
|
|
if err != nil {
|
|
return c == stillActive
|
|
}
|
|
return true
|
|
}
|