~kris/9p

9hist

4c58d1a330a7380e9a7a1b9fccb17ac045763ecb — David du Colombier 35 years ago 1439de8
Plan 9 from Bell Labs 1991-01-18
9 files changed, 51 insertions(+), 18 deletions(-)

M gnot/main.c
M port/devlance.c
M port/devnonet.c
M port/sysproc.c
M power/dat.h
M power/fns.h
M power/l.s
M ss/dat.h
M ss/fns.h
M gnot/main.c => gnot/main.c +1 -1
@@ 323,7 323,7 @@ confinit(void)
	conf.nmtab = 50*mul;
	conf.nmount = 80*mul;
	conf.nmntdev = 10*mul;
	conf.nmntbuf = conf.nmntdev+3;
	conf.nmntbuf = conf.nmntdev+5;
	conf.nmnthdr = 2*conf.nmntdev;
	conf.nstream = 40 + 32*mul;
	conf.nqueue = 5 * conf.nstream;

M port/devlance.c => port/devlance.c +6 -4
@@ 218,7 218,7 @@ sprintpacket(char *buf, Trace *t)
		p->d[0], p->d[1], p->d[2], p->d[3], p->d[4], p->d[5],
		p->s[0], p->s[1], p->s[2], p->s[3], p->s[4], p->s[5],
		p->type[0], p->type[1]);
	for(i=0; i<16; i++)
	for(i=0; i<sizeof(p->data); i++)
		sprint(buf+strlen(buf), "%.2ux", p->data[i]);
	sprint(buf+strlen(buf), ")\n");
}


@@ 362,10 362,12 @@ lanceoput(Queue *q, Block *bp )
	memcpy(p->s, l.ea, sizeof(l.ea));

	/*
	 *  pad the packet
	 *  pad the packet (zero the pad)
	 */
	if(len < 60)
	if(len < 60){
		memset(((char*)p)+len, 0, 60-len);
		len = 60;
	}

	lancedebq('o', p, len);/**/



@@ 636,7 638,7 @@ lanceclose(Chan *c)
static long
lancetraceread(Chan *c, void *a, long n)
{
	char buf[512];
	char buf[1024];
	long rv;
	int i;
	char *ca = a;

M port/devnonet.c => port/devnonet.c +38 -9
@@ 86,6 86,7 @@ enum {
	Cconnecting,
	Chungup,
	Cclosing,
	Csuperceded,
};

/*


@@ 470,7 471,7 @@ nonetstclose(Queue *q)
	 *  send hangup messages to the other side
	 *  until it hangs up or we get tired.
	 */
	if(cp->state >= Cconnected){
	if(cp->state>=Cconnected && cp->state!=Csuperceded){
		sendctlmsg(cp, NO_HANGUP, 1);
		for(i=0; i<10 && !ishungup(cp); i++){
			sendctlmsg(cp, NO_HANGUP, 1);


@@ 961,6 962,10 @@ sendmsg(Noconv *cp, Nomsg *mp)
	}
	cp->hdr->mid = mp->mid;

	/*
	 *  package n blocks into m packets.  make sure
	 *  no packet is < mintu or > maxtu in length.
	 */
	if(ifc->mintu > mp->len) {
		/*
		 *  short message:


@@ 971,7 976,10 @@ sendmsg(Noconv *cp, Nomsg *mp)
			memcpy(pkt->wptr, bp->rptr, n = BLEN(bp));
			pkt->wptr += n;
		}
		memset(pkt->wptr, 0, n = ifc->mintu - mp->len);
		/*
		 *  round up to mintu
		 */
		memset(pkt->wptr, 0, n = ifc->mintu-mp->len);
		pkt->wptr += n;
	} else {
		/*


@@ 986,6 994,7 @@ sendmsg(Noconv *cp, Nomsg *mp)
		if(bp)
			rptr = bp->rptr;
		last = pkt = mkhdr(cp, msgrem);
		n = 0;
		while(bp){
			/*
			 *  if pkt full, send and create new header block


@@ 1011,11 1020,24 @@ sendmsg(Noconv *cp, Nomsg *mp)
					rptr = bp->rptr;
			}
		}
		/*
		 *  round up last packet to mintu
		 */
		if(n < ifc->mintu){
			n = ifc->mintu - n;
			last = last->next = allocb(n);
			memset(last->wptr, 0, n);
			last->wptr += n;
		}
	}
	nonetcksum(pkt, ifc->hsize);
	last->flags |= S_DELIM;
	if(cp->rexmit > 10)
		mp->time = NOW + 10*MSrexmit;
	else
		mp->time = NOW + (cp->rexmit+1)*MSrexmit;
	DPRINT("xmit %d %lud %lud\n", cp->rexmit, NOW, mp->time);
	(*wq->put)(wq, pkt);
	mp->time = NOW + MSrexmit;
	qunlock(&cp->xlock);
	poperror();
}


@@ 1067,10 1089,14 @@ nonetrcvmsg(Noconv *cp, Block *bp)
	/*
	 *  if a new call request comes in on a connected channel, hang up the call
	 */
	if(h->mid==0 && (f & NO_NEWCALL) && cp->state==Cconnected){
	if(h->mid==0 && (f & NO_NEWCALL)
	&& (cp->state==Cconnected || cp->state==Csuperceded)){
		DPRINT("new call on connected channel\n"); 
		freeb(bp);
		hangup(cp);
		if(cp->state != Csuperceded){
			cp->state = Csuperceded;
			hangup(cp);
		}
		return;
	}



@@ 1269,6 1295,7 @@ nonetkproc(void *arg)
{
	Noifc *ifc;
	Noconv *cp, *ep;
	Nomsg *mp;

	cp = 0;
	ifc = 0;


@@ 1302,12 1329,14 @@ loop:
			/*
			 *  resend the first message
			 */
			if(cp->first!=cp->next && cp->out[cp->first].time>=NOW){
				if(cp->rexmit++ > 100){
			if(cp->first!=cp->next && NOW>=cp->out[cp->first].time){
				if(cp->rexmit++ > 60){
					print("hanging up\n");
					hangup(cp);
				} else
					sendmsg(cp, &(cp->out[cp->first]));
				} else {
					mp = &(cp->out[cp->first]);
					sendmsg(cp, mp);
				}
			}

			/*

M port/sysproc.c => port/sysproc.c +1 -0
@@ 127,6 127,7 @@ sysfork(ulong *arg)
	p->parentpid = u->p->pid;
	p->pgrp = u->p->pgrp;
	p->bssend = u->p->bssend;
	p->fpstate = u->p->fpstate;
	incref(p->pgrp);
	u->p->nchild++;
	pid = p->pid;

M power/dat.h => power/dat.h +1 -1
@@ 536,7 536,7 @@ struct Nomsg {
	Rendez	r;
	int	mid;		/* sequence number */
	int	rem;		/* remaining */
	long	time;
	ulong	time;
	int	acked;
	int	inuse;
};

M power/fns.h => power/fns.h +1 -1
@@ 215,7 215,7 @@ void	wbflush(void);
/*
 *  no external state to save on the SGI
 */
#define procsetup(x)
#define procsetup(p)	((p)->fpstate = FPinit)
#define procsave(x,y)
#define procrestore(x,y)


M power/l.s => power/l.s +1 -0
@@ 448,6 448,7 @@ TEXT	restfpregs(SB), $0
	OR	$CU1, R3
	MOVW	R3, M(STATUS)
	MOVW	0x80(R1), R2
	NOOP

	MOVD	0x00(R1), F0
	MOVD	0x08(R1), F2

M ss/dat.h => ss/dat.h +1 -1
@@ 549,7 549,7 @@ struct Nomsg {
	Rendez	r;
	int	mid;		/* sequence number */
	int	rem;		/* remaining */
	long	time;
	ulong	time;
	int	acked;
	int	inuse;
};

M ss/fns.h => ss/fns.h +1 -1
@@ 243,7 243,7 @@ Chan	*walk(Chan*, char*, int);
/*
 *  no external state to save on the SPARC
 */
#define procsetup(x)
#define procsetup(x)	((p)->fpstate = FPinit)
#define procsave(x,y)
#define procrestore(x,y)