summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/data_harvester.rs4
-rw-r--r--src/app/data_harvester/processes.rs3
-rw-r--r--src/app/data_harvester/processes/windows.rs6
-rw-r--r--src/app/query.rs11
4 files changed, 11 insertions, 13 deletions
diff --git a/src/app/data_harvester.rs b/src/app/data_harvester.rs
index 36d705dc..e25f0be4 100644
--- a/src/app/data_harvester.rs
+++ b/src/app/data_harvester.rs
@@ -182,6 +182,10 @@ impl DataCollector {
self.sys.refresh_networks_list();
}
+ if cfg!(target_os = "windows") && self.widgets_to_harvest.use_proc {
+ self.sys.refresh_users_list();
+ }
+
if self.widgets_to_harvest.use_proc || self.widgets_to_harvest.use_cpu {
self.sys.refresh_cpu();
}
diff --git a/src/app/data_harvester/processes.rs b/src/app/data_harvester/processes.rs
index 96b1fbda..62fc280c 100644
--- a/src/app/data_harvester/processes.rs
+++ b/src/app/data_harvester/processes.rs
@@ -72,8 +72,7 @@ pub struct ProcessHarvest {
#[cfg(target_family = "unix")]
pub uid: Option<libc::uid_t>,
- /// This is the process' user. This is only used on Unix platforms.
- #[cfg(target_family = "unix")]
+ /// This is the process' user.
pub user: std::borrow::Cow<'static, str>,
// TODO: Additional fields
// pub rss_kb: u64,
diff --git a/src/app/data_harvester/processes/windows.rs b/src/app/data_harvester/processes/windows.rs
index 62749052..8d190d00 100644
--- a/src/app/data_harvester/processes/windows.rs
+++ b/src/app/data_harvester/processes/windows.rs
@@ -1,6 +1,6 @@
//! Process data collection for Windows. Uses sysinfo.
-use sysinfo::{CpuExt, PidExt, ProcessExt, System, SystemExt};
+use sysinfo::{CpuExt, PidExt, ProcessExt, System, SystemExt, UserExt};
use super::ProcessHarvest;
@@ -75,6 +75,10 @@ pub fn get_process_data(
total_read_bytes: disk_usage.total_read_bytes,
total_write_bytes: disk_usage.total_written_bytes,
process_state,
+ user: process_val
+ .user_id()
+ .and_then(|uid| sys.get_user_by_id(uid))
+ .map_or_else(|| "N/A".into(), |user| user.name().to_owned().into()),
});
}
diff --git a/src/app/query.rs b/src/app/query.rs
index a894577e..20798716 100644
--- a/src/app/query.rs
+++ b/src/app/query.rs
@@ -670,16 +670,7 @@ impl Prefix {
}),
PrefixType::Pid => r.is_match(process.pid.to_string().as_str()),
PrefixType::State => r.is_match(process.process_state.0.as_str()),
- PrefixType::User => {
- #[cfg(target_family = "unix")]
- {
- r.is_match(process.user.as_ref())
- }
- #[cfg(not(target_family = "unix"))]
- {
- false
- }
- }
+ PrefixType::User => r.is_match(process.user.as_ref()),
_ => true,
}
} else {