clean up scheduler before gsoc. nil not 0 for ptrs. Reference: /n/atom/patch/applied/procnil Date: Thu May 15 04:51:43 CES 2014 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/port/proc.c Thu May 15 04:51:43 2014 +++ /sys/src/nix/port/proc.c Thu May 15 04:51:43 2014 @@ -450,13 +450,13 @@ } /* - * p->mach==0 only when process state is saved + * p->mach == nil only when process state is saved */ - if(p == 0 || p->mach){ + if(p == nil || p->mach != nil){ unlock(sch); return nil; } - if(p->rnext == 0) + if(p->rnext == nil) rq->tail = l; if(l) l->rnext = p->rnext; @@ -715,7 +715,7 @@ sch = procsched(p); lock(sch); /* Only reliable way to see if we are Running */ - if(p->mach == 0) { + if(p->mach == nil) { p->newtlb = 1; ok = 1; } @@ -776,7 +776,7 @@ p->noteid = incref(¬eidalloc); if(p->pid <= 0 || p->noteid <= 0) panic("pidalloc"); - if(p->kstack == 0) + if(p->kstack == nil) p->kstack = smalloc(KSTACK); /* sched params */ @@ -1038,7 +1038,7 @@ if(dolock) qlock(&p->debug); - if(flag != NUser && (p->notify == 0 || p->notified)) + if(flag != NUser && (p->notify == nil || p->notified)) p->nnote = 0; ret = 0; @@ -1220,8 +1220,8 @@ */ if(up->kp == 0) { p = up->parent; - if(p == 0) { - if(exitstr == 0) + if(p == nil) { + if(exitstr == nil) exitstr = "unknown"; panic("boot process died: %s", exitstr); } @@ -1334,7 +1334,7 @@ } lock(&up->exl); - if(up->nchild == 0 && up->waitq == 0) { + if(up->nchild == 0 && up->waitq == nil) { unlock(&up->exl); error(Enochild); } @@ -1365,7 +1365,7 @@ uintptr bss; char *s; - if(p == 0) + if(p == nil) return; bss = 0; @@ -1375,7 +1375,7 @@ bss = p->seg[BSEG]->top; s = p->psstate; - if(s == 0) + if(s == nil) s = statename[p->state]; print("%3d:%10s pc %#p dbgpc %#p %8s (%s) ut %ld st %ld bss %#p qpc %#p nl %d nd %ud lpc %#p pri %ud\n", p->pid, p->text, p->pc, dbgpc(p), s, statename[p->state], @@ -1457,7 +1457,7 @@ for(sch = run; sch < &run[Nsched]; sch++){ for(rq = &sch->runq[Nrq-1]; rq >= sch->runq; rq--){ - if(rq->head == 0) + if(rq->head == nil) continue; print("sch%ld rq%ld:", sch - run, rq-sch->runq); for(p = rq->head; p; p = p->rnext) @@ -1507,7 +1507,7 @@ kstrdup(&p->user, eve); kstrdup(&p->text, name); - if(kpgrp == 0) + if(kpgrp == nil) kpgrp = newpgrp(); p->pgrp = kpgrp; incref(kpgrp);