Function procfs::sys::kernel::pid_max[][src]

pub fn pid_max() -> ProcResult<i32>
Expand description

Returns the maximum process ID number.

This is taken from /proc/sys/kernel/pid_max.

Example

let pid_max = procfs::sys::kernel::pid_max().unwrap();

let pid = 42; // e.g. from user input, CLI args, etc.

if pid > pid_max {
    eprintln!("bad process ID: {}", pid)
} else {
    println!("good process ID: {}", pid);
}