summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Otto <th1000s@posteo.net>2022-02-25 00:58:13 +0100
committerDan Davison <dandavison7@gmail.com>2022-03-01 18:58:55 -0500
commitd13c41c3fe67f30daf97307883f6cadca6edac63 (patch)
treeeb753c3f1836d92251444717624f5d4cb2f154bd
parentd2f5a9077c1d06f42425da3891fc4e5936c05a8f (diff)
Disable full process scans on Linux
The env var DELTA_CALLING_PROCESS_QUERY_ALL re-enables this last resort method. However usually this is just an expensive scan which doesn't find the caller anyhow.
-rw-r--r--src/utils/process.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/utils/process.rs b/src/utils/process.rs
index b810061a..ab4c4ede 100644
--- a/src/utils/process.rs
+++ b/src/utils/process.rs
@@ -528,8 +528,20 @@ where
match info.find_sibling_in_refreshed_processes(my_pid, &extract_args) {
None => {
- info.refresh_processes();
- info.find_sibling_in_refreshed_processes(my_pid, &extract_args)
+ #[cfg(not(target_os = "linux"))]
+ let full_scan = true;
+
+ // The full scan is expensive on Linux and rarely successful, so disable it by default.
+ #[cfg(target_os = "linux")]
+ let full_scan = std::env::var("DELTA_CALLING_PROCESS_QUERY_ALL")
+ .map_or(false, |v| !["0", "false", "no"].iter().any(|&n| n == v));
+
+ if full_scan {
+ info.refresh_processes();
+ info.find_sibling_in_refreshed_processes(my_pid, &extract_args)
+ } else {
+ None
+ }
}
some => some,
}