eqlock(): use eqlock when interruption is possible

This commit is contained in:
cinap_lenrek 2011-08-11 04:25:51 +02:00
parent c221286579
commit 4ec0e921e5
3 changed files with 13 additions and 12 deletions

View file

@ -370,7 +370,7 @@ procopen(Chan *c, int omode)
} }
p = proctab(SLOT(c->qid)); p = proctab(SLOT(c->qid));
qlock(&p->debug); eqlock(&p->debug);
if(waserror()){ if(waserror()){
qunlock(&p->debug); qunlock(&p->debug);
nexterror(); nexterror();
@ -476,12 +476,13 @@ procwstat(Chan *c, uchar *db, int n)
p = proctab(SLOT(c->qid)); p = proctab(SLOT(c->qid));
nonone(p); nonone(p);
d = nil; d = nil;
eqlock(&p->debug);
if(waserror()){ if(waserror()){
free(d);
qunlock(&p->debug); qunlock(&p->debug);
free(d);
nexterror(); nexterror();
} }
qlock(&p->debug);
if(p->pid != PID(c->qid)) if(p->pid != PID(c->qid))
error(Eprocdied); error(Eprocdied);
@ -503,9 +504,9 @@ procwstat(Chan *c, uchar *db, int n)
if(d->mode != ~0UL) if(d->mode != ~0UL)
p->procmode = d->mode&0777; p->procmode = d->mode&0777;
qunlock(&p->debug);
poperror(); poperror();
free(d); free(d);
qunlock(&p->debug);
return n; return n;
} }
@ -563,7 +564,7 @@ procfds(Proc *p, char *va, int count, long offset)
count = sizeof buf; count = sizeof buf;
a = buf; a = buf;
qlock(&p->debug); eqlock(&p->debug);
f = p->fgrp; f = p->fgrp;
if(f == nil){ if(f == nil){
qunlock(&p->debug); qunlock(&p->debug);
@ -721,7 +722,7 @@ procread(Chan *c, void *va, long n, vlong off)
switch(QID(c->qid)){ switch(QID(c->qid)){
case Qargs: case Qargs:
qlock(&p->debug); eqlock(&p->debug);
j = procargs(p, up->genbuf, sizeof up->genbuf); j = procargs(p, up->genbuf, sizeof up->genbuf);
qunlock(&p->debug); qunlock(&p->debug);
if(offset >= j) if(offset >= j)
@ -776,7 +777,7 @@ procread(Chan *c, void *va, long n, vlong off)
return n; return n;
case Qnote: case Qnote:
qlock(&p->debug); eqlock(&p->debug);
if(waserror()){ if(waserror()){
qunlock(&p->debug); qunlock(&p->debug);
nexterror(); nexterror();
@ -929,7 +930,7 @@ procread(Chan *c, void *va, long n, vlong off)
return n; return n;
case Qns: case Qns:
qlock(&p->debug); eqlock(&p->debug);
if(waserror()){ if(waserror()){
qunlock(&p->debug); qunlock(&p->debug);
nexterror(); nexterror();
@ -1035,7 +1036,7 @@ procwrite(Chan *c, void *va, long n, vlong off)
return n; return n;
} }
qlock(&p->debug); eqlock(&p->debug);
if(waserror()){ if(waserror()){
qunlock(&p->debug); qunlock(&p->debug);
nexterror(); nexterror();

View file

@ -57,7 +57,7 @@ logread(Log *alog, void *a, ulong, long n)
int i, d; int i, d;
char *p, *rptr; char *p, *rptr;
qlock(&alog->readq); eqlock(&alog->readq);
if(waserror()){ if(waserror()){
qunlock(&alog->readq); qunlock(&alog->readq);
nexterror(); nexterror();

View file

@ -328,7 +328,7 @@ unionread(Chan *c, void *va, long n)
Mhead *m; Mhead *m;
Mount *mount; Mount *mount;
qlock(&c->umqlock); eqlock(&c->umqlock);
m = c->umh; m = c->umh;
rlock(&m->lock); rlock(&m->lock);
mount = m->mount; mount = m->mount;
@ -368,7 +368,7 @@ unionread(Chan *c, void *va, long n)
static void static void
unionrewind(Chan *c) unionrewind(Chan *c)
{ {
qlock(&c->umqlock); eqlock(&c->umqlock);
c->uri = 0; c->uri = 0;
if(c->umc){ if(c->umc){
cclose(c->umc); cclose(c->umc);