get_parent_pid

Function get_parent_pid 

Source
pub fn get_parent_pid() -> Option<i32>
Expand description

Get the parent process ID.

This is more reliable than the PPID environment variable, which is a shell variable that isn’t exported to child processes.

§Examples

use mi6_core::get_parent_pid;

// We should always have a parent process
let ppid = get_parent_pid();
assert!(ppid.is_some());