Function sysinfo::set_open_files_limit[][src]

pub fn set_open_files_limit(_new_limit: isize) -> bool

This function is only used on linux targets, on the other platforms it does nothing and returns false.

On linux, to improve performance, we keep a /proc file open for each process we index with a maximum number of files open equivalent to half of the system limit.

The problem is that some users might need all the available file descriptors so we need to allow them to change this limit.

Note that if you set a limit bigger than the system limit, the system limit will be set.

Returns true if the new value has been set.

use sysinfo::{System, SystemExt, set_open_files_limit};

// We call the function before any call to the processes update.
if !set_open_files_limit(10) {
    // It'll always return false on non-linux targets.
    eprintln!("failed to update the open files limit...");
}
let s = System::new_all();