@@ -28,20 +28,24 @@ pub(crate) fn collect_pickers(
2828 match code. as_str ( ) {
2929 "pid" | "tgid" => pickers. push ( helper ( pid) ) ,
3030 "ppid" => pickers. push ( helper ( ppid) ) ,
31- "uid" => pickers. push ( helper ( uid) ) ,
32- "euid" => pickers. push ( helper ( euid) ) ,
33- "user" => pickers. push ( helper ( user) ) ,
34- "euser" => pickers. push ( helper ( euser) ) ,
31+ "uid" | "euid" => pickers. push ( helper ( euid) ) ,
32+ "ruid" => pickers. push ( helper ( ruid) ) ,
33+ "suid" => pickers. push ( helper ( suid) ) ,
34+ "user" | "euser" => pickers. push ( helper ( euser) ) ,
35+ "ruser" => pickers. push ( helper ( ruser) ) ,
36+ "suser" => pickers. push ( helper ( suser) ) ,
3537 "pgid" => pickers. push ( helper ( pgid) ) ,
36- "sid" => pickers. push ( helper ( sid) ) ,
37- "gid" => pickers. push ( helper ( gid) ) ,
38- "egid" => pickers. push ( helper ( egid) ) ,
39- "group" => pickers. push ( helper ( group) ) ,
40- "egroup" => pickers. push ( helper ( egroup) ) ,
38+ "sid" | "sess" => pickers. push ( helper ( sid) ) ,
39+ "gid" | "egid" => pickers. push ( helper ( egid) ) ,
40+ "rgid" => pickers. push ( helper ( rgid) ) ,
41+ "sgid" => pickers. push ( helper ( sgid) ) ,
42+ "group" | "egroup" => pickers. push ( helper ( egroup) ) ,
43+ "rgroup" => pickers. push ( helper ( rgroup) ) ,
44+ "sgroup" => pickers. push ( helper ( sgroup) ) ,
4145 "tname" | "tt" | "tty" => pickers. push ( helper ( tty) ) ,
4246 "time" | "cputime" => pickers. push ( helper ( time) ) ,
43- "ucmd" => pickers. push ( helper ( ucmd) ) ,
44- "cmd" => pickers. push ( helper ( cmd) ) ,
47+ "ucmd" | "comm" => pickers. push ( helper ( ucmd) ) ,
48+ "cmd" | "command" | "args" => pickers. push ( helper ( cmd) ) ,
4549 _ => { }
4650 }
4751 }
@@ -64,15 +68,19 @@ fn ppid(proc_info: RefCell<ProcessInformation>) -> String {
6468 proc_info. borrow_mut ( ) . ppid ( ) . unwrap ( ) . to_string ( )
6569}
6670
67- fn uid ( proc_info : RefCell < ProcessInformation > ) -> String {
71+ fn ruid ( proc_info : RefCell < ProcessInformation > ) -> String {
6872 proc_info. borrow_mut ( ) . uid ( ) . unwrap ( ) . to_string ( )
6973}
7074
7175fn euid ( proc_info : RefCell < ProcessInformation > ) -> String {
7276 proc_info. borrow_mut ( ) . euid ( ) . unwrap ( ) . to_string ( )
7377}
7478
75- fn user ( proc_info : RefCell < ProcessInformation > ) -> String {
79+ fn suid ( proc_info : RefCell < ProcessInformation > ) -> String {
80+ proc_info. borrow_mut ( ) . suid ( ) . unwrap_or ( 0 ) . to_string ( )
81+ }
82+
83+ fn ruser ( proc_info : RefCell < ProcessInformation > ) -> String {
7684 let uid = proc_info. borrow_mut ( ) . uid ( ) . unwrap ( ) ;
7785 uid2usr ( uid) . ok ( ) . unwrap_or_else ( || uid. to_string ( ) )
7886}
@@ -82,15 +90,24 @@ fn euser(proc_info: RefCell<ProcessInformation>) -> String {
8290 uid2usr ( euid) . ok ( ) . unwrap_or_else ( || euid. to_string ( ) )
8391}
8492
85- fn gid ( proc_info : RefCell < ProcessInformation > ) -> String {
93+ fn suser ( proc_info : RefCell < ProcessInformation > ) -> String {
94+ let suid = proc_info. borrow_mut ( ) . suid ( ) . unwrap_or ( 0 ) ;
95+ uid2usr ( suid) . unwrap_or_else ( |_| suid. to_string ( ) )
96+ }
97+
98+ fn rgid ( proc_info : RefCell < ProcessInformation > ) -> String {
8699 proc_info. borrow_mut ( ) . gid ( ) . unwrap ( ) . to_string ( )
87100}
88101
89102fn egid ( proc_info : RefCell < ProcessInformation > ) -> String {
90103 proc_info. borrow_mut ( ) . egid ( ) . unwrap ( ) . to_string ( )
91104}
92105
93- fn group ( proc_info : RefCell < ProcessInformation > ) -> String {
106+ fn sgid ( proc_info : RefCell < ProcessInformation > ) -> String {
107+ proc_info. borrow_mut ( ) . sgid ( ) . unwrap_or ( 0 ) . to_string ( )
108+ }
109+
110+ fn rgroup ( proc_info : RefCell < ProcessInformation > ) -> String {
94111 let gid = proc_info. borrow_mut ( ) . gid ( ) . unwrap ( ) ;
95112 gid2grp ( gid) . ok ( ) . unwrap_or_else ( || gid. to_string ( ) )
96113}
@@ -100,6 +117,11 @@ fn egroup(proc_info: RefCell<ProcessInformation>) -> String {
100117 gid2grp ( egid) . ok ( ) . unwrap_or_else ( || egid. to_string ( ) )
101118}
102119
120+ fn sgroup ( proc_info : RefCell < ProcessInformation > ) -> String {
121+ let sgid = proc_info. borrow_mut ( ) . sgid ( ) . unwrap_or ( 0 ) ;
122+ gid2grp ( sgid) . unwrap_or_else ( |_| sgid. to_string ( ) )
123+ }
124+
103125fn pgid ( proc_info : RefCell < ProcessInformation > ) -> String {
104126 proc_info. borrow_mut ( ) . pgid ( ) . unwrap ( ) . to_string ( )
105127}
@@ -144,11 +166,17 @@ fn format_time(seconds: i64) -> String {
144166}
145167
146168fn cmd ( proc_info : RefCell < ProcessInformation > ) -> String {
147- proc_info. borrow ( ) . cmdline . clone ( )
169+ // Use command line if available, otherwise show process name in brackets (for kernel threads)
170+ let cmdline = proc_info. borrow ( ) . cmdline . clone ( ) ;
171+ if !cmdline. is_empty ( ) {
172+ cmdline
173+ } else {
174+ format ! ( "[{}]" , proc_info. borrow_mut( ) . name( ) . unwrap( ) )
175+ }
148176}
149177
150178fn ucmd ( proc_info : RefCell < ProcessInformation > ) -> String {
151- proc_info. borrow_mut ( ) . status ( ) . get ( "Name" ) . unwrap ( ) . into ( )
179+ proc_info. borrow_mut ( ) . name ( ) . unwrap ( )
152180}
153181
154182#[ test]
0 commit comments