Browse Source

Plan 9 from Bell Labs 2004-02-13

David du Colombier 17 years ago
parent
commit
45d172aeb1

+ 8 - 8
dist/replica/plan9.db

@@ -401,7 +401,7 @@
 386/bin/sum - 775 sys sys 1064598321 40087
 386/bin/swap - 775 sys sys 1064598322 60601
 386/bin/syscall - 775 sys sys 1064598322 72383
-386/bin/tail - 775 sys sys 1064598323 64637
+386/bin/tail - 775 sys sys 1076644755 64896
 386/bin/tar - 775 sys sys 1070342463 81040
 386/bin/tbl - 775 sys sys 1064598324 111550
 386/bin/tcs - 775 sys sys 1064598326 256771
@@ -5216,7 +5216,7 @@ sys/src/9/boot/testboot.c - 664 sys sys 1039763734 496
 sys/src/9/ip - 20000000775 sys sys 1015278450 0
 sys/src/9/ip/arp.c - 664 sys sys 1047951324 10671
 sys/src/9/ip/chandial.c - 664 sys sys 1022588098 2276
-sys/src/9/ip/devip.c - 664 sys sys 1074086743 24188
+sys/src/9/ip/devip.c - 664 sys sys 1076612254 24155
 sys/src/9/ip/eipconvtest.c - 664 sys sys 1022588098 3135
 sys/src/9/ip/esp.c - 664 sys sys 1047260561 17084
 sys/src/9/ip/ethermedium.c - 664 sys sys 1066514880 15124
@@ -5242,7 +5242,7 @@ sys/src/9/ip/nullmedium.c - 664 sys sys 1022588099 491
 sys/src/9/ip/pktmedium.c - 664 sys sys 1045063516 1355
 sys/src/9/ip/ptclbsum.c - 664 sys sys 1022588099 1243
 sys/src/9/ip/rudp.c - 664 sys sys 1055700790 21415
-sys/src/9/ip/tcp.c - 664 sys sys 1071335383 65391
+sys/src/9/ip/tcp.c - 664 sys sys 1076613357 65462
 sys/src/9/ip/tripmedium.c - 664 sys sys 1045063515 7136
 sys/src/9/ip/udp.c - 664 sys sys 1055700791 13069
 sys/src/9/mkfile - 664 sys sys 1063857477 205
@@ -5306,7 +5306,7 @@ sys/src/9/pc/ether8003.c - 664 sys sys 1015014516 6665
 sys/src/9/pc/ether8139.c - 664 sys sys 1071245462 18026
 sys/src/9/pc/ether82543gc.c - 664 sys sys 1055689887 32296
 sys/src/9/pc/ether82557.c - 664 sys sys 1066514925 29683
-sys/src/9/pc/ether83815.c - 664 sys sys 1026847640 23050
+sys/src/9/pc/ether83815.c - 664 sys sys 1076594631 23182
 sys/src/9/pc/ether8390.c - 664 sys sys 1071245462 17557
 sys/src/9/pc/ether8390.h - 664 sys sys 1015014517 1511
 sys/src/9/pc/etherec2t.c - 664 sys sys 1020284820 4038
@@ -5415,12 +5415,12 @@ sys/src/9/port/devdup.c - 664 sys sys 1014931172 2332
 sys/src/9/port/devenv.c - 664 sys sys 1048644225 6992
 sys/src/9/port/devfs.c - 664 sys sys 1067722764 10760
 sys/src/9/port/devkprof.c - 664 sys sys 1014931173 3111
-sys/src/9/port/devloopback.c - 664 sys sys 1067722759 14670
+sys/src/9/port/devloopback.c - 664 sys sys 1076612248 14573
 sys/src/9/port/devmnt.c - 664 sys sys 1067953214 21594
 sys/src/9/port/devmntstats.c - 664 sys sys 1014931173 4039
 sys/src/9/port/devmouse.c - 664 sys sys 1067722758 12203
 sys/src/9/port/devnmouse.c - 664 sys sys 1036812999 3738
-sys/src/9/port/devpipe.c - 664 sys sys 1032640439 5825
+sys/src/9/port/devpipe.c - 664 sys sys 1076612247 5576
 sys/src/9/port/devpnp.c - 664 sys sys 1055688361 13021
 sys/src/9/port/devproc.c - 664 sys sys 1074785145 28636
 sys/src/9/port/devrealtime.c - 664 sys sys 1055688366 16209
@@ -5432,7 +5432,7 @@ sys/src/9/port/devsrv.c - 664 sys sys 1063856594 5197
 sys/src/9/port/devssl.c - 664 sys sys 1045063590 26100
 sys/src/9/port/devtinyfs.c - 664 sys sys 1015278339 15347
 sys/src/9/port/devtls.c - 664 sys sys 1066737478 45222
-sys/src/9/port/devuart.c - 664 sys sys 1067722718 11683
+sys/src/9/port/devuart.c - 664 sys sys 1076612247 11328
 sys/src/9/port/edf.c - 664 sys sys 1072704672 12331
 sys/src/9/port/edf.h - 664 sys sys 1074883055 1145
 sys/src/9/port/error.h - 664 sys sys 1055700517 2630
@@ -10390,7 +10390,7 @@ sys/src/cmd/swap.c - 664 sys sys 1014926662 1141
 sys/src/cmd/syscall - 20000000775 sys sys 944961236 0
 sys/src/cmd/syscall/mkfile - 664 sys sys 1037122264 549
 sys/src/cmd/syscall/syscall.c - 664 sys sys 1036972051 3927
-sys/src/cmd/tail.c - 664 sys sys 1014926615 5715
+sys/src/cmd/tail.c - 664 sys sys 1076614068 5990
 sys/src/cmd/tapefs - 20000000775 sys sys 944962012 0
 sys/src/cmd/tapefs/32vfs.c - 664 sys sys 1014926384 3688
 sys/src/cmd/tapefs/cpiofs.c - 664 sys sys 1014926384 2493

+ 8 - 0
dist/replica/plan9.log

@@ -13813,3 +13813,11 @@
 1076385677 6 c 386/bin/vacfs - 775 sys sys 1076385622 178117
 1076385677 7 c 386/lib/libcomplete.a - 664 sys sys 1076385623 6210
 1076459489 0 c rc/bin/fshalt - 775 sys sys 1076458748 1315
+1076596315 0 c sys/src/9/pc/ether83815.c - 664 sys sys 1076594631 23182
+1076612518 0 c sys/src/9/ip/devip.c - 664 sys sys 1076612254 24155
+1076612518 1 c sys/src/9/port/devloopback.c - 664 sys sys 1076612248 14573
+1076612518 2 c sys/src/9/port/devpipe.c - 664 sys sys 1076612247 5576
+1076612518 3 c sys/src/9/port/devuart.c - 664 sys sys 1076612247 11328
+1076614318 0 c sys/src/9/ip/tcp.c - 664 sys sys 1076613357 65462
+1076614318 1 c sys/src/cmd/tail.c - 664 sys sys 1076614068 5990
+1076644923 0 c 386/bin/tail - 775 sys sys 1076644755 64896

+ 3 - 3
sys/src/9/ip/devip.c

@@ -79,10 +79,10 @@ ip3gen(Chan *c, int i, Dir *dp)
 		devdir(c, q, "ctl", 0, cv->owner, cv->perm, dp);
 		return 1;
 	case Qdata:
-		devdir(c, q, "data", qlen(cv->rq), cv->owner, cv->perm, dp);
+		devdir(c, q, "data", 0, cv->owner, cv->perm, dp);
 		return 1;
 	case Qerr:
-		devdir(c, q, "err", qlen(cv->eq), cv->owner, cv->perm, dp);
+		devdir(c, q, "err", 0, cv->owner, cv->perm, dp);
 		return 1;
 	case Qlisten:
 		devdir(c, q, "listen", 0, cv->owner, cv->perm, dp);
@@ -96,7 +96,7 @@ ip3gen(Chan *c, int i, Dir *dp)
 	case Qsnoop:
 		if(strcmp(cv->p->name, "ipifc") != 0)
 			return -1;
-		devdir(c, q, "snoop", qlen(cv->sq), cv->owner, 0400, dp);
+		devdir(c, q, "snoop", 0, cv->owner, 0400, dp);
 		return 1;
 	case Qstatus:
 		p = "status";

+ 5 - 2
sys/src/9/ip/tcp.c

@@ -447,8 +447,11 @@ tcpstate(Conv *c, char *state, int n)
 	s = (Tcpctl*)(c->ptcl);
 
 	return snprint(state, n,
-		"%s srtt %d mdev %d cwin %lud swin %lud>>%d rwin %lud>>%d timer.start %d timer.count %d rerecv %d katimer.start %d katimer.count %d\n",
-		tcpstates[s->state], s->srtt, s->mdev,
+		"%s qin %d qout %d srtt %d mdev %d cwin %lud swin %lud>>%d rwin %lud>>%d timer.start %d timer.count %d rerecv %d katimer.start %d katimer.count %d\n",
+		tcpstates[s->state],
+		c->rq ? qlen(c->rq) : 0,
+		c->wq ? qlen(c->wq) : 0,
+		s->srtt, s->mdev,
 		s->cwind, s->snd.wnd, s->rcv.scale, s->rcv.wnd, s->snd.scale,
 		s->timer.start, s->timer.count, s->rerecv,
 		s->katimer.start, s->katimer.count);

+ 7 - 0
sys/src/9/pc/ether83815.c

@@ -850,6 +850,12 @@ scanpci83815(void)
 	}
 }
 
+/* multicast already on, don't need to do anything */
+static void
+multicast(void*, uchar*, int)
+{
+}
+
 static int
 reset(Ether* ether)
 {
@@ -949,6 +955,7 @@ reset(Ether* ether)
 	ether->transmit = transmit;
 	ether->interrupt = interrupt;
 	ether->ifstat = ifstat;
+	ether->multicast = multicast;
 
 	ether->arg = ether;
 	ether->promiscuous = promiscuous;

+ 0 - 5
sys/src/9/port/devloopback.c

@@ -177,7 +177,6 @@ loopbackattach(char *spec)
 static int
 loopbackgen(Chan *c, char*, Dirtab*, int, int i, Dir *dp)
 {
-	Loop *lb;
 	Dirtab *tab;
 	int len, type;
 	Qid qid;
@@ -234,10 +233,6 @@ loopbackgen(Chan *c, char*, Dirtab*, int, int i, Dir *dp)
 		if(tab == nil)
 			panic("loopbackgen: unknown type: %d", type);
 		len = tab->length;
-		if(type == Qdata){
-			lb = c->aux;
-			len = qlen(lb->link[ID(c->qid.path)].iq);
-		}
 		devdir(c, c->qid, tab->name, len, eve, tab->perm, dp);
 		return 1;
 	}

+ 3 - 20
sys/src/9/port/devpipe.c

@@ -91,8 +91,6 @@ static int
 pipegen(Chan *c, char*, Dirtab *tab, int ntab, int i, Dir *dp)
 {
 	Qid q;
-	int len;
-	Pipe *p;
 
 	if(i == DEVDOTDOT){
 		devdir(c, c->qid, "#|", 0, eve, DMDIR|0555, dp);
@@ -103,20 +101,8 @@ pipegen(Chan *c, char*, Dirtab *tab, int ntab, int i, Dir *dp)
 		return -1;
 
 	tab += i;
-	p = c->aux;
-	switch((ulong)tab->qid.path){
-	case Qdata0:
-		len = qlen(p->q[0]);
-		break;
-	case Qdata1:
-		len = qlen(p->q[1]);
-		break;
-	default:
-		len = tab->length;
-		break;
-	}
 	mkqid(&q, NETQID(NETID(c->qid.path), tab->qid.path), 0, QTFILE);
-	devdir(c, q, tab->name, len, eve, tab->perm, dp);
+	devdir(c, q, tab->name, 0, eve, tab->perm, dp);
 	return 1;
 }
 
@@ -151,20 +137,17 @@ pipewalk(Chan *c, Chan *nc, char **name, int nname)
 static int
 pipestat(Chan *c, uchar *db, int n)
 {
-	Pipe *p;
 	Dir dir;
 
-	p = c->aux;
-
 	switch(NETTYPE(c->qid.path)){
 	case Qdir:
 		devdir(c, c->qid, ".", 0, eve, DMDIR|0555, &dir);
 		break;
 	case Qdata0:
-		devdir(c, c->qid, "data", qlen(p->q[0]), eve, 0600, &dir);
+		devdir(c, c->qid, "data", 0, eve, 0600, &dir);
 		break;
 	case Qdata1:
-		devdir(c, c->qid, "data1", qlen(p->q[1]), eve, 0600, &dir);
+		devdir(c, c->qid, "data1", 0, eve, 0600, &dir);
 		break;
 	default:
 		panic("pipestat");

+ 0 - 18
sys/src/9/port/devuart.c

@@ -139,21 +139,6 @@ uartsetmouseputc(Uart* p, int (*putc)(Queue*, int))
 	qunlock(p);
 }
 
-static void
-setlength(int i)
-{
-	Uart *p;
-
-	if(i > 0){
-		p = uart[i];
-		if(p && p->opens && p->iq)
-			uartdir[1+3*i].length = qlen(p->iq);
-	} else for(i = 0; i < uartnuart; i++){
-		p = uart[i];
-		if(p && p->opens && p->iq)
-			uartdir[1+3*i].length = qlen(p->iq);
-	}
-}
 
 /*
  *  set up the '#t' directory
@@ -247,8 +232,6 @@ uartwalk(Chan *c, Chan *nc, char **name, int nname)
 static int
 uartstat(Chan *c, uchar *dp, int n)
 {
-	if(NETTYPE(c->qid.path) == Ndataqid)
-		setlength(NETID(c->qid.path));
 	return devstat(c, dp, n, uartdir, uartndir, devgen);
 }
 
@@ -342,7 +325,6 @@ uartread(Chan *c, void *buf, long n, vlong off)
 	ulong offset = off;
 
 	if(c->qid.type & QTDIR){
-		setlength(-1);
 		return devdirread(c, buf, n, uartdir, uartndir, devgen);
 	}
 

+ 19 - 1
sys/src/cmd/tail.c

@@ -43,6 +43,7 @@ extern	void	trunc(Dir*, Dir**);
 extern	long	tseek(long, int);
 extern	void	twrite(char*, long);
 extern	void	usage(void);
+static	int	isseekable(int fd);
 
 #define JUMP(o,p) tseek(o,p), copy()
 
@@ -91,7 +92,7 @@ main(int argc, char **argv)
 		usage();
 	if(argc > 1 && (file=open(argv[1],0)) < 0)
 		fatal(argv[1]);
-	seekable = seek(file,0L,0) == 0;
+	seekable = isseekable(file);
 
 	if(!seekable && origin==END)
 		keep();
@@ -360,3 +361,20 @@ usage(void)
 	fprint(2, "%s\n", umsg);
 	exits("usage");
 }
+
+/* return true if seeks work and if the file is > 0 length */
+static int
+isseekable(int fd)
+{	
+	vlong m, n;
+
+	m = seek(fd, 0, 1);
+	if(m < 0)
+		return 0;
+	n = seek(fd, 0, 2);
+	if(n <= 0)
+		return 0;
+	if(seek(fd, m, 0) < 0)
+		return 0;
+	return 1;
+}