From 5d0b094b8c62867fe6b6ed6272a967245b7631ca Mon Sep 17 00:00:00 2001 From: Craig Small Date: Fri, 2 Mar 2018 22:07:46 +1100 Subject: [PATCH] ps: Add NEWS and checks for times and cputimes The previous commit had one minor bug in it because the fields need to be alphabetical and times comes after timeout. Added NEWS item for this feature Added another testsuite check for new flags in case they disappear or go strange one day. References: commit 8a94ed61119f8dcf7bcb98b84534e408d4eb7769 --- NEWS | 1 + ps/output.c | 2 +- testsuite/ps.test/ps_output.exp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cbbcb3b1..0d9910ce 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ procps-ng-NEXT * ps: avoid eip/esp address truncations Debian #846361 * ps: recognizes SCHED_DEADLINE as valid CPU scheduler * ps: display NUMA node under which a thread ran issue #58 + * ps: Add seconds display for cputime and time merge #43 * sysctl: Permit empty string for value issue #74 * sysctl: Don't segv when file not available issue #76 * sysctl: Read and write large buffers merge #56 diff --git a/ps/output.c b/ps/output.c index 1ae2f21c..8c4c201c 100644 --- a/ps/output.c +++ b/ps/output.c @@ -1685,8 +1685,8 @@ static const format_struct format_array[] = { {"thcount", "THCNT", pr_nlwp, sr_nlwp, 5, 0, AIX, PO|RIGHT}, {"tid", "TID", pr_tasks, sr_tasks, 5, 0, AIX, TO|PIDMAX|RIGHT}, {"time", "TIME", pr_time, sr_time, 8, 0, U98, ET|RIGHT}, /*cputime*/ /* was 6 wide */ -{"times", "TIME", pr_times, sr_time, 8, 0, LNX, ET|RIGHT}, {"timeout", "TMOUT", pr_nop, sr_nop, 5, 0, LNX, AN|RIGHT}, // 2.0.xx era +{"times", "TIME", pr_times, sr_time, 8, 0, LNX, ET|RIGHT}, {"tmout", "TMOUT", pr_nop, sr_nop, 5, 0, LNX, AN|RIGHT}, // 2.0.xx era {"tname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, PO|LEFT}, {"tpgid", "TPGID", pr_tpgid, sr_tpgid, 5, 0, XXX, PO|PIDMAX|RIGHT}, diff --git a/testsuite/ps.test/ps_output.exp b/testsuite/ps.test/ps_output.exp index cadce131..b290e28d 100644 --- a/testsuite/ps.test/ps_output.exp +++ b/testsuite/ps.test/ps_output.exp @@ -27,6 +27,7 @@ set flag_match { "bsdstart,start,lstart" "\\s*START\\s+STARTED\\s+STARTED\\s+\(\\s*\(\[A-Z\]\[a-z\]{2} \\d+|\\d+:\\d{2}\)\\s+\(\[A-Z\]\[a-z\]{2} \\d+|\\d+:\\d{2}:\\d{2}\)\\s+\[A-Z\]\[a-z\]{2} \[A-Z\]\[a-z\]{2}\\s+\\d+ \\d{2}:\\d{2}:\\d{2} \\d{4}\\s*\)+$" "bsdtime,cputime,etime,etimes" "\\s*TIME\\s+TIME\\s+ELAPSED\\s+ELAPSED\\s*\(\\s*\\d+:\\d{2}\\s+\\d{2}:\\d{2}:\\d{2}\\s+\(\\d{2}:\)?\\d{2}:\\d{2}\\s+\\d+\\s*\)$" "user,ruser,group,rgroup,uid,ruid,gid,rgid" "\\s*USER\\s+RUSER\\s+GROUP\\s+RGROUP\\s+UID\\s+RUID\\s+GID\\s+RGID\\s+\(\(\\s*\[A-Za-z0-9_+-\]+\\s+\){4}\(\\d+\\s+\){4}\\s*\)+$" + "cputimes,times" "\\s*TIME\\s+TIME\\s+\\d+\\s+\\d+\\s*" } foreach { flag match } $flag_match {