summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Otto <th1000s@posteo.net>2021-12-22 23:07:16 +0100
committerDan Davison <dandavison7@gmail.com>2022-01-03 17:28:27 -0500
commit8f2a8ce4964253718087bed008bc13fb161e28c6 (patch)
tree83ed6ac12f24ee5d3d9f189a8d55cdb8a963d0f7 /src
parent50ece4b0cc8dab57a69511fd62013feb892c9c20 (diff)
Disable /proc fd caching on Linux when querying processes
This query only happens once, so caching is not needed Also update sysinfo version to fix a crash related to this.
Diffstat (limited to 'src')
-rw-r--r--src/utils/process.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/process.rs b/src/utils/process.rs
index 68b57a6a..eac564e0 100644
--- a/src/utils/process.rs
+++ b/src/utils/process.rs
@@ -226,6 +226,13 @@ struct ProcInfo {
}
impl ProcInfo {
fn new() -> Self {
+ // On Linux sysinfo optimizes for repeated process queries and keeps per-process
+ // /proc file descriptors open. This caching is not needed here, so
+ // set this to zero (this does nothing on other platforms).
+ // Also, there is currently a kernel bug which slows down syscalls when threads are
+ // involved (here: the ctrlc handler) and a lot of files are kept open.
+ sysinfo::set_open_files_limit(0);
+
ProcInfo {
info: sysinfo::System::new(),
}