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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-10-07 05:55:55 -05:00 committed by Craig Small
parent 912075605b
commit 66c4024d75
2 changed files with 3 additions and 20 deletions

View File

@ -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*/

View File

@ -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