shithub: riscv

Download patch

ref: bd3429304cdded196990683d4ee77cd36eac3b9c
parent: 1848f4e946c6a5d625c23f9c6a3ad7480816585a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Sep 7 19:39:10 EDT 2016

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.

--- a/sys/src/9/port/devcons.c
+++ b/sys/src/9/port/devcons.c
@@ -509,8 +509,7 @@
 			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;
--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -905,8 +905,7 @@
 			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);