From 72859c819a6b7bfb12dfc24c4dd6de478c35e156 Mon Sep 17 00:00:00 2001 From: tjr Date: Sat, 12 Apr 2003 10:39:56 +0000 Subject: 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 --- bin/ps/print.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bin/ps/print.c') 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); -- cgit v1.1