pub fn get_process_comm(pid: i32) -> Option<String>Expand description
Get the kernel’s internal command name for a process.
Returns the executable basename from /proc/[pid]/comm, truncated to 16 characters
(kernel’s TASK_COMM_LEN - 1). Examples: “zsh”, “node”, “tmux”, “python3.13”
Important: This is NOT equivalent to ps -o comm=, which may return:
- Full executable path
- Or modified argv[0] (e.g., “claude” for renamed node, “-bash” for login shells)
Use get_process_path() if you need the full executable path.
~10µs per call (vs ~2ms for spawning ps).