From 86992bb58f59d617ee2bf20de4f2a185bf817dae Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Wed, 28 Sep 2016 12:12:12 -0500 Subject: [PATCH] ps: respond to loss of fields obsoleted with linux 2.6 Signed-off-by: Jim Warner --- ps/common.h | 1 - ps/output.c | 19 +++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/ps/common.h b/ps/common.h index 0cdc878e..1b02c90f 100644 --- a/ps/common.h +++ b/ps/common.h @@ -70,7 +70,6 @@ makEXT(ADDR_KSTK_EIP) makEXT(ADDR_KSTK_ESP) makEXT(ADDR_START_CODE) makEXT(ADDR_START_STACK) -makEXT(ALARM) makEXT(CGNAME) makEXT(CGROUP) makEXT(CMD) diff --git a/ps/output.c b/ps/output.c index 4a6c1020..ac4111b9 100644 --- a/ps/output.c +++ b/ps/output.c @@ -745,15 +745,6 @@ setREL1(ADDR_KSTK_EIP) return snprintf(outbuf, COLWID, "%08x", (unsigned)(rSv(ADDR_KSTK_EIP, ul_int, pp))); } -/* This function helps print old-style time formats */ -static int old_time_helper(char *dst, unsigned long long t, unsigned long long rel) { - if(!t) return snprintf(dst, COLWID, " -"); - if(t == ~0ULL) return snprintf(dst, COLWID, " xx"); - if((long long)(t -= rel) < 0) t = 0ULL; - if(t > 9999ULL) return snprintf(dst, COLWID, "%5llu", t/100ULL); - else return snprintf(dst, COLWID, "%2u.%02u", (unsigned)t/100U, (unsigned)t%100U); -} - static int pr_bsdtime(char *restrict const outbuf, const proc_t *restrict const pp){ unsigned long long t; unsigned u; @@ -777,10 +768,6 @@ setREL1(TIME_START) return 6; } -static int pr_alarm(char *restrict const outbuf, const proc_t *restrict const pp){ -setREL1(ALARM) - return old_time_helper(outbuf, rSv(ALARM, ul_int, pp), 0ULL); -} /* HP-UX puts this in pages and uses "vsz" for kB */ static int pr_sz(char *restrict const outbuf, const proc_t *restrict const pp){ @@ -1373,7 +1360,7 @@ static const format_struct format_array[] = { /* {"acflg", "ACFLG", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*acflag*/ {"addr", "ADDR", pr_nop, PIDS_noop, 4, XXX, AN|RIGHT}, {"addr_1", "ADDR", pr_nop, PIDS_noop, 1, LNX, AN|LEFT}, -{"alarm", "ALARM", pr_alarm, PIDS_ALARM, 5, LNX, AN|RIGHT}, +{"alarm", "ALARM", pr_nop, PIDS_noop, 5, LNX, AN|RIGHT}, {"argc", "ARGC", pr_nop, PIDS_noop, 4, LNX, PO|RIGHT}, {"args", "COMMAND", pr_args, PIDS_CMDLINE, 27, U98, PO|UNLIMITED}, /*command*/ {"atime", "TIME", pr_time, PIDS_TIME_ALL, 8, SOE, ET|RIGHT}, /*cputime*/ /* was 6 wide */ @@ -1451,8 +1438,8 @@ static const format_struct format_array[] = { /* {"lwp", "LWP", pr_tasks, PIDS_ID_PID, 5, SUN, TO|PIDMAX|RIGHT}, {"lxc", "LXC", pr_lxcname, PIDS_LXCNAME, 8, LNX, ET|LEFT}, {"m_drs", "DRS", pr_drs, PIDS_VSIZE_PGS, 5, LNx, PO|RIGHT}, -{"m_dt", "DT", pr_nop, PIDS_MEM_DT_PGS, 4, LNx, PO|RIGHT}, -{"m_lrs", "LRS", pr_nop, PIDS_MEM_LRS_PGS, 5, LNx, PO|RIGHT}, +{"m_dt", "DT", pr_nop, PIDS_noop, 4, LNx, PO|RIGHT}, +{"m_lrs", "LRS", pr_nop, PIDS_noop, 5, LNx, PO|RIGHT}, {"m_resident", "RES", pr_nop, PIDS_MEM_RES_PGS, 5, LNx, PO|RIGHT}, {"m_share", "SHRD", pr_nop, PIDS_MEM_SHR_PGS, 5, LNx, PO|RIGHT}, {"m_size", "SIZE", pr_size, PIDS_VSIZE_PGS, 5, LNX, PO|RIGHT}, -- 2.40.0