Skip to content

Commit 4126670

Browse files
committed
ps: Support signal mask related fields
1 parent ec502e6 commit 4126670

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/uu/ps/src/picker.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ pub(crate) fn collect_pickers(
4242
"group" | "egroup" => pickers.push(helper(egroup)),
4343
"rgroup" => pickers.push(helper(rgroup)),
4444
"sgroup" => pickers.push(helper(sgroup)),
45+
"pending" => pickers.push(helper(pending)),
46+
"blocked" => pickers.push(helper(blocked)),
47+
"ignored" => pickers.push(helper(ignored)),
48+
"caught" => pickers.push(helper(caught)),
4549
"tname" | "tt" | "tty" => pickers.push(helper(tty)),
4650
"time" | "cputime" => pickers.push(helper(time)),
4751
"ucmd" | "comm" => pickers.push(helper(ucmd)),
@@ -179,6 +183,38 @@ fn ucmd(proc_info: RefCell<ProcessInformation>) -> String {
179183
proc_info.borrow_mut().name().unwrap()
180184
}
181185

186+
fn pending(proc_info: RefCell<ProcessInformation>) -> String {
187+
proc_info
188+
.borrow_mut()
189+
.signals_pending_mask()
190+
.map(|mask| format!("{:016x}", mask))
191+
.unwrap_or_else(|_| "?".to_string())
192+
}
193+
194+
fn blocked(proc_info: RefCell<ProcessInformation>) -> String {
195+
proc_info
196+
.borrow_mut()
197+
.signals_blocked_mask()
198+
.map(|mask| format!("{:016x}", mask))
199+
.unwrap_or_else(|_| "?".to_string())
200+
}
201+
202+
fn ignored(proc_info: RefCell<ProcessInformation>) -> String {
203+
proc_info
204+
.borrow_mut()
205+
.signals_ignored_mask()
206+
.map(|mask| format!("{:016x}", mask))
207+
.unwrap_or_else(|_| "?".to_string())
208+
}
209+
210+
fn caught(proc_info: RefCell<ProcessInformation>) -> String {
211+
proc_info
212+
.borrow_mut()
213+
.signals_caught_mask()
214+
.map(|mask| format!("{:016x}", mask))
215+
.unwrap_or_else(|_| "?".to_string())
216+
}
217+
182218
#[test]
183219
fn test_time() {
184220
let formatted = {

0 commit comments

Comments
 (0)