diff options
-rw-r--r-- | bin/ps/keyword.c | 4 | ||||
-rw-r--r-- | bin/ps/print.c | 4 | ||||
-rw-r--r-- | bin/ps/ps.h | 1 |
3 files changed, 6 insertions, 3 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 5456945..d893d0f 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -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}, diff --git a/bin/ps/print.c b/bin/ps/print.c index 69d33ba..69fcba9 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -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); diff --git a/bin/ps/ps.h b/bin/ps/ps.h index 2fd10de..6d84697 100644 --- a/bin/ps/ps.h +++ b/bin/ps/ps.h @@ -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 *); |