~kris/9p

9hist

faf1415d45c238b38d182e083c778ac361f7a610 — David du Colombier 28 years ago 2ecdfc6
Plan 9 from Bell Labs 1998-07-24
5 files changed, 29 insertions(+), 12 deletions(-)

M ip/il.c
M ip/tcp.c
M port/devmnt.c
M port/proc.c
M port/segment.c
M ip/il.c => ip/il.c +1 -1
@@ 201,7 201,7 @@ ilstate(Conv *c, char *state, int n)
	Ilcb *ic;

	ic = (Ilcb*)(c->ptcl);
	return snprint(state, n, "%14.14s del %5.5d Br %5.5d md %5.5d una %5.5d rex %5.5d max %5.5d",
	return snprint(state, n, "%s del %5.5d Br %5.5d md %5.5d una %5.5d rex %5.5d max %5.5d",
		ilstates[ic->state],
		ic->delay>>LogAGain, ic->rate>>LogAGain, ic->mdev>>LogDGain,
		ic->unackeduchars, ic->rexmit, ic->maxrtt);

M ip/tcp.c => ip/tcp.c +7 -4
@@ 266,9 266,9 @@ tcpsetstate(Conv *s, uchar newstate)
		qclose(s->rq);
		qclose(s->wq);
		qclose(s->eq);
		s->lport = 0;		/* This connection is toast */
		s->rport = 0;
		ipmove(s->raddr, IPnoaddr);
//		s->lport = 0;		/* This connection is toast */
//		s->rport = 0;
//		ipmove(s->raddr, IPnoaddr);

	case Close_wait:		/* Remote closes */
		qhangup(s->rq, nil);


@@ 1138,8 1138,10 @@ tcpiput(Proto *tcp, uchar*, Block *bp)
	/* Look for a connection. failing that look for a listener. */
	for(p = tcp->conv; *p; p++) {
		s = *p;
		tcb = (Tcpctl*)s->ptcl;
		if(s->rport == seg.source)
		if(s->lport == seg.dest)
		if(tcb->state != Closed)
		if(ipcmp(s->raddr, source) == 0)
			break;
	}


@@ 1931,11 1933,12 @@ tcpadvise(Proto *tcp, Block *bp, char *msg)
	/* Look for a connection */
	for(p = tcp->conv; *p; p++) {
		s = *p;
		tcb = (Tcpctl*)s->ptcl;
		if(s->rport == pdest)
		if(s->lport == psource)
		if(tcb->state != Closed)
		if(ipcmp(s->raddr, dest) == 0)
		if(ipcmp(s->laddr, source) == 0){
			tcb = (Tcpctl*)s->ptcl;
			qlock(tcb);
			switch(tcb->state){
			case Syn_sent:

M port/devmnt.c => port/devmnt.c +3 -2
@@ 1024,7 1024,7 @@ mntrepl(char *buf)
	int fd;
	Mnt *m;
	char *p;
	Chan *c1;
	Chan *c1, *c2;
	Mntrpc *r;

	/* reply from boot is 'fd #M23' */


@@ 1046,7 1046,7 @@ mntrepl(char *buf)
	srvrecover(m->c, c1);

	lock(m);
	cclose(m->c);
	c2 = m->c;
	m->c = c1;
	m->recprog = 0;



@@ 1055,6 1055,7 @@ mntrepl(char *buf)
		wakeup(&r->r);

	unlock(m);
	cclose(c2);
}

Dev mntdevtab = {

M port/proc.c => port/proc.c +1 -1
@@ 384,7 384,7 @@ procinit0(void)		/* bad planning - clashes with devproc.c */

/*
 *  Sleep, postnote, and wakeup are complicated by the
 *  fact that they at least one of them must indirect
 *  fact that at least one of them must indirect
 *  through an unlocked structure to find the synchronizing
 *  lock structure.  This is because sleep()
 *  and wakeup() share direct knowledge only of r while

M port/segment.c => port/segment.c +17 -4
@@ 424,16 424,21 @@ ibrk(ulong addr, int seg)
	return 0;
}

/*
 *  called with s->lk locked
 */
void
mfreeseg(Segment *s, ulong start, int pages)
{
	int i, j;
	ulong soff;
	Page *pg;
	Page *list;

	soff = start-s->base;
	j = (soff&(PTEMAPMEM-1))/BY2PG;

	list = nil;
	for(i = soff/PTEMAPMEM; i < SEGMAPSIZE; i++) {
		if(pages <= 0)
			break;


@@ 444,16 449,24 @@ mfreeseg(Segment *s, ulong start, int pages)
		}
		while(j < PTEPERTAB) {
			pg = s->map[i]->pages[j];
			if(pg) {
				putpage(pg);
			if(pg)
				s->map[i]->pages[j] = 0;
			}
			pg->next = list;
			list = pg;
			if(--pages == 0)
				return;
				goto out;
			j++;
		}
		j = 0;
	}
out:
	/* wait for others to get fix their tlb's and then free the pages */
	if((s->type&SG_TYPE) == SG_SHARED){
	}
	for(pg = list; pg != nil; pg = list){
		list = list->next;
		putpage(pg);
	}
}

int