summaryrefslogtreecommitdiff
path: root/sys/src/9/port/chan.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-10-10 08:22:35 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-10-10 08:22:35 +0200
commit73e7e47d5ba6cb44b159fb0f2cf201b362b6b1b0 (patch)
tree2d05347f0018b6eaed3751780ef05ef673027c9f /sys/src/9/port/chan.c
parentca9f286b6cb434790c2d084117e119b088b49061 (diff)
kenrel: simplify image cache by use of ccloseq()
Diffstat (limited to 'sys/src/9/port/chan.c')
-rw-r--r--sys/src/9/port/chan.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/src/9/port/chan.c b/sys/src/9/port/chan.c
index 61c0dc2e3..ff3b8e5f3 100644
--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -14,7 +14,7 @@ enum
PATHMSLOP = 20,
};
-struct
+static struct Chanalloc
{
Lock;
int fid;
@@ -223,8 +223,10 @@ newchan(void)
lock(&chanalloc);
c = chanalloc.free;
- if(c != 0)
+ if(c != 0){
chanalloc.free = c->next;
+ c->next = 0;
+ }
unlock(&chanalloc);
if(c == nil){
@@ -532,7 +534,7 @@ closechanq(Chan *c)
clunkq.tail = c;
unlock(&clunkq.l);
- if(canqlock(&clunkq.q)){
+ if(up != 0 && palloc.Lock.p != up && canqlock(&clunkq.q)){
c = up->dot;
up->dot = nil;
kproc("closeproc", closeproc, nil);