From e06a2b4c6cffb366d6a7675485780a385bbcea1e Mon Sep 17 00:00:00 2001 From: Carter Li Date: Wed, 2 Sep 2026 14:32:36 +0800 Subject: [PATCH] support `show_kthreads` on macOS --- src/process/macos.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/process/macos.rs b/src/process/macos.rs index 2b72de7a8..e583eb7be 100644 --- a/src/process/macos.rs +++ b/src/process/macos.rs @@ -30,7 +30,7 @@ pub struct ProcessInfo { pub fn collect_proc( interval: Duration, _with_thread: bool, - _show_kthreads: bool, + show_kthreads: bool, _procfs_path: &Option, ) -> Vec { let mut base_procs = Vec::new(); @@ -40,6 +40,10 @@ pub fn collect_proc( if let Ok(procs) = pids_by_type(ProcFilter::All) { for p in procs { if let Ok(task) = pidinfo::(p as i32, 0) { + if !show_kthreads && task.pbsd.pbi_flags & 1 /* PROC_FLAG_SYSTEM */ != 0 { + continue; + } + let res = pidrusage::(p as i32).ok(); let time = Instant::now(); base_procs.push((p as i32, task, res, time));