shithub: riscv

Download patch

ref: 98f47d5867cbbaa06f2c9080c301c9191e196205
parent: 55d31f2cab0101dfbdeb2857e2fce2629080cf02
author: cinap_lenrek <[email protected]>
date: Fri Nov 22 17:56:34 EST 2013

kernel: more kproc pexit() and sleep error handling

--- a/sys/src/9/bitsy/power.c
+++ b/sys/src/9/bitsy/power.c
@@ -237,6 +237,9 @@
 {
 	ulong xlink, xlink1;
 
+	while(waserror())
+		;
+
 	for(;;){
 		while(powerflag == 0)
 			sleep(&powerr, powerdown, 0);
@@ -246,7 +249,6 @@
 //		iprint("call deepsleep, pc = 0x%lux, sp = 0x%lux\n", xlink, &xlink);
 		deepsleep();
 		xlink1 = getcallerpc(&xlink1);
-
 
 		delay(2000);
 
--- a/sys/src/9/bitsy/wavelan.c
+++ b/sys/src/9/bitsy/wavelan.c
@@ -682,6 +682,8 @@
 	Ctlr* ctlr = (Ctlr*)ether->ctlr;
 
 	ctlr->timerproc = up;
+	while(waserror())
+		;
 	for(;;){
 		tsleep(&up->sleep, return0, 0, MSperTick);
 		ctlr = (Ctlr*)ether->ctlr;
@@ -732,7 +734,7 @@
 		}
 		iunlock(ctlr);
 	}
-	pexit("terminated", 0);
+	pexit("terminated", 1);
 }
 
 void
--- a/sys/src/9/ip/il.c
+++ b/sys/src/9/ip/il.c
@@ -1145,6 +1145,8 @@
 
 	il = x;
 
+	while(waserror())
+		;
 loop:
 	tsleep(&up->sleep, return0, 0, Iltickms);
 	for(s = il->conv; s && *s; s++) {
--- a/sys/src/9/ip/rudp.c
+++ b/sys/src/9/ip/rudp.c
@@ -733,6 +733,8 @@
 
 	rudp = (Proto *)a;
 
+	while(waserror())
+		;
 loop:
 	tsleep(&up->sleep, return0, 0, Rudptickms);
 
--- a/sys/src/9/ip/tcp.c
+++ b/sys/src/9/ip/tcp.c
@@ -747,6 +747,9 @@
 	tcp = a;
 	priv = tcp->priv;
 
+	while(waserror())
+		;
+
 	for(;;) {
 		tsleep(&up->sleep, return0, 0, MSPTICK);
 
--- a/sys/src/9/kw/ether1116.c
+++ b/sys/src/9/kw/ether1116.c
@@ -776,6 +776,8 @@
 
 	ether = arg;
 	ctlr = ether->ctlr;
+	while(waserror())
+		;
 	for(;;){
 		tsleep(&ctlr->rrendez, gotinput, ctlr, 10*1000);
 		ilock(ctlr);
--- a/sys/src/9/mtx/mmu.c
+++ b/sys/src/9/mtx/mmu.c
@@ -76,6 +76,9 @@
 	int i, x, sweepcolor;
 	ulong *ptab, *ptabend, ptecol;
 
+	while(waserror())
+		;
+
 	for(;;) {
 		if(PIDCOLOR(m->mmupid) != m->trigcolor)
 			sleep(&m->sweepr, work, nil);
--- a/sys/src/9/ppc/mmu.c
+++ b/sys/src/9/ppc/mmu.c
@@ -80,6 +80,9 @@
 	int i, x, sweepcolor;
 	ulong *ptab, *ptabend, ptecol;
 
+	while(waserror())
+		;
+
 	for(;;) {
 		if(PIDCOLOR(m->mmupid) != m->trigcolor)
 			sleep(&m->sweepr, work, nil);
--- a/sys/src/9/teg2/ether8169.c
+++ b/sys/src/9/teg2/ether8169.c
@@ -855,6 +855,8 @@
 
 	edev = arg;
 	ctlr = edev->ctlr;
+	while(waserror())
+		;
 	for(;;){
 		/* wait for next interrupt */
 		ilock(&ctlr->reglock);
--- a/sys/src/9/teg2/main.c
+++ b/sys/src/9/teg2/main.c
@@ -692,7 +692,6 @@
 		poperror();
 	}
 	kproc("alarm", alarmkproc, 0);
-//	kproc("startcpusproc", startcpusproc, nil);
 
 	touser(sp);
 }