返回 DeepSeek-Reasonix
pidprobe_unix_test.go
根目录 / internal / boot / pidprobe_unix_test.go
1 //go:build !windows
2
3 package boot
4
5 import (
6 "errors"
7 "syscall"
8 )
9
10 // pidAlive reports whether pid still exists (zombies count as alive: the
11 // process table entry only disappears once the host reaps it).
12 func pidAlive(pid int) bool {
13 if pid <= 0 {
14 return false
15 }
16 err := syscall.Kill(pid, 0)
17 return !errors.Is(err, syscall.ESRCH)
18 }
19
19 lines GO