Display residency and sleep times (re and sl fields) larger than 127 as 127.
This is what the manual page says ps should do, and what OpenBSD and NetBSD do. Based on a patch from Ken Stailey. PR: 27433, 46232
This commit is contained in:
parent
146d4bcf2f
commit
ee6dd32236
@ -143,7 +143,7 @@ static VAR var[] = {
|
||||
{"ppid", "PPID", NULL, 0, kvar, NULL, PIDLEN, KOFF(ki_ppid), UINT,
|
||||
PIDFMT, 0},
|
||||
{"pri", "PRI", NULL, 0, pri, NULL, 3, 0, CHAR, NULL, 0},
|
||||
{"re", "RE", NULL, 0, kvar, NULL, 3, KOFF(ki_swtime), UINT, "d",
|
||||
{"re", "RE", NULL, INF127, kvar, NULL, 3, KOFF(ki_swtime), UINT, "d",
|
||||
0},
|
||||
{"rgid", "RGID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_rgid),
|
||||
UINT, UIDFMT, 0},
|
||||
@ -166,7 +166,7 @@ static VAR var[] = {
|
||||
UINT, "x", 0},
|
||||
{"sigmask", "BLOCKED", NULL, 0, kvar, NULL, 8, KOFF(ki_sigmask),
|
||||
UINT, "x", 0},
|
||||
{"sl", "SL", NULL, 0, kvar, NULL, 3, KOFF(ki_slptime), UINT, "d",
|
||||
{"sl", "SL", NULL, INF127, kvar, NULL, 3, KOFF(ki_slptime), UINT, "d",
|
||||
0},
|
||||
{"start", "STARTED", NULL, LJUST|USER, started, NULL, 7, 0, CHAR, NULL,
|
||||
0},
|
||||
|
@ -694,6 +694,8 @@ printval(void *bp, VAR *v)
|
||||
*cp++ = '*';
|
||||
while ((*cp++ = *fcp++));
|
||||
|
||||
#define CHKINF127(n) (((n) > 127) && (v->flag & INF127) ? 127 : (n))
|
||||
|
||||
switch (v->type) {
|
||||
case CHAR:
|
||||
(void)printf(ofmt, v->width, *(char *)bp);
|
||||
@ -711,7 +713,7 @@ printval(void *bp, VAR *v)
|
||||
(void)printf(ofmt, v->width, *(int *)bp);
|
||||
break;
|
||||
case UINT:
|
||||
(void)printf(ofmt, v->width, *(u_int *)bp);
|
||||
(void)printf(ofmt, v->width, CHKINF127(*(u_int *)bp));
|
||||
break;
|
||||
case LONG:
|
||||
(void)printf(ofmt, v->width, *(long *)bp);
|
||||
|
@ -59,6 +59,7 @@ typedef struct var {
|
||||
#define LJUST 0x02 /* left adjust on output (trailing blanks) */
|
||||
#define USER 0x04 /* needs user structure */
|
||||
#define DSIZ 0x08 /* field size is dynamic*/
|
||||
#define INF127 0x10 /* values >127 displayed as 127 */
|
||||
u_int flag;
|
||||
/* output routine */
|
||||
void (*oproc)(struct kinfo *, struct varent *);
|
||||
|
Loading…
Reference in New Issue
Block a user