summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-09-07 23:39:10 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2016-09-07 23:39:10 +0200
commitbd3429304cdded196990683d4ee77cd36eac3b9c (patch)
tree99c0e1b85d9f7ed83354b6ac43ea2c6eb5d586eb
parent1848f4e946c6a5d625c23f9c6a3ad7480816585a (diff)
kernel: use tk2ms() instead of TK2MS macro for process time conversion
this code isnt time critical and process TReal delta can become very long, so use tk2ms() which is less prone to overflow.
-rw-r--r--sys/src/9/port/devcons.c3
-rw-r--r--sys/src/9/port/devproc.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/sys/src/9/port/devcons.c b/sys/src/9/port/devcons.c
index 7f287610f..17848aed5 100644
--- a/sys/src/9/port/devcons.c
+++ b/sys/src/9/port/devcons.c
@@ -509,8 +509,7 @@ consread(Chan *c, void *buf, long n, vlong off)
l = up->time[i];
if(i == TReal)
l = MACHP(0)->ticks - l;
- l = TK2MS(l);
- readnum(0, tmp+NUMSIZE*i, NUMSIZE, l, NUMSIZE);
+ readnum(0, tmp+NUMSIZE*i, NUMSIZE, tk2ms(l), NUMSIZE);
}
memmove(buf, tmp+k, n);
return n;
diff --git a/sys/src/9/port/devproc.c b/sys/src/9/port/devproc.c
index 070f1f537..b6218a64f 100644
--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -905,8 +905,7 @@ procread(Chan *c, void *va, long n, vlong off)
l = p->time[i];
if(i == TReal)
l = MACHP(0)->ticks - l;
- l = TK2MS(l);
- readnum(0, statbuf+j+NUMSIZE*i, NUMSIZE, l, NUMSIZE);
+ readnum(0, statbuf+j+NUMSIZE*i, NUMSIZE, tk2ms(l), NUMSIZE);
}
readnum(0, statbuf+j+NUMSIZE*6, NUMSIZE, procpagecount(p)*BY2PG/1024, NUMSIZE);