From e3499bf2644fde4bcb101defd11e9f6a3592b1aa Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 28 Nov 1990 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1990-11-28 --- gnot/devproc.c | 7 ++----- gnot/main.c | 2 +- gnot/stream.c | 26 ++++++++++++++++++++++++++ port/devproc.c | 7 ++----- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/gnot/devproc.c b/gnot/devproc.c index 0df2184413388f223d752736c4bc426d677aa098..f0da947b85c2ddc02e1029f74d0cd19559709bff 100644 --- a/gnot/devproc.c +++ b/gnot/devproc.c @@ -5,9 +5,6 @@ #include "fns.h" #include "errno.h" -/* BUG mips only TAKE IT OUT */ -#include "io.h" - #include "devtab.h" enum{ @@ -34,7 +31,7 @@ Dirtab procdir[]={ /* * Qids are, in path: * 4 bits of file type (qids above) - * 24 bits of process slot number + 1 + * 23 bits of process slot number + 1 * in vers, * 32 bits of pid, for consistency checking * If notepg, c->pgrpid.path is pgrp slot, .vers is pgrpid. @@ -42,7 +39,7 @@ Dirtab procdir[]={ #define NPROC (sizeof procdir/sizeof(Dirtab)) #define QSHIFT 4 /* location in qid of proc slot # */ #define QID(q) (((q).path&0x0000000F)>>0) -#define SLOT(q) ((((q).path&0x0FFFFFFF0)>>QSHIFT)-1) +#define SLOT(q) ((((q).path&0x07FFFFFF0)>>QSHIFT)-1) #define PID(q) ((q).vers) int diff --git a/gnot/main.c b/gnot/main.c index 88511c7292c4963e8579eff9f5ad603e77b44a86..0cc76537c87f77ca10798d4c55f5bcbe18f72b0d 100644 --- a/gnot/main.c +++ b/gnot/main.c @@ -314,7 +314,7 @@ confinit(void) conf.nmtab = 50*mul; conf.nmount = 80*mul; conf.nmntdev = 10*mul; - conf.nmntbuf = conf.nmntdev; + conf.nmntbuf = conf.nmntdev+3; conf.nmnthdr = 2*conf.nmntdev; conf.nstream = 40 + 32*mul; conf.nqueue = 5 * conf.nstream; diff --git a/gnot/stream.c b/gnot/stream.c index 098facd881ad8329ecdc603fb7a03d1ad85a2763..00ce77f3cc80389fb5a59c967b339266de2fa9fc 100644 --- a/gnot/stream.c +++ b/gnot/stream.c @@ -1075,12 +1075,35 @@ streamread(Chan *c, void *vbuf, long n) return n - left; } +/* + * look for an instance of the line discipline `name' on + * the stream `s' + */ +void +qlook(Stream *s, char *name) +{ + Queue *q; + + for(q = s->procq; q; q = q->next){ + if(strcmp(q->info->name, name) == 0) + return; + + /* + * this may be 2 streams joined device end to device end + */ + if(q == s->devq->other) + break; + } + errors("not found"); +} + /* * Handle a ctl request. Streamwide requests are: * * hangup -- send an M_HANGUP up the stream * push ldname -- push the line discipline named ldname * pop -- pop a line discipline + * look ldname -- look for a line discipline * * This routing is entrered with s->wrlock'ed and must unlock. */ @@ -1116,6 +1139,9 @@ streamctlwrite(Chan *c, void *a, long n) } else if(streamparse("pop", bp)){ popq(s); freeb(bp); + } else if(streamparse("look", bp)){ + qlook(s, (char *)bp->rptr); + freeb(bp); } else { bp->type = M_CTL; bp->flags |= S_DELIM; diff --git a/port/devproc.c b/port/devproc.c index 0df2184413388f223d752736c4bc426d677aa098..f0da947b85c2ddc02e1029f74d0cd19559709bff 100644 --- a/port/devproc.c +++ b/port/devproc.c @@ -5,9 +5,6 @@ #include "fns.h" #include "errno.h" -/* BUG mips only TAKE IT OUT */ -#include "io.h" - #include "devtab.h" enum{ @@ -34,7 +31,7 @@ Dirtab procdir[]={ /* * Qids are, in path: * 4 bits of file type (qids above) - * 24 bits of process slot number + 1 + * 23 bits of process slot number + 1 * in vers, * 32 bits of pid, for consistency checking * If notepg, c->pgrpid.path is pgrp slot, .vers is pgrpid. @@ -42,7 +39,7 @@ Dirtab procdir[]={ #define NPROC (sizeof procdir/sizeof(Dirtab)) #define QSHIFT 4 /* location in qid of proc slot # */ #define QID(q) (((q).path&0x0000000F)>>0) -#define SLOT(q) ((((q).path&0x0FFFFFFF0)>>QSHIFT)-1) +#define SLOT(q) ((((q).path&0x07FFFFFF0)>>QSHIFT)-1) #define PID(q) ((q).vers) int