ps: Output of nwchan is a number
For some time with enough compilier flags I have watched the following warning drift by: ps/output.c: In function ‘pr_nwchan’: ps/output.c:658:41: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return snprintf(outbuf, COLWID, "%x", (unsigned)rSv(WCHAN_NAME, str, pp)); nwchan is supposed to be the address of where the process is sleeping, not the name. Besides %x is a hex number not a string hence the warning. nwchan now prints the address, in hex and GCC is happy.
This commit is contained in:
parent
b4beb162fd
commit
201208cbc1
@ -654,8 +654,12 @@ setREL1(WCHAN_NAME)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int pr_nwchan(char *restrict const outbuf, const proc_t *restrict const pp){
|
static int pr_nwchan(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||||
setREL1(WCHAN_NAME)
|
setREL1(WCHAN_ADDR)
|
||||||
return snprintf(outbuf, COLWID, "%x", (unsigned)rSv(WCHAN_NAME, str, pp));
|
if (!(rSv(WCHAN_ADDR, ul_int, pp) & 0xffffff)) {
|
||||||
|
memcpy(outbuf, "-",2);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return snprintf(outbuf, COLWID, "%x", (unsigned)rSv(WCHAN_ADDR, ul_int, pp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Terrible trunctuation, like BSD crap uses: I999 J999 K999 */
|
/* Terrible trunctuation, like BSD crap uses: I999 J999 K999 */
|
||||||
|
Loading…
Reference in New Issue
Block a user