From 14fdc3cf210a7ae4044d09283ea4633f1a40d181 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 11 Nov 1993 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1993-11-11 --- port/chan.c | 2 +- port/devpipe.c | 49 +++++++++++++++++++++++++++++++------------------ port/sysfile.c | 2 +- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/port/chan.c b/port/chan.c index 68a90de40adbb27e467b86130a3ac3511da3a132..75043797b040e3f188d061f2cd2a7fbda9d8511e 100644 --- a/port/chan.c +++ b/port/chan.c @@ -263,7 +263,7 @@ unmount(Chan *mnt, Chan *mounted) p = &m->mount; for(f = *p; f; f = f->next) { - if(eqchan(f->to, mounted, 1)) { + if(eqchan(f->to, mounted, 1) || eqchan(f->to->mchan, mounted, 1)) { *p = f->next; f->next = 0; mountfree(f); diff --git a/port/devpipe.c b/port/devpipe.c index 80c7c543914f66c8611ec4488fe157e5bfb3c9b6..11f4e9719189fd71ef7ea7278d57e609b350961d 100644 --- a/port/devpipe.c +++ b/port/devpipe.c @@ -65,7 +65,7 @@ pipeattach(char *spec) exhausted("memory"); p->ref = 1; - p->q[0] = qopen(64*1024, 0, 0, 0); + p->q[0] = qopen(32*1024, 0, 0, 0); if(p->q[0] == 0){ free(p); exhausted("memory"); @@ -98,6 +98,16 @@ pipeclone(Chan *c, Chan *nc) nc = devclone(c, nc); qlock(p); p->ref++; + if(c->flag & COPEN){ + switch(NETTYPE(c->qid.path)){ + case Qdata0: + p->qref[0]++; + break; + case Qdata1: + p->qref[1]++; + break; + } + } qunlock(p); return nc; } @@ -212,26 +222,29 @@ pipeclose(Chan *c) p = c->aux; qlock(p); - /* - * closing either side hangs up the stream - */ - switch(NETTYPE(c->qid.path)){ - case Qdata0: - p->qref[0]--; - if(p->qref[0] == 0){ - qclose(p->q[0]); - qhangup(p->q[1]); - } - break; - case Qdata1: - p->qref[1]--; - if(p->qref[1] == 0){ - qclose(p->q[1]); - qhangup(p->q[0]); + if(c->flag & COPEN){ + /* + * closing either side hangs up the stream + */ + switch(NETTYPE(c->qid.path)){ + case Qdata0: + p->qref[0]--; + if(p->qref[0] == 0){ + qclose(p->q[0]); + qhangup(p->q[1]); + } + break; + case Qdata1: + p->qref[1]--; + if(p->qref[1] == 0){ + qclose(p->q[1]); + qhangup(p->q[0]); + } + break; } - break; } + /* * if both sides are closed, they are reusable */ diff --git a/port/sysfile.c b/port/sysfile.c index 21e97a2c13ed8a036192aa7a5990a92dade2f3db..0f98dc613499c5822bacecceec29c70779bd5303 100644 --- a/port/sysfile.c +++ b/port/sysfile.c @@ -537,7 +537,7 @@ sysunmount(ulong *arg) nexterror(); } validaddr(arg[0], 1, 0); - cmounted = namec((char*)arg[0], Aaccess, 0, 0); + cmounted = namec((char*)arg[0], Aopen, OREAD, 0); poperror(); }