ps(1): fix some nits

- fracmem and mempages are double. ki_rssize should be too
- remove default case that is fully covered by all existing cases
- mark usage as dead
This commit is contained in:
Eitan Adler 2018-06-13 00:45:35 +00:00
parent c9b4ac7587
commit c6a5ff7153
2 changed files with 3 additions and 5 deletions

View File

@ -662,7 +662,7 @@ getpmem(KINFO *k)
return (0.0);
/* XXX want pmap ptpages, segtab, etc. (per architecture) */
/* XXX don't have info about shared */
fracmem = ((float)k->ki_p->ki_rssize) / mempages;
fracmem = ((double)k->ki_p->ki_rssize) / mempages;
return (100.0 * fracmem);
}
@ -771,8 +771,6 @@ printval(void *bp, VAR *v)
case PGTOK:
(void)asprintf(&str, ofmt, ps_pgtok(*(u_long *)bp));
break;
default:
xo_errx(1, "unknown type %d", v->type);
}
return (str);

View File

@ -689,7 +689,7 @@ main(int argc, char *argv[])
(STAILQ_NEXT(vent, next_ve) == NULL &&
(vent->var->flag & LJUST))) ? 0 : vent->var->width;
snprintf(fmtbuf, sizeof(fmtbuf), "{:%s/%%%s%d..%ds}",
vent->var->field ?: vent->var->name,
vent->var->field ? vent->var->field : vent->var->name,
(vent->var->flag & LJUST) ? "-" : "",
fwidthmin, fwidthmax);
xo_emit(fmtbuf, str);
@ -1448,7 +1448,7 @@ pidmax_init(void)
}
}
static void
static void __dead2
usage(void)
{
#define SINGLE_OPTS "[-aCcde" OPT_LAZY_f "HhjlmrSTuvwXxZ]"