From 66c4024d759fb1fa8ebaa2e608368c561cd21ff6 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Fri, 7 Oct 2016 05:55:55 -0500 Subject: [PATCH] ps: respond to loss of that PIDS_WCHAN_ADDR enumerator No longer will ps print nwchan as 'ffffff', '-' or '1' since the proc/PID/stat wchan field didn't represent a real address anyway. Rather, the field will henceforth output a dash ('-'), the ps customary 'not available'. That man document was also tweaked to better represent actual behavior. An asterisk ('*') was never shown for threaded tasks and that dash ('-') usually didn't mean running tasks (sometimes associated with permissions). Signed-off-by: Jim Warner --- ps/output.c | 15 +-------------- ps/ps.1 | 8 ++------ 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/ps/output.c b/ps/output.c index ac4111b9..5b96d74a 100644 --- a/ps/output.c +++ b/ps/output.c @@ -634,19 +634,6 @@ setREL1(WCHAN_NAME) return len; } -static int pr_nwchan(char *restrict const outbuf, const proc_t *restrict const pp){ - char buf[32]; -setREL1(WCHAN_ADDR) - if (!(rSv(WCHAN_ADDR, ul_int, pp) & 0xffffff)) { - memcpy(outbuf, "-",2); - return 1; - } - snprintf(buf, sizeof(buf), "%lx", rSv(WCHAN_ADDR, ul_int, pp)); - // this will force a match with that old ps ... - buf[6] = '\0'; - return snprintf(outbuf, COLWID, "%s", buf); -} - /* Terrible trunctuation, like BSD crap uses: I999 J999 K999 */ /* FIXME: disambiguate /dev/tty69 and /dev/pts/69. */ static int pr_tty4(char *restrict const outbuf, const proc_t *restrict const pp){ @@ -1463,7 +1450,7 @@ static const format_struct format_array[] = { /* {"nsigs", "NSIGS", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*nsignals*/ {"nswap", "NSWAP", pr_nop, PIDS_noop, 5, XXX, AN|RIGHT}, {"nvcsw", "VCSW", pr_nop, PIDS_noop, 5, XXX, AN|RIGHT}, -{"nwchan", "WCHAN", pr_nwchan, PIDS_WCHAN_ADDR, 6, XXX, TO|RIGHT}, +{"nwchan", "WCHAN", pr_nop, PIDS_noop, 6, XXX, TO|RIGHT}, {"opri", "PRI", pr_opri, PIDS_PRIORITY, 3, SUN, TO|RIGHT}, {"osz", "SZ", pr_nop, PIDS_noop, 2, SUN, PO|RIGHT}, {"oublk", "OUBLK", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*oublock*/ diff --git a/ps/ps.1 b/ps/ps.1 index ee9c38f0..3d400d0d 100644 --- a/ps/ps.1 +++ b/ps/ps.1 @@ -1378,8 +1378,7 @@ T} nwchan WCHAN T{ address of the kernel function where the process is sleeping (use .B wchan -if you want the kernel function name). Running tasks will display a dash -('\-') in this column. +if you want the kernel function name). T} ouid OWNER T{ @@ -1800,10 +1799,7 @@ mappings are currently excluded; this is subject to change. (alias T} wchan WCHAN T{ -name of the kernel function in which the process is sleeping, a "\-" if the -process is running, or a "*" if the process is multi\-threaded and -.B ps -is not displaying threads. +name of the kernel function in which the process is sleeping. T} .TE