Documentation
¶
Overview ¶
Package process provides access to operating system process information.
It defines PID, a process identifier with methods for retrieving process metadata, and functions for locating processes by network port.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when no matching process is found. ErrNotFound = errors.New("process not found") )
Functions ¶
This section is empty.
Types ¶
type PID ¶
type PID int
PID identifies an operating system process.
func FindPIDByRequest ¶ added in v0.3.0
FindPIDByRequest returns the PID that owns the TCP/IPv4 source port for r.
Only works for local requests. Returns ErrNotFound if no process owns the port.
func FindPIDBySourcePort ¶
FindPIDBySourcePort returns the PID that owns the given TCP/IPv4 source port. It returns ErrNotFound if no process owns the port.
func (PID) ExecutablePath ¶
ExecutablePath returns the filesystem path to the process executable.
func (PID) Name ¶
Name returns a best-effort display name for the process.
Its meaning is operating system dependent. The returned name may come from process metadata rather than the executable filename, may be truncated, and is not guaranteed to be stable over the lifetime of the process.
Name is intended for display and diagnostics. Callers that need a stable identifier should use PID or ExecutablePath instead.