M carrera/kbd.c => carrera/kbd.c +2 -0
@@ 356,6 356,8 @@ kbdinit(void)
int i;
kbdq = qopen(4*1024, 0, 0, 0);
+ if(kbdq == nil)
+ panic("kbdinit");
qnoblock(kbdq, 1);
/*
M ip/devip.c => ip/devip.c +2 -7
@@ 470,14 470,9 @@ ipread(Chan *ch, void *a, long n, ulong offset)
sprint(buf, "%s/%d %d %s \n", c->p->name, c->x, c->inuse, statename);
return readstr(offset, p, n, buf);
case Qdata:
-{int xxx;
-poot("ipread 1", 0);
c = fs.p[PROTO(ch->qid)]->conv[CONV(ch->qid)];
-// return qread(c->rq, a, n);
- xxx = qread(c->rq, a, n);
-poot("ipread 2", 0);
- return xxx;
-}
+ return qread(c->rq, a, n);
+
case Qerr:
c = fs.p[PROTO(ch->qid)]->conv[CONV(ch->qid)];
return qread(c->eq, a, n);
M pc/devether.c => pc/devether.c +2 -0
@@ 378,6 378,8 @@ etherreset(void)
if(ether->oq == 0)
ether->oq = qopen(64*1024, 1, 0, 0);
}
+ if(ether->oq == 0)
+ panic("etherreset %s", name);
ether->alen = Eaddrlen;
memmove(ether->addr, ether->ea, Eaddrlen);
memset(ether->bcast, 0xFF, Eaddrlen);
M pc/kbd.c => pc/kbd.c +2 -0
@@ 380,6 380,8 @@ kbdinit(void)
int c;
kbdq = qopen(4*1024, 0, 0, 0);
+ if(kbdq == nil)
+ panic("kbdinit");
qnoblock(kbdq, 1);
intrenable(VectorKBD, i8042intr, 0, BUSUNKNOWN);
M port/alloc.c => port/alloc.c +18 -0
@@ 601,3 601,21 @@ poolcompact(Pool *pool)
return compacted;
}
+
+int
+recur(Bhdr *t)
+{
+ if(t == 0)
+ return 1;
+ if(((ulong)t) < 0x80000000)
+ return 0;
+ if(((ulong)t) > 0x90000000)
+ return 0;
+ return recur(t->right) && recur(t->left);
+}
+
+int
+poolok(void)
+{
+ return recur(mainmem->root);
+}
M port/devcons.c => port/devcons.c +2 -0
@@ 37,6 37,8 @@ void
printinit(void)
{
lineq = qopen(2*1024, 0, 0, 0);
+ if(lineq == nil)
+ panic("printinit");
qnoblock(lineq, 1);
}
M port/devmnt.c => port/devmnt.c +0 -2
@@ 696,12 696,10 @@ mountio(Mnt *m, Mntrpc *r)
}
m->rip = up;
unlock(m);
-poot("M1", m->c->qid.path);
while(r->done == 0) {
mntrpcread(m, r);
mountmux(m, r);
}
-poot("M2", m->c->qid.path);
mntgate(m);
}
M port/devns16552.c => port/devns16552.c +2 -0
@@ 480,6 480,8 @@ ns16552setup0(Uart *p)
p->iq = qopen(4*1024, 0, ns16552flow, p);
p->oq = qopen(4*1024, 0, ns16552kick, p);
+ if(p->iq == nil || p->oq == nil)
+ panic("ns16552setup0");
p->ip = p->istage;
p->ie = &p->istage[Stagesize];
M port/netif.c => port/netif.c +11 -5
@@ 387,17 387,23 @@ openfile(Netif *nif, int id)
}
qlock(nif);
+ if(waserror()){
+ qunlock(nif);
+ nexterror();
+ }
efp = &nif->f[nif->nfile];
for(fp = nif->f; fp < efp; fp++){
f = *fp;
if(f == 0){
f = malloc(sizeof(Netfile));
- if(f == 0){
- qunlock(nif);
- error(Enodev);
+ if(f == 0)
+ exhausted("memory");
+ f->in = qopen(nif->limit, 1, 0, 0);
+ if(f->in == nil){
+ free(f);
+ exhausted("memory");
}
*fp = f;
- f->in = qopen(nif->limit, 1, 0, 0);
qlock(f);
} else {
qlock(f);
@@ 411,9 417,9 @@ openfile(Netif *nif, int id)
netown(f, up->user, 0);
qunlock(f);
qunlock(nif);
+ poperror();
return fp - nif->f;
}
- qunlock(nif);
error(Enodev);
return -1; /* not reached */
}
M port/qio.c => port/qio.c +1 -15
@@ 21,7 21,7 @@ static ulong qcopycnt;
static int debuging;
-#define QDEBUG if(1)
+#define QDEBUG if(0)
/*
* IO queues
@@ 115,8 115,6 @@ allocb(int size)
ulong addr;
int n;
- if(size < 0)
- panic("allocb < 0");
n = sizeof(Block) + size + (BY2V-1);
b = mallocz(n+Hdrspc, 0);
if(b == 0)
@@ 150,8 148,6 @@ iallocb(int size)
return 0;
}
- if(size < 0)
- panic("iallocb < 0");
n = sizeof(Block) + size + (BY2V-1);
b = mallocz(n+Hdrspc, 0);
if(b == nil){
@@ 797,7 793,6 @@ qbread(Queue *q, int len)
Block *b, *nb;
int n, dowakeup;
-poot("QB start", len);
qlock(&q->rlock);
if(waserror()){
qunlock(&q->rlock);
@@ 826,12 821,9 @@ poot("QB start", len);
q->state |= Qstarve; /* flag requesting producer to wake me */
iunlock(q);
-poot("QB before sleep", len);
sleep(&q->rr, notempty, q);
-poot("QB after sleep", len);
}
-poot("QB 1", len);
/* remove a buffered block */
q->bfirst = b->next;
b->next = 0;
@@ 848,7 840,6 @@ poot("QB 1", len);
/* split block if it's too big and this is not a message-oriented queue */
nb = b;
-poot("QB 2", len);
if(n > len){
if((q->state&Qmsg) == 0){
iunlock(q);
@@ 879,7 870,6 @@ poot("QB 2", len);
poperror();
qunlock(&q->rlock);
-poot("QB end", nb);
return nb;
}
@@ 892,17 882,13 @@ qread(Queue *q, void *vp, int len)
{
Block *b;
-poot("Q 1", 0);
b = qbread(q, len);
-poot("Q 2", 0);
if(b == 0)
return 0;
len = BLEN(b);
memmove(vp, b->rp, len);
-poot("Q 3", 0);
freeb(b);
-poot("Q 4", 0);
return len;
}
M port/sysfile.c => port/sysfile.c +0 -7
@@ 5,13 5,6 @@
#include "fns.h"
#include "../port/error.h"
-void
-poot(char *s, int d)
-{
- if(up->slash->type<0||up->slash->type>50||(up->slash->flag&COPEN))
- panic("poot: %s %d=%lux\n", s, d, d);
-}
-
/*
* The sys*() routines needn't poperror() as they return directly to syscall().
*/