~kris/9p

9hist

e3499bf2644fde4bcb101defd11e9f6a3592b1aa — David du Colombier 35 years ago 48620e7
Plan 9 from Bell Labs 1990-11-28
4 files changed, 31 insertions(+), 11 deletions(-)

M gnot/devproc.c
M gnot/main.c
M gnot/stream.c
M port/devproc.c
M gnot/devproc.c => gnot/devproc.c +2 -5
@@ 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

M gnot/main.c => gnot/main.c +1 -1
@@ 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;

M gnot/stream.c => gnot/stream.c +26 -0
@@ 1076,11 1076,34 @@ streamread(Chan *c, void *vbuf, long n)
}

/*
 *  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;

M port/devproc.c => port/devproc.c +2 -5
@@ 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