//go:build unix

package proc

import (
	"errors"
	"syscall"
)

// PIDAlive reports whether pid currently exists.
func PIDAlive(pid int) bool {
	if pid <= 0 {
		return false
	}
	err := syscall.Kill(pid, 0)
	return err == nil || errors.Is(err, syscall.EPERM)
}
