~kris/9p

9hist

039ea723f4f398ef43a33902d9191cf8f20e0bf8 — David du Colombier 24 years ago cc01e61
Plan 9 from Bell Labs 2002-04-21
5 files changed, 24 insertions(+), 19 deletions(-)

M boot/bootauth.c
M port/devproc.c
M port/qlock.c
M port/sysproc.c
M port/taslock.c
M boot/bootauth.c => boot/bootauth.c +1 -1
@@ 13,7 13,7 @@ authentication(int cpuflag)
	char *argv[16], **av;
	int ac;

	if(access("/factotum", 0) < 0){
	if(access("/factotum", 05) < 0){
		glenda();
		return;
	}

M port/devproc.c => port/devproc.c +15 -5
@@ 418,7 418,14 @@ procfds(Proc *p, char *va, int count, long offset)
{
	Fgrp *f;
	Chan *c;
	char buf[256];
	int n, i, w, ww;
	char *a;

	/* print to buf to avoid holding fgrp lock while writing to user space */
	if(count > sizeof buf)
		count = sizeof buf;
	a = buf;

	qlock(&p->debug);
	f = p->fgrp;


@@ 433,9 440,9 @@ procfds(Proc *p, char *va, int count, long offset)
		nexterror();
	}

	n = readstr(0, va, count, p->dot->name->s);
	n += snprint(va+n, count-n, "\n");
	offset = procoffset(offset, va, &n);
	n = readstr(0, a, count, p->dot->name->s);
	n += snprint(a+n, count-n, "\n");
	offset = procoffset(offset, a, &n);
	/* compute width of qid.path */
	w = 0;
	for(i = 0; i <= f->maxfd; i++) {


@@ 450,13 457,16 @@ procfds(Proc *p, char *va, int count, long offset)
		c = f->fd[i];
		if(c == nil)
			continue;
		n += procfdprint(c, i, w, va+n, count-n);
		offset = procoffset(offset, va, &n);
		n += procfdprint(c, i, w, a+n, count-n);
		offset = procoffset(offset, a, &n);
	}
	unlock(f);
	qunlock(&p->debug);
	poperror();

	/* copy result to user space, now that locks are released */
	memmove(va, buf, n);

	return n;
}


M port/qlock.c => port/qlock.c +6 -11
@@ 13,7 13,6 @@ struct {
	ulong qlockq;
} rwstats;

int shutup=1;	/* RSC: you can take this out, it's just to silence a print in a loop on the dist floppy */
void
qlock(QLock *q)
{


@@ 21,14 20,10 @@ qlock(QLock *q)

	if(up == 0)
		panic("qlock");
	if(m->ilockdepth != 0 && !shutup){
	if(m->ilockdepth != 0)
		print("qlock: %lux: ilockdepth %d", getcallerpc(&q), m->ilockdepth);
		shutup = 1;
	}
	if(up->nlocks && !shutup){
		print("qlock: %lux: nlocks %d", getcallerpc(&q), up->nlocks);
		shutup = 1;
	}
	if(up->nlocks)
		print("qlock: %lux: nlocks %lud", getcallerpc(&q), up->nlocks);

	lock(&q->use);
	rwstats.qlock++;


@@ 48,7 43,7 @@ qlock(QLock *q)
	up->state = Queueing;
	up->qpc = getcallerpc(&q);
	unlock(&q->use);
	if (isedf(up))
	if(isedf(up))
		edfblock(up);
	sched();
}


@@ 74,7 69,7 @@ qunlock(QLock *q)

	lock(&q->use);
	p = q->head;
	if(p) {
	if(p){
		q->head = p->qnext;
		if(q->head == 0)
			q->tail = 0;


@@ 214,7 209,7 @@ wunlock(RWlock *q)
	unlock(&q->use);
}

/* same as rlock but punts if there are any readers waiting */
/* same as rlock but punts if there are any writers waiting */
int
canrlock(RWlock *q)
{

M port/sysproc.c => port/sysproc.c +0 -1
@@ 14,7 14,6 @@ Ref sysr1ref;
long
sysr1(ulong *arg)
{
	int x;
	long a;

	a = *arg;

M port/taslock.c => port/taslock.c +2 -1
@@ 96,8 96,8 @@ ilock(Lock *l)
	lockstats.locks++;

	x = splhi();
	m->ilockdepth++;
	if(tas(&l->key) == 0){
		m->ilockdepth++;
		if(up)
			up->lastlock = l;
		l->sr = x;


@@ 120,6 120,7 @@ ilock(Lock *l)
			;
		x = splhi();
		if(tas(&l->key) == 0){
			m->ilockdepth++;
			if(up)
				up->lastlock = l;
			l->sr = x;