From c29171f5cc1bf04a873066e7355b44d99c8778e3 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 16 Dec 1991 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1991-12-16 --- gnot/trap.c | 18 +++++++++--------- pc/trap.c | 18 +++++++++--------- port/alarm.c | 4 ++-- port/devproc.c | 18 +++++++++--------- port/ipdat.h | 1 + port/pgrp.c | 6 +++--- port/portdat.h | 2 +- port/proc.c | 14 +++++++------- port/stip.c | 2 ++ port/sturp.c | 2 ++ port/sysproc.c | 4 ++-- power/devhotrod.c | 3 +++ power/trap.c | 18 +++++++++--------- ss/trap.c | 20 ++++++++++---------- 14 files changed, 69 insertions(+), 61 deletions(-) diff --git a/gnot/trap.c b/gnot/trap.c index 5ff598ea7c74f3f489296017f1d594917d9d9bc3..4d044b4f7778da11b8139e3b4d61f5ad04329e58 100644 --- a/gnot/trap.c +++ b/gnot/trap.c @@ -153,13 +153,13 @@ notify(Ureg *ur) return; s = spllo(); - lock(&u->p->debug); + qlock(&u->p->debug); u->p->notepending = 0; if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){ if(u->note[0].flag == NDebug) pprint("suicide: %s\n", u->note[0].msg); Die: - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit(u->note[0].msg, u->note[0].flag!=NDebug); } if(!u->notified){ @@ -171,7 +171,7 @@ notify(Ureg *ur) sp -= sizeof(Ureg); if(waserror()){ pprint("suicide: trap in notify\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit("Suicide", 0); } validaddr((ulong)u->notify, 1, 0); @@ -193,7 +193,7 @@ notify(Ureg *ur) memmove(&u->lastnote, &u->note[0], sizeof(Note)); memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note)); } - unlock(&u->p->debug); + qunlock(&u->p->debug); splx(s); } @@ -211,9 +211,9 @@ noted(Ureg *ur, ulong arg0) Die: pexit("Suicide", 0); } - lock(&u->p->debug); + qlock(&u->p->debug); if(!u->notified){ - unlock(&u->p->debug); + qunlock(&u->p->debug); pprint("call to noted() when not notified\n"); goto Die; } @@ -223,14 +223,14 @@ noted(Ureg *ur, ulong arg0) case NCONT: if(waserror()){ pprint("suicide: trap in noted\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); goto Die; } validaddr(nur->pc, 1, 0); validaddr(nur->usp, BY2WD, 0); poperror(); splhi(); - unlock(&u->p->debug); + qunlock(&u->p->debug); rfnote(ur); break; /* never returns */ @@ -243,7 +243,7 @@ noted(Ureg *ur, ulong arg0) case NDFLT: if(u->lastnote.flag == NDebug) pprint("suicide: %s\n", u->lastnote.msg); - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit(u->lastnote.msg, u->lastnote.flag!=NDebug); } } diff --git a/pc/trap.c b/pc/trap.c index 777b6c04666e4f8913b652a4010c751b888e7012..45d397c3b426e0a40361a433e47050c4310d86ef 100644 --- a/pc/trap.c +++ b/pc/trap.c @@ -361,13 +361,13 @@ notify(Ureg *ur) return; s = spllo(); - lock(&u->p->debug); + qlock(&u->p->debug); u->p->notepending = 0; if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){ if(u->note[0].flag == NDebug) pprint("suicide: %s\n", u->note[0].msg); Die: - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit(u->note[0].msg, u->note[0].flag!=NDebug); } if(!u->notified){ @@ -380,7 +380,7 @@ notify(Ureg *ur) sp -= sizeof(Ureg); if(waserror()){ pprint("suicide: trap in notify\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit("Suicide", 0); } validaddr((ulong)u->notify, 1, 0); @@ -401,7 +401,7 @@ notify(Ureg *ur) memmove(&u->lastnote, &u->note[0], sizeof(Note)); memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note)); } - unlock(&u->p->debug); + qunlock(&u->p->debug); splx(s); } @@ -423,10 +423,10 @@ noted(Ureg *ur, ulong arg0) Die: pexit("Suicide", 0); } - lock(&u->p->debug); + qlock(&u->p->debug); if(!u->notified){ pprint("call to noted() when not notified\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); return; } u->notified = 0; @@ -436,13 +436,13 @@ noted(Ureg *ur, ulong arg0) case NCONT: if(waserror()){ pprint("suicide: trap in noted\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); goto Die; } validaddr(nur->pc, 1, 0); validaddr(nur->usp, BY2WD, 0); poperror(); - unlock(&u->p->debug); + qunlock(&u->p->debug); return; default: @@ -453,7 +453,7 @@ noted(Ureg *ur, ulong arg0) case NDFLT: if(u->lastnote.flag == NDebug) pprint("suicide: %s\n", u->lastnote.msg); - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit(u->lastnote.msg, u->lastnote.flag!=NDebug); } } diff --git a/port/alarm.c b/port/alarm.c index 0bcd44688bc7ba668a6e7b028d2fdc1683be364f..27913a102382fa3a54a8687608c169b8578316cb 100644 --- a/port/alarm.c +++ b/port/alarm.c @@ -116,9 +116,9 @@ checkalarms(void) now = MACHP(0)->ticks; while((rp = alarms.head) && rp->alarm <= now){ if(rp->alarm != 0L){ - if(canlock(&rp->debug)){ + if(canqlock(&rp->debug)){ postnote(rp, 0, "alarm", NUser); - unlock(&rp->debug); + qunlock(&rp->debug); rp->alarm = 0L; }else break; diff --git a/port/devproc.c b/port/devproc.c index 976185d5e8370be0deb6457333063510b0a1e9d3..227eca12e4b2aee784c0a678cd61683ddb8d201a 100644 --- a/port/devproc.c +++ b/port/devproc.c @@ -281,9 +281,9 @@ procread(Chan *c, void *va, long n, ulong offset) return procctlmemio(p, offset, n, va, 1); case Qnote: - lock(&p->debug); + qlock(&p->debug); if(waserror()){ - unlock(&p->debug); + qunlock(&p->debug); nexterror(); } if(p->pid != PID(c->qid)) @@ -309,7 +309,7 @@ procread(Chan *c, void *va, long n, ulong offset) p->notepending = 0; kunmap(k); poperror(); - unlock(&p->debug); + qunlock(&p->debug); return n; case Qproc: @@ -381,9 +381,9 @@ procwrite(Chan *c, void *va, long n, ulong offset) return n; } - lock(&p->debug); + qlock(&p->debug); if(waserror()){ - unlock(&p->debug); + qunlock(&p->debug); nexterror(); } if(p->pid != PID(c->qid)) @@ -451,7 +451,7 @@ procwrite(Chan *c, void *va, long n, ulong offset) error(Egreg); } poperror(); - unlock(&p->debug); + qunlock(&p->debug); return n; } @@ -534,16 +534,16 @@ procstopwait(Proc *p, int ctl) p->procctl = ctl; p->pdbg = u->p; pid = p->pid; - unlock(&p->debug); + qunlock(&p->debug); u->p->psstate = "Stopwait"; if(waserror()) { p->pdbg = 0; - lock(&p->debug); + qlock(&p->debug); nexterror(); } sleep(&u->p->sleep, procstopped, p); poperror(); - lock(&p->debug); + qlock(&p->debug); if(p->pid != pid) error(Eprocdied); } diff --git a/port/ipdat.h b/port/ipdat.h index 1ee0a087538ef7510580e648f3e9a916b9d40034..f27eff99655c8657fba40ad7c78b221348651147 100644 --- a/port/ipdat.h +++ b/port/ipdat.h @@ -377,6 +377,7 @@ struct Fragq Ipaddr src; Ipaddr dst; ushort id; + ulong age; }; struct Ipfrag diff --git a/port/pgrp.c b/port/pgrp.c index 9fbab3dbd89766c02097e530fc03148c3c3a5438..0cbbe7d76cc86e4e9d5e8767b55b2bd7a2c1797c 100644 --- a/port/pgrp.c +++ b/port/pgrp.c @@ -95,16 +95,16 @@ pgrpnote(Pgrp *pg, char *a, long n, int flag) p = proctab(0); for(i=0; ipgrp == pg && p->kp == 0) { - lock(&p->debug); + qlock(&p->debug); if(p->pid==0 || p->pgrp!=pg){ - unlock(&p->debug); + qunlock(&p->debug); continue; } if(!waserror()){ postnote(p, 0, buf, flag); poperror(); } - unlock(&p->debug); + qunlock(&p->debug); } } } diff --git a/port/portdat.h b/port/portdat.h index f363095e62e5ef5cbfd9ab948abb16eb05674a36..19a62855f5b6a88c7495791f7c11df020bd96aa6 100644 --- a/port/portdat.h +++ b/port/portdat.h @@ -529,7 +529,7 @@ struct Proc short insyscall; int fpstate; - Lock debug; /* to access debugging elements of User */ + QLock debug; /* to access debugging elements of User */ Proc *pdbg; /* the debugging process */ ulong procmode; /* proc device file mode */ int hang; /* hang at next exec for debug */ diff --git a/port/proc.c b/port/proc.c index 8bc098975ea7b0cc8e65f42de27ac1104eb4e6b5..31645bb9eb2ee1fbb0c0de0b12926dade43d9435 100644 --- a/port/proc.c +++ b/port/proc.c @@ -81,7 +81,7 @@ schedinit(void) /* never returns */ procalloc.free = p; unlock(&palloc); - unlock(&p->debug); + qunlock(&p->debug); unlock(&procalloc); p->state = Dead; @@ -385,11 +385,11 @@ postnote(Proc *p, int dolock, char *n, int flag) Proc *d, **l; if(dolock) - lock(&p->debug); + qlock(&p->debug); if(p->upage == 0){ if(dolock) - unlock(&p->debug); + qunlock(&p->debug); errors("noted process disappeared"); } @@ -415,7 +415,7 @@ postnote(Proc *p, int dolock, char *n, int flag) if(up != u) kunmap(k); if(dolock) - unlock(&p->debug); + qunlock(&p->debug); if(r = p->r){ /* assign = */ /* wake up; can't call wakeup itself because we're racing with it */ @@ -575,7 +575,7 @@ pexit(char *exitstr, int freemem) /* * sched() cannot wait on these locks */ - lock(&c->debug); + qlock(&c->debug); /* release debuggers */ if(c->pdbg) { wakeup(&c->pdbg->sleep); @@ -747,12 +747,12 @@ procctl(Proc *p) state = p->psstate; p->psstate = "Stopped"; /* free a waiting debugger */ - lock(&p->debug); + qlock(&p->debug); if(p->pdbg) { wakeup(&p->pdbg->sleep); p->pdbg = 0; } - unlock(&p->debug); + qunlock(&p->debug); p->state = Stopped; sched(); p->psstate = state; diff --git a/port/stip.c b/port/stip.c index adec41d52b4936c4877a9c5bd0d71a60f640aa00..85368906e595fb45f532c8ca9e8b407cb4b42838 100644 --- a/port/stip.c +++ b/port/stip.c @@ -212,6 +212,7 @@ ipetheroput(Queue *q, Block *bp) /* If we dont need to fragment just send it */ if(len <= ifp->maxmtu) { hnputs(eh->length, len-ETHER_HDR); + hnputs(eh->id, Id++); eh->frag[0] = 0; eh->frag[1] = 0; eh->cksum[0] = 0; @@ -567,6 +568,7 @@ ipfragallo(void) fragfree = f->next; f->next = flisthead; flisthead = f; + f->age = TK2MS(MACHP(0)->ticks)/1000 + 600; qunlock(&fraglock); return f; diff --git a/port/sturp.c b/port/sturp.c index a445443f7c3694d06a1f1ac591aa3e1c3680288f..5dc060cea1a3b52b6d708df508c74ac6af0e7877 100644 --- a/port/sturp.c +++ b/port/sturp.c @@ -954,6 +954,8 @@ urpkproc(void *arg) { Urp *up, *eup; + USED(arg); + if(waserror()) ; diff --git a/port/sysproc.c b/port/sysproc.c index fd5a5a37420c4bd69eeef9b0a34fe21f3e3510e1..03f2961222745d0642540174d660e66a286368ba 100644 --- a/port/sysproc.c +++ b/port/sysproc.c @@ -345,12 +345,12 @@ sysexec(ulong *arg) */ flushmmu(); clearmmucache(); - lock(&p->debug); + qlock(&p->debug); u->nnote = 0; u->notify = 0; u->notified = 0; procsetup(p); - unlock(&p->debug); + qunlock(&p->debug); if(p->hang) p->procctl = Proc_stopme; diff --git a/power/devhotrod.c b/power/devhotrod.c index d4151abdc6210357200e0a4abe2c1baec932e19a..689bbd31cf79ae6869a1721753e2ea8260543e1b 100644 --- a/power/devhotrod.c +++ b/power/devhotrod.c @@ -235,6 +235,7 @@ for(;;) ; void hotrodcreate(Chan *c, char *name, int omode, ulong perm) { + USED(c, name, omode, perm); error(Eperm); } @@ -452,12 +453,14 @@ hotrodwrite(Chan *c, void *buf, long n, ulong offset) void hotrodremove(Chan *c) { + USED(c); error(Eperm); } void hotrodwstat(Chan *c, char *dp) { + USED(c, dp); error(Eperm); } diff --git a/power/trap.c b/power/trap.c index e485a4672467f58232dc5ef8ed1221b855459d36..fe7ad4434e0bb1d1acea725896fbbe126affae22 100644 --- a/power/trap.c +++ b/power/trap.c @@ -375,13 +375,13 @@ notify(Ureg *ur) return; s = spllo(); - lock(&u->p->debug); + qlock(&u->p->debug); u->p->notepending = 0; if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){ if(u->note[0].flag == NDebug) pprint("suicide: %s\n", u->note[0].msg); Die: - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit(u->note[0].msg, u->note[0].flag!=NDebug); } if(!u->notified){ @@ -392,7 +392,7 @@ notify(Ureg *ur) sp -= sizeof(Ureg); if(waserror()){ pprint("suicide: trap in notify\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit("Suicide", 0); } validaddr((ulong)u->notify, 1, 0); @@ -413,7 +413,7 @@ notify(Ureg *ur) memmove(&u->lastnote, &u->note[0], sizeof(Note)); memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note)); } - unlock(&u->p->debug); + qunlock(&u->p->debug); splx(s); } @@ -431,9 +431,9 @@ noted(Ureg **urp, ulong arg0) Die: pexit("Suicide", 0); } - lock(&u->p->debug); + qlock(&u->p->debug); if(!u->notified){ - unlock(&u->p->debug); + qunlock(&u->p->debug); pprint("call to noted() when not notified\n"); goto Die; } @@ -443,14 +443,14 @@ noted(Ureg **urp, ulong arg0) case NCONT: if(waserror()){ pprint("suicide: trap in noted\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); goto Die; } validaddr(nur->pc, 1, 0); validaddr(nur->usp, BY2WD, 0); poperror(); splhi(); - unlock(&u->p->debug); + qunlock(&u->p->debug); rfnote(urp); break; /* never returns */ @@ -463,7 +463,7 @@ noted(Ureg **urp, ulong arg0) case NDFLT: if(u->lastnote.flag == NDebug) pprint("suicide: %s\n", u->lastnote.msg); - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit(u->lastnote.msg, u->lastnote.flag!=NDebug); } } diff --git a/ss/trap.c b/ss/trap.c index ef14f3cf792822ae9b597679ac5cdd3553f25d9f..f76dff99ff288b9382f7020fbe3ec8496b7c1712 100644 --- a/ss/trap.c +++ b/ss/trap.c @@ -230,17 +230,17 @@ notify(Ureg *ur) return; s = spllo(); /* need to go low as may fault */ - lock(&u->p->debug); + qlock(&u->p->debug); u->p->notepending = 0; if(u->nnote==0){ - unlock(&u->p->debug); + qunlock(&u->p->debug); return; } if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){ if(u->note[0].flag == NDebug) pprint("suicide: %s\n", u->note[0].msg); Die: - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit(u->note[0].msg, u->note[0].flag!=NDebug); } if(!u->notified){ @@ -251,7 +251,7 @@ notify(Ureg *ur) sp -= sizeof(Ureg); if(waserror()){ pprint("suicide: trap in notify\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit("Suicide", 0); } validaddr((ulong)u->notify, 1, 0); @@ -274,7 +274,7 @@ notify(Ureg *ur) memmove(&u->lastnote, &u->note[0], sizeof(Note)); memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note)); } - unlock(&u->p->debug); + qunlock(&u->p->debug); splx(s); } @@ -292,9 +292,9 @@ noted(Ureg **urp, ulong arg0) Die: pexit("Suicide", 0); } - lock(&u->p->debug); + qlock(&u->p->debug); if(!u->notified){ - unlock(&u->p->debug); + qunlock(&u->p->debug); pprint("call to noted() when not notified\n"); goto Die; } @@ -304,14 +304,14 @@ noted(Ureg **urp, ulong arg0) case NCONT: if(waserror()){ pprint("suicide: trap in noted\n"); - unlock(&u->p->debug); + qunlock(&u->p->debug); goto Die; } validaddr(nur->pc, 1, 0); validaddr(nur->usp, BY2WD, 0); poperror(); splhi(); - unlock(&u->p->debug); + qunlock(&u->p->debug); rfnote(urp); break; /* never returns */ @@ -324,7 +324,7 @@ noted(Ureg **urp, ulong arg0) case NDFLT: if(u->lastnote.flag == NDebug) pprint("suicide: %s\n", u->lastnote.msg); - unlock(&u->p->debug); + qunlock(&u->p->debug); pexit(u->lastnote.msg, u->lastnote.flag!=NDebug); } }