From fca70a8cce579ce8cc8caf246c22f0c6e6c6e139 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 3 Jul 2009 22:16:17 +0200 Subject: ps: conditionally support additional -o FIELDs function old new delta procps_scan 1409 1642 +233 out_spec 220 300 +80 func_ruser - 36 +36 func_rgroup - 36 +36 func_group 13 49 +36 func_nice - 29 +29 buffer_fill_and_print 179 196 +17 send_tree 355 360 +5 mkfs_vfat_main 1604 1609 +5 display_speed 85 90 +5 scriptreplay_main 194 197 +3 find_out_spec 55 58 +3 changepath 192 195 +3 sha1_process_block64 497 484 -13 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 10/1 up/down: 491/-13) Total: 478 bytes Signed-off-by: David Krakov Signed-off-by: Denys Vlasenko --- include/libbb.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index e1c36a57b..77674f8a2 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1276,6 +1276,11 @@ typedef struct procps_status_t { unsigned sid; unsigned uid; unsigned gid; +#if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS + unsigned ruid; + unsigned rgid; + int niceness; +#endif unsigned tty_major,tty_minor; #if ENABLE_FEATURE_TOPMEM unsigned long mapped_rw; @@ -1296,6 +1301,7 @@ typedef struct procps_status_t { int last_seen_on_cpu; #endif } procps_status_t; +/* flag bits for procps_scan(xx, flags) calls */ enum { PSSCAN_PID = 1 << 0, PSSCAN_PPID = 1 << 1, @@ -1322,16 +1328,16 @@ enum { ), IF_SELINUX(PSSCAN_CONTEXT = 1 << 17,) PSSCAN_START_TIME = 1 << 18, - PSSCAN_CPU = 1 << 19, + PSSCAN_CPU = (1 << 19) * ENABLE_FEATURE_TOP_SMP_PROCESS, + PSSCAN_NICE = (1 << 20) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS, + PSSCAN_RUIDGID = (1 << 21) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS, /* These are all retrieved from proc/NN/stat in one go: */ PSSCAN_STAT = PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID /**/ | PSSCAN_COMM | PSSCAN_STATE /**/ | PSSCAN_VSZ | PSSCAN_RSS /**/ | PSSCAN_STIME | PSSCAN_UTIME | PSSCAN_START_TIME - /**/ | PSSCAN_TTY -#if ENABLE_FEATURE_TOP_SMP_PROCESS + /**/ | PSSCAN_TTY | PSSCAN_NICE /**/ | PSSCAN_CPU -#endif }; //procps_status_t* alloc_procps_scan(void) FAST_FUNC; void free_procps_scan(procps_status_t* sp) FAST_FUNC; -- cgit v1.2.3