summaryrefslogtreecommitdiffstats
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-04-12 10:39:56 +0000
committertjr <tjr@FreeBSD.org>2003-04-12 10:39:56 +0000
commit72859c819a6b7bfb12dfc24c4dd6de478c35e156 (patch)
tree49b3b72affbfe7bcc0858f40a21d521e750d79e1 /bin/ps/print.c
parent453902424c76c2b8c66ed6b58459cc7611596288 (diff)
downloadFreeBSD-src-72859c819a6b7bfb12dfc24c4dd6de478c35e156.zip
FreeBSD-src-72859c819a6b7bfb12dfc24c4dd6de478c35e156.tar.gz
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
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c4
1 files changed, 3 insertions, 1 deletions
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);
OpenPOWER on IntegriCloud