~kris/9p

9hist

c29171f5cc1bf04a873066e7355b44d99c8778e3 — David du Colombier 34 years ago 34ec037
Plan 9 from Bell Labs 1991-12-16
M gnot/trap.c => gnot/trap.c +9 -9
@@ 153,13 153,13 @@ notify(Ureg *ur)
		return;

	s = spllo();
	lock(&u->p->debug);
	qlock(&u->p->debug);
	u->p->notepending = 0;
	if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){
		if(u->note[0].flag == NDebug)
			pprint("suicide: %s\n", u->note[0].msg);
    Die:
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pexit(u->note[0].msg, u->note[0].flag!=NDebug);
	}
	if(!u->notified){


@@ 171,7 171,7 @@ notify(Ureg *ur)
		sp -= sizeof(Ureg);
		if(waserror()){
			pprint("suicide: trap in notify\n");
			unlock(&u->p->debug);
			qunlock(&u->p->debug);
			pexit("Suicide", 0);
		}
		validaddr((ulong)u->notify, 1, 0);


@@ 193,7 193,7 @@ notify(Ureg *ur)
		memmove(&u->lastnote, &u->note[0], sizeof(Note));
		memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note));
	}
	unlock(&u->p->debug);
	qunlock(&u->p->debug);
	splx(s);
}



@@ 211,9 211,9 @@ noted(Ureg *ur, ulong arg0)
    Die:
		pexit("Suicide", 0);
	}
	lock(&u->p->debug);
	qlock(&u->p->debug);
	if(!u->notified){
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pprint("call to noted() when not notified\n");
		goto Die;
	}


@@ 223,14 223,14 @@ noted(Ureg *ur, ulong arg0)
	case NCONT:
		if(waserror()){
			pprint("suicide: trap in noted\n");
			unlock(&u->p->debug);
			qunlock(&u->p->debug);
			goto Die;
		}
		validaddr(nur->pc, 1, 0);
		validaddr(nur->usp, BY2WD, 0);
		poperror();
		splhi();
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		rfnote(ur);
		break;
		/* never returns */


@@ 243,7 243,7 @@ noted(Ureg *ur, ulong arg0)
	case NDFLT:
		if(u->lastnote.flag == NDebug)
			pprint("suicide: %s\n", u->lastnote.msg);
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pexit(u->lastnote.msg, u->lastnote.flag!=NDebug);
	}
}

M pc/trap.c => pc/trap.c +9 -9
@@ 361,13 361,13 @@ notify(Ureg *ur)
		return;

	s = spllo();
	lock(&u->p->debug);
	qlock(&u->p->debug);
	u->p->notepending = 0;
	if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){
		if(u->note[0].flag == NDebug)
			pprint("suicide: %s\n", u->note[0].msg);
    Die:
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pexit(u->note[0].msg, u->note[0].flag!=NDebug);
	}
	if(!u->notified){


@@ 380,7 380,7 @@ notify(Ureg *ur)
		sp -= sizeof(Ureg);
		if(waserror()){
			pprint("suicide: trap in notify\n");
			unlock(&u->p->debug);
			qunlock(&u->p->debug);
			pexit("Suicide", 0);
		}
		validaddr((ulong)u->notify, 1, 0);


@@ 401,7 401,7 @@ notify(Ureg *ur)
		memmove(&u->lastnote, &u->note[0], sizeof(Note));
		memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note));
	}
	unlock(&u->p->debug);
	qunlock(&u->p->debug);
	splx(s);
}



@@ 423,10 423,10 @@ noted(Ureg *ur, ulong arg0)
    Die:
		pexit("Suicide", 0);
	}
	lock(&u->p->debug);
	qlock(&u->p->debug);
	if(!u->notified){
		pprint("call to noted() when not notified\n");
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		return;
	}
	u->notified = 0;


@@ 436,13 436,13 @@ noted(Ureg *ur, ulong arg0)
	case NCONT:
		if(waserror()){
			pprint("suicide: trap in noted\n");
			unlock(&u->p->debug);
			qunlock(&u->p->debug);
			goto Die;
		}
		validaddr(nur->pc, 1, 0);
		validaddr(nur->usp, BY2WD, 0);
		poperror();
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		return;

	default:


@@ 453,7 453,7 @@ noted(Ureg *ur, ulong arg0)
	case NDFLT:
		if(u->lastnote.flag == NDebug)
			pprint("suicide: %s\n", u->lastnote.msg);
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pexit(u->lastnote.msg, u->lastnote.flag!=NDebug);
	}
}

M port/alarm.c => port/alarm.c +2 -2
@@ 116,9 116,9 @@ checkalarms(void)
		now = MACHP(0)->ticks;
		while((rp = alarms.head) && rp->alarm <= now){
			if(rp->alarm != 0L){
				if(canlock(&rp->debug)){
				if(canqlock(&rp->debug)){
					postnote(rp, 0, "alarm", NUser);
					unlock(&rp->debug);
					qunlock(&rp->debug);
					rp->alarm = 0L;
				}else
					break;

M port/devproc.c => port/devproc.c +9 -9
@@ 281,9 281,9 @@ procread(Chan *c, void *va, long n, ulong offset)
		return procctlmemio(p, offset, n, va, 1);

	case Qnote:
		lock(&p->debug);
		qlock(&p->debug);
		if(waserror()){
			unlock(&p->debug);
			qunlock(&p->debug);
			nexterror();
		}
		if(p->pid != PID(c->qid))


@@ 309,7 309,7 @@ procread(Chan *c, void *va, long n, ulong offset)
			p->notepending = 0;
		kunmap(k);
		poperror();
		unlock(&p->debug);
		qunlock(&p->debug);
		return n;

	case Qproc:


@@ 381,9 381,9 @@ procwrite(Chan *c, void *va, long n, ulong offset)
		return n;
	}

	lock(&p->debug);
	qlock(&p->debug);
	if(waserror()){
		unlock(&p->debug);
		qunlock(&p->debug);
		nexterror();
	}
	if(p->pid != PID(c->qid))


@@ 451,7 451,7 @@ procwrite(Chan *c, void *va, long n, ulong offset)
		error(Egreg);
	}
	poperror();
	unlock(&p->debug);
	qunlock(&p->debug);
	return n;
}



@@ 534,16 534,16 @@ procstopwait(Proc *p, int ctl)
		p->procctl = ctl;
	p->pdbg = u->p;
	pid = p->pid;
	unlock(&p->debug);
	qunlock(&p->debug);
	u->p->psstate = "Stopwait";
	if(waserror()) {
		p->pdbg = 0;
		lock(&p->debug);
		qlock(&p->debug);
		nexterror();
	}
	sleep(&u->p->sleep, procstopped, p);
	poperror();
	lock(&p->debug);
	qlock(&p->debug);
	if(p->pid != pid)
		error(Eprocdied);
}

M port/ipdat.h => port/ipdat.h +1 -0
@@ 377,6 377,7 @@ struct Fragq
	Ipaddr src;
	Ipaddr dst;
	ushort id;
	ulong  age;
};

struct Ipfrag

M port/pgrp.c => port/pgrp.c +3 -3
@@ 95,16 95,16 @@ pgrpnote(Pgrp *pg, char *a, long n, int flag)
	p = proctab(0);
	for(i=0; i<conf.nproc; i++, p++) {
		if(p->pgrp == pg && p->kp == 0) {
			lock(&p->debug);
			qlock(&p->debug);
			if(p->pid==0 || p->pgrp!=pg){
				unlock(&p->debug);
				qunlock(&p->debug);
				continue;
			}
			if(!waserror()){
				postnote(p, 0, buf, flag);
				poperror();
			}
			unlock(&p->debug);
			qunlock(&p->debug);
		}
	}
}

M port/portdat.h => port/portdat.h +1 -1
@@ 529,7 529,7 @@ struct Proc
	short	insyscall;
	int	fpstate;

	Lock	debug;			/* to access debugging elements of User */
	QLock	debug;			/* to access debugging elements of User */
	Proc	*pdbg;			/* the debugging process */
	ulong	procmode;		/* proc device file mode */
	int	hang;			/* hang at next exec for debug */

M port/proc.c => port/proc.c +7 -7
@@ 81,7 81,7 @@ schedinit(void)		/* never returns */
			procalloc.free = p;
		
			unlock(&palloc);
			unlock(&p->debug);
			qunlock(&p->debug);
			unlock(&procalloc);

			p->state = Dead;


@@ 385,11 385,11 @@ postnote(Proc *p, int dolock, char *n, int flag)
	Proc *d, **l;

	if(dolock)
		lock(&p->debug);
		qlock(&p->debug);

	if(p->upage == 0){
		if(dolock)
			unlock(&p->debug);
			qunlock(&p->debug);
		errors("noted process disappeared");
	}



@@ 415,7 415,7 @@ postnote(Proc *p, int dolock, char *n, int flag)
	if(up != u)
		kunmap(k);
	if(dolock)
		unlock(&p->debug);
		qunlock(&p->debug);

	if(r = p->r){		/* assign = */
		/* wake up; can't call wakeup itself because we're racing with it */


@@ 575,7 575,7 @@ pexit(char *exitstr, int freemem)
	/*
	 * sched() cannot wait on these locks
	 */
	lock(&c->debug);
	qlock(&c->debug);
	/* release debuggers */
	if(c->pdbg) {
		wakeup(&c->pdbg->sleep);


@@ 747,12 747,12 @@ procctl(Proc *p)
		state = p->psstate;
		p->psstate = "Stopped";
		/* free a waiting debugger */
		lock(&p->debug);
		qlock(&p->debug);
		if(p->pdbg) {
			wakeup(&p->pdbg->sleep);
			p->pdbg = 0;
		}
		unlock(&p->debug);
		qunlock(&p->debug);
		p->state = Stopped;
		sched();
		p->psstate = state;

M port/stip.c => port/stip.c +2 -0
@@ 212,6 212,7 @@ ipetheroput(Queue *q, Block *bp)
	/* If we dont need to fragment just send it */
	if(len <= ifp->maxmtu) {
		hnputs(eh->length, len-ETHER_HDR);
		hnputs(eh->id, Id++);
		eh->frag[0] = 0;
		eh->frag[1] = 0;
		eh->cksum[0] = 0;


@@ 567,6 568,7 @@ ipfragallo(void)
	fragfree = f->next;
	f->next = flisthead;
	flisthead = f;
	f->age = TK2MS(MACHP(0)->ticks)/1000 + 600;

	qunlock(&fraglock);
	return f;

M port/sturp.c => port/sturp.c +2 -0
@@ 954,6 954,8 @@ urpkproc(void *arg)
{
	Urp *up, *eup;

	USED(arg);

	if(waserror())
		;


M port/sysproc.c => port/sysproc.c +2 -2
@@ 345,12 345,12 @@ sysexec(ulong *arg)
	 */
	flushmmu();
	clearmmucache();
	lock(&p->debug);
	qlock(&p->debug);
	u->nnote = 0;
	u->notify = 0;
	u->notified = 0;
	procsetup(p);
	unlock(&p->debug);
	qunlock(&p->debug);
	if(p->hang)
		p->procctl = Proc_stopme;


M power/devhotrod.c => power/devhotrod.c +3 -0
@@ 235,6 235,7 @@ for(;;) ;
void	 
hotrodcreate(Chan *c, char *name, int omode, ulong perm)
{
	USED(c, name, omode, perm);
	error(Eperm);
}



@@ 452,12 453,14 @@ hotrodwrite(Chan *c, void *buf, long n, ulong offset)
void	 
hotrodremove(Chan *c)
{
	USED(c);
	error(Eperm);
}

void	 
hotrodwstat(Chan *c, char *dp)
{
	USED(c, dp);
	error(Eperm);
}


M power/trap.c => power/trap.c +9 -9
@@ 375,13 375,13 @@ notify(Ureg *ur)
		return;

	s = spllo();
	lock(&u->p->debug);
	qlock(&u->p->debug);
	u->p->notepending = 0;
	if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){
		if(u->note[0].flag == NDebug)
			pprint("suicide: %s\n", u->note[0].msg);
    Die:
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pexit(u->note[0].msg, u->note[0].flag!=NDebug);
	}
	if(!u->notified){


@@ 392,7 392,7 @@ notify(Ureg *ur)
		sp -= sizeof(Ureg);
		if(waserror()){
			pprint("suicide: trap in notify\n");
			unlock(&u->p->debug);
			qunlock(&u->p->debug);
			pexit("Suicide", 0);
		}
		validaddr((ulong)u->notify, 1, 0);


@@ 413,7 413,7 @@ notify(Ureg *ur)
		memmove(&u->lastnote, &u->note[0], sizeof(Note));
		memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note));
	}
	unlock(&u->p->debug);
	qunlock(&u->p->debug);
	splx(s);
}



@@ 431,9 431,9 @@ noted(Ureg **urp, ulong arg0)
    Die:
		pexit("Suicide", 0);
	}
	lock(&u->p->debug);
	qlock(&u->p->debug);
	if(!u->notified){
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pprint("call to noted() when not notified\n");
		goto Die;
	}


@@ 443,14 443,14 @@ noted(Ureg **urp, ulong arg0)
	case NCONT:
		if(waserror()){
			pprint("suicide: trap in noted\n");
			unlock(&u->p->debug);
			qunlock(&u->p->debug);
			goto Die;
		}
		validaddr(nur->pc, 1, 0);
		validaddr(nur->usp, BY2WD, 0);
		poperror();
		splhi();
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		rfnote(urp);
		break;
		/* never returns */


@@ 463,7 463,7 @@ noted(Ureg **urp, ulong arg0)
	case NDFLT:
		if(u->lastnote.flag == NDebug)
			pprint("suicide: %s\n", u->lastnote.msg);
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pexit(u->lastnote.msg, u->lastnote.flag!=NDebug);
	}
}

M ss/trap.c => ss/trap.c +10 -10
@@ 230,17 230,17 @@ notify(Ureg *ur)
		return;

	s = spllo();		/* need to go low as may fault */
	lock(&u->p->debug);
	qlock(&u->p->debug);
	u->p->notepending = 0;
	if(u->nnote==0){
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		return;
	}
	if(u->note[0].flag!=NUser && (u->notified || u->notify==0)){
		if(u->note[0].flag == NDebug)
			pprint("suicide: %s\n", u->note[0].msg);
    Die:
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pexit(u->note[0].msg, u->note[0].flag!=NDebug);
	}
	if(!u->notified){


@@ 251,7 251,7 @@ notify(Ureg *ur)
		sp -= sizeof(Ureg);
		if(waserror()){
			pprint("suicide: trap in notify\n");
			unlock(&u->p->debug);
			qunlock(&u->p->debug);
			pexit("Suicide", 0);
		}
		validaddr((ulong)u->notify, 1, 0);


@@ 274,7 274,7 @@ notify(Ureg *ur)
		memmove(&u->lastnote, &u->note[0], sizeof(Note));
		memmove(&u->note[0], &u->note[1], u->nnote*sizeof(Note));
	}
	unlock(&u->p->debug);
	qunlock(&u->p->debug);
	splx(s);
}



@@ 292,9 292,9 @@ noted(Ureg **urp, ulong arg0)
    Die:
		pexit("Suicide", 0);
	}
	lock(&u->p->debug);
	qlock(&u->p->debug);
	if(!u->notified){
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pprint("call to noted() when not notified\n");
		goto Die;
	}


@@ 304,14 304,14 @@ noted(Ureg **urp, ulong arg0)
	case NCONT:
		if(waserror()){
			pprint("suicide: trap in noted\n");
			unlock(&u->p->debug);
			qunlock(&u->p->debug);
			goto Die;
		}
		validaddr(nur->pc, 1, 0);
		validaddr(nur->usp, BY2WD, 0);
		poperror();
		splhi();
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		rfnote(urp);
		break;
		/* never returns */


@@ 324,7 324,7 @@ noted(Ureg **urp, ulong arg0)
	case NDFLT:
		if(u->lastnote.flag == NDebug)
			pprint("suicide: %s\n", u->lastnote.msg);
		unlock(&u->p->debug);
		qunlock(&u->p->debug);
		pexit(u->lastnote.msg, u->lastnote.flag!=NDebug);
	}
}