~kris/9p

9hist

b8f5620387e59e51d65b9b46335611a490cc799b — David du Colombier 35 years ago 79b1750
Plan 9 from Bell Labs 1990-11-15
8 files changed, 54 insertions(+), 25 deletions(-)

M gnot/devpipe.c
M gnot/devproc.c
M gnot/main.c
M gnot/sysproc.c
M port/devpipe.c
M port/devproc.c
M port/page.c
M power/lock.c
M gnot/devpipe.c => gnot/devpipe.c +16 -2
@@ 27,7 27,14 @@ struct Pipealloc
static void pipeiput(Queue*, Block*);
static void pipeoput(Queue*, Block*);
static void pipestclose(Queue *);
Qinfo pipeinfo = { pipeiput, pipeoput, 0, pipestclose, "pipe" };
Qinfo pipeinfo =
{
	pipeiput,
	pipeoput,
	0,
	pipestclose,
	"pipe"
};

Dirtab pipedir[]={
	"data",		Sdataqid,	0,			0600,


@@ 171,7 178,7 @@ pipeopen(Chan *c, int omode)
		 *  pointer from the other stream.
		 */
		if(streamenter(local)<0)
			panic("pipeattach");
			panic("pipeopen");
	}
	unlock(p);
	poperror();


@@ 221,6 228,11 @@ pipeclose(Chan *c)
	Pipe *p;

	p = &pipealloc.pipe[STREAMID(c->qid)/2];
	lock(p);
	if(waserror()){
		unlock(p);
		nexterror();
	}

	/*
	 *  take care of associated streams


@@ 230,6 242,8 @@ pipeclose(Chan *c)
		streamclose(c);		/* close this stream */
		streamexit(remote, 0);	/* release stream for other half of pipe */
	}
	unlock(p);
	poperror();
	pipeexit(p);
}


M gnot/devproc.c => gnot/devproc.c +1 -1
@@ 152,7 152,7 @@ procopen(Chan *c, int omode)
		break;

	case Qnotepg:
		if(omode != OWRITE)
		if(omode!=OWRITE || pg->pgrpid==1)	/* easy to do by mistake */
			error(0, Eperm);
		c->pgrpid = (pg->pgrpid<<PIDSHIFT)|((pg->index+1)<<QSHIFT);
		break;

M gnot/main.c => gnot/main.c +5 -5
@@ 316,10 316,10 @@ confinit(void)
	conf.nmntdev = 10*mul;
	conf.nmntbuf = 2*conf.nmntdev;
	conf.nmnthdr = 2*conf.nmntdev;
	conf.nstream = 64;
	conf.nqueue = 5 * conf.nstream;
	conf.nblock = 32 * conf.nstream;
	conf.nsrv = 32*mul;
	conf.nstream = 40 + 16*mul;		/* was 64 */
	conf.nqueue = 4 * conf.nstream;		/* was 5 */
	conf.nblock = 24 * conf.nstream;	/* was 32 */
	conf.nsrv = 16*mul;			/* was 32 */
	conf.nbitmap = 300*mul;
	conf.nbitbyte = 300*1024*mul;
	if(*(uchar*)MOUSE & (1<<4))


@@ 328,6 328,6 @@ confinit(void)
	conf.nurp = 32;
	conf.nasync = 1;
	conf.npipe = conf.nstream/2;
	conf.nservice = conf.nproc/5;
	conf.nservice = 3*mul;			/* was conf.nproc/5 */
	conf.nfsyschan = 31 + conf.nchan/20;
}

M gnot/sysproc.c => gnot/sysproc.c +8 -2
@@ 533,12 533,18 @@ sysbrk_(ulong *arg)
	Seg *s;

	addr = arg[0];
	if(addr < u->p->bssend)
	if(addr < u->p->bssend){
		pprint("addr below bss\n");
		pexit("Suicide", 0);
		error(0, Esegaddr);
	}
	if(addr <= ((u->p->bssend+(BY2PG-1))&~(BY2PG-1)))	/* still in DSEG */
		goto Return;
	if(segaddr(&u->p->seg[BSEG], u->p->seg[BSEG].minva, arg[0]) == 0)
	if(segaddr(&u->p->seg[BSEG], u->p->seg[BSEG].minva, arg[0]) == 0){
		pprint("bad segaddr in brk\n");
		pexit("Suicide", 0);
		error(0, Esegaddr);
	}
    Return:
	u->p->bssend = addr;
	return 0;

M port/devpipe.c => port/devpipe.c +21 -13
@@ 82,10 82,8 @@ pipeattach(char *spec)
	}
	p = pipealloc.free;
	pipealloc.free = p->next;
	if(++(p->ref) != 1){
		print("pipattach pipe half %d ref %d\n", p - pipealloc.pipe, p->ref);
	if(incref(p) != 1)
		panic("pipeattach");
	}
	unlock(&pipealloc);

	c->qid = CHDIR|STREAMQID(2*(p - pipealloc.pipe), 0);


@@ 210,6 208,19 @@ pipewstat(Chan *c, char *db)
}

void
pipeexit(Pipe *p)
{
	if(decref(p) < 0)
		panic("pipeexit");
	if(p->ref == 0){
		lock(&pipealloc);
		p->next = pipealloc.free;
		pipealloc.free = p;
		unlock(&pipealloc);
	}
}

void
pipeclose(Chan *c)
{
	Stream *remote;


@@ 217,6 228,11 @@ pipeclose(Chan *c)
	Pipe *p;

	p = &pipealloc.pipe[STREAMID(c->qid)/2];
	lock(p);
	if(waserror()){
		unlock(p);
		nexterror();
	}

	/*
	 *  take care of associated streams


@@ 226,17 242,9 @@ pipeclose(Chan *c)
		streamclose(c);		/* close this stream */
		streamexit(remote, 0);	/* release stream for other half of pipe */
	}

	lock(p);
	if(--(p->ref) < 0)
		panic("pipeexit");
	if(p->ref == 0){
		lock(&pipealloc);
		p->next = pipealloc.free;
		pipealloc.free = p;
		unlock(&pipealloc);
	}
	unlock(p);
	poperror();
	pipeexit(p);
}

long

M port/devproc.c => port/devproc.c +1 -1
@@ 155,7 155,7 @@ procopen(Chan *c, int omode)
		break;

	case Qnotepg:
		if(omode != OWRITE)
		if(omode!=OWRITE || pg->pgrpid==1)	/* easy to do by mistake */
			error(0, Eperm);
		c->pgrpid = (pg->pgrpid<<PIDSHIFT)|((pg->index+1)<<QSHIFT);
		break;

M port/page.c => port/page.c +1 -1
@@ 559,7 559,7 @@ segaddr(Seg *s, ulong min, ulong max)
	 * Shrink
	 */
	print("segaddr shrink");
	for(;;);
	pexit("Suicide", 0);
}

/*

M power/lock.c => power/lock.c +1 -0
@@ 72,6 72,7 @@ int addr;
	}
	*sbsem = 0;
	print("lock loop %lux pc %lux held by pc %lux\n", l, ((ulong*)&addr)[-7], l->pc);
dumpstack();
}

int