kernel: more kproc pexit() and sleep error handling

This commit is contained in:
cinap_lenrek 2013-11-22 22:56:34 +01:00
parent 55d31f2cab
commit 98f47d5867
10 changed files with 23 additions and 3 deletions

View file

@ -237,6 +237,9 @@ powerkproc(void*)
{ {
ulong xlink, xlink1; ulong xlink, xlink1;
while(waserror())
;
for(;;){ for(;;){
while(powerflag == 0) while(powerflag == 0)
sleep(&powerr, powerdown, 0); sleep(&powerr, powerdown, 0);
@ -247,7 +250,6 @@ powerkproc(void*)
deepsleep(); deepsleep();
xlink1 = getcallerpc(&xlink1); xlink1 = getcallerpc(&xlink1);
delay(2000); delay(2000);
// iprint("deepsleep returned, pc = 0x%lux, sp = 0x%lux\n", xlink1, &xlink); // iprint("deepsleep returned, pc = 0x%lux, sp = 0x%lux\n", xlink1, &xlink);

View file

@ -682,6 +682,8 @@ w_timer(void* arg)
Ctlr* ctlr = (Ctlr*)ether->ctlr; Ctlr* ctlr = (Ctlr*)ether->ctlr;
ctlr->timerproc = up; ctlr->timerproc = up;
while(waserror())
;
for(;;){ for(;;){
tsleep(&up->sleep, return0, 0, MSperTick); tsleep(&up->sleep, return0, 0, MSperTick);
ctlr = (Ctlr*)ether->ctlr; ctlr = (Ctlr*)ether->ctlr;
@ -732,7 +734,7 @@ w_timer(void* arg)
} }
iunlock(ctlr); iunlock(ctlr);
} }
pexit("terminated", 0); pexit("terminated", 1);
} }
void void

View file

@ -1145,6 +1145,8 @@ ilackproc(void *x)
il = x; il = x;
while(waserror())
;
loop: loop:
tsleep(&up->sleep, return0, 0, Iltickms); tsleep(&up->sleep, return0, 0, Iltickms);
for(s = il->conv; s && *s; s++) { for(s = il->conv; s && *s; s++) {

View file

@ -733,6 +733,8 @@ relackproc(void *a)
rudp = (Proto *)a; rudp = (Proto *)a;
while(waserror())
;
loop: loop:
tsleep(&up->sleep, return0, 0, Rudptickms); tsleep(&up->sleep, return0, 0, Rudptickms);

View file

@ -747,6 +747,9 @@ tcpackproc(void *a)
tcp = a; tcp = a;
priv = tcp->priv; priv = tcp->priv;
while(waserror())
;
for(;;) { for(;;) {
tsleep(&up->sleep, return0, 0, MSPTICK); tsleep(&up->sleep, return0, 0, MSPTICK);

View file

@ -776,6 +776,8 @@ rcvproc(void* arg)
ether = arg; ether = arg;
ctlr = ether->ctlr; ctlr = ether->ctlr;
while(waserror())
;
for(;;){ for(;;){
tsleep(&ctlr->rrendez, gotinput, ctlr, 10*1000); tsleep(&ctlr->rrendez, gotinput, ctlr, 10*1000);
ilock(ctlr); ilock(ctlr);

View file

@ -76,6 +76,9 @@ mmusweep(void*)
int i, x, sweepcolor; int i, x, sweepcolor;
ulong *ptab, *ptabend, ptecol; ulong *ptab, *ptabend, ptecol;
while(waserror())
;
for(;;) { for(;;) {
if(PIDCOLOR(m->mmupid) != m->trigcolor) if(PIDCOLOR(m->mmupid) != m->trigcolor)
sleep(&m->sweepr, work, nil); sleep(&m->sweepr, work, nil);

View file

@ -80,6 +80,9 @@ mmusweep(void*)
int i, x, sweepcolor; int i, x, sweepcolor;
ulong *ptab, *ptabend, ptecol; ulong *ptab, *ptabend, ptecol;
while(waserror())
;
for(;;) { for(;;) {
if(PIDCOLOR(m->mmupid) != m->trigcolor) if(PIDCOLOR(m->mmupid) != m->trigcolor)
sleep(&m->sweepr, work, nil); sleep(&m->sweepr, work, nil);

View file

@ -855,6 +855,8 @@ rproc(void* arg)
edev = arg; edev = arg;
ctlr = edev->ctlr; ctlr = edev->ctlr;
while(waserror())
;
for(;;){ for(;;){
/* wait for next interrupt */ /* wait for next interrupt */
ilock(&ctlr->reglock); ilock(&ctlr->reglock);

View file

@ -692,7 +692,6 @@ init0(void)
poperror(); poperror();
} }
kproc("alarm", alarmkproc, 0); kproc("alarm", alarmkproc, 0);
// kproc("startcpusproc", startcpusproc, nil);
touser(sp); touser(sp);
} }