Skip to main content

process_name

Function process_name 

Source
pub fn process_name(pid: u32) -> Option<String>
Expand description

Returns the executable name for the PID if it can be determined cheaply.

Linux: reads /proc/<pid>/comm. Other Unix (macOS, BSDs): shells out to ps -p <pid> -o comm=, then takes the basename — macOS ps returns the full path of the executable. Non-Unix: returns None.

Used by the daemon preflight to tell “our prior daemon process” apart from “PID was recycled and now belongs to /usr/bin/grep” or similar.