Browse Source

Plan 9 from Bell Labs 2006-02-01

David du Colombier 15 years ago
parent
commit
eb1d5a9316

+ 6 - 6
dist/replica/_plan9.db

@@ -299,7 +299,7 @@
 386/bin/ip/httpfile - 775 sys sys 1138500622 283922
 386/bin/ip/imap4d - 775 sys sys 1135570825 237651
 386/bin/ip/ipconfig - 775 sys sys 1135570825 137844
-386/bin/ip/ping - 775 sys sys 1135570826 76416
+386/bin/ip/ping - 775 sys sys 1138730269 76405
 386/bin/ip/ppp - 775 sys sys 1135570826 219950
 386/bin/ip/pppoe - 775 sys sys 1135570826 77544
 386/bin/ip/pptp - 775 sys sys 1138500632 127014
@@ -416,7 +416,7 @@
 386/bin/swap - 775 sys sys 1135570847 62130
 386/bin/syscall - 775 sys sys 1130594788 73568
 386/bin/tail - 775 sys sys 1135570847 66163
-386/bin/tar - 775 sys sys 1135570847 93423
+386/bin/tar - 775 sys sys 1138723507 93772
 386/bin/tbl - 775 sys sys 1131302431 113308
 386/bin/tcs - 775 sys sys 1138393253 309719
 386/bin/tee - 775 sys sys 1130384340 38446
@@ -8118,13 +8118,13 @@ sys/src/9/port/portdat.h - 664 sys sys 1138458366 22535
 sys/src/9/port/portfns.h - 664 sys sys 1138469535 11079
 sys/src/9/port/portmkfile - 664 sys sys 1131907975 2062
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
-sys/src/9/port/proc.c - 664 sys sys 1138469345 28053
+sys/src/9/port/proc.c - 664 sys sys 1138749368 28702
 sys/src/9/port/qio.c - 664 sys sys 1070287837 23562
 sys/src/9/port/qlock.c - 664 sys sys 1067722765 3196
 sys/src/9/port/rdb.c - 664 sys sys 1018721202 1698
 sys/src/9/port/rebootcmd.c - 664 sys sys 1015278340 1561
 sys/src/9/port/sd.h - 664 sys sys 1134411408 2494
-sys/src/9/port/segment.c - 664 sys sys 1134276516 13762
+sys/src/9/port/segment.c - 664 sys sys 1138749368 13939
 sys/src/9/port/swap.c - 664 sys sys 1138028310 7019
 sys/src/9/port/sysfile.c - 664 sys sys 1134042952 22178
 sys/src/9/port/sysproc.c - 664 sys sys 1137622456 15153
@@ -12346,7 +12346,7 @@ sys/src/cmd/ip/imap4d/utils.c - 664 sys sys 1015013077 2481
 sys/src/cmd/ip/ipconfig.c - 664 sys sys 1126103921 34865
 sys/src/cmd/ip/measure.c - 664 sys sys 944961011 3733
 sys/src/cmd/ip/mkfile - 664 sys sys 1131110598 1243
-sys/src/cmd/ip/ping.c - 664 sys sys 1135352233 5611
+sys/src/cmd/ip/ping.c - 664 sys sys 1138723947 5589
 sys/src/cmd/ip/ppp - 20000000775 sys sys 988249980 0
 sys/src/cmd/ip/ppp/block.c - 664 sys sys 1015090266 5353
 sys/src/cmd/ip/ppp/compress.c - 664 sys sys 1072729513 11774
@@ -13309,7 +13309,7 @@ sys/src/cmd/tapefs/v10fs.c - 664 sys sys 1014926385 3754
 sys/src/cmd/tapefs/v6fs.c - 664 sys sys 1014926385 3971
 sys/src/cmd/tapefs/zip.h - 664 sys sys 1097914153 1428
 sys/src/cmd/tapefs/zipfs.c - 664 sys sys 1097900277 6803
-sys/src/cmd/tar.c - 664 sys sys 1135171244 22081
+sys/src/cmd/tar.c - 664 sys sys 1138711857 22453
 sys/src/cmd/tbl - 20000000775 sys sys 954038038 0
 sys/src/cmd/tbl/mkfile - 664 sys sys 944961243 268
 sys/src/cmd/tbl/t.h - 664 sys sys 944961244 3987

+ 6 - 6
dist/replica/plan9.db

@@ -299,7 +299,7 @@
 386/bin/ip/httpfile - 775 sys sys 1138500622 283922
 386/bin/ip/imap4d - 775 sys sys 1135570825 237651
 386/bin/ip/ipconfig - 775 sys sys 1135570825 137844
-386/bin/ip/ping - 775 sys sys 1135570826 76416
+386/bin/ip/ping - 775 sys sys 1138730269 76405
 386/bin/ip/ppp - 775 sys sys 1135570826 219950
 386/bin/ip/pppoe - 775 sys sys 1135570826 77544
 386/bin/ip/pptp - 775 sys sys 1138500632 127014
@@ -416,7 +416,7 @@
 386/bin/swap - 775 sys sys 1135570847 62130
 386/bin/syscall - 775 sys sys 1130594788 73568
 386/bin/tail - 775 sys sys 1135570847 66163
-386/bin/tar - 775 sys sys 1135570847 93423
+386/bin/tar - 775 sys sys 1138723507 93772
 386/bin/tbl - 775 sys sys 1131302431 113308
 386/bin/tcs - 775 sys sys 1138393253 309719
 386/bin/tee - 775 sys sys 1130384340 38446
@@ -8118,13 +8118,13 @@ sys/src/9/port/portdat.h - 664 sys sys 1138458366 22535
 sys/src/9/port/portfns.h - 664 sys sys 1138469535 11079
 sys/src/9/port/portmkfile - 664 sys sys 1131907975 2062
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
-sys/src/9/port/proc.c - 664 sys sys 1138469345 28053
+sys/src/9/port/proc.c - 664 sys sys 1138749368 28702
 sys/src/9/port/qio.c - 664 sys sys 1070287837 23562
 sys/src/9/port/qlock.c - 664 sys sys 1067722765 3196
 sys/src/9/port/rdb.c - 664 sys sys 1018721202 1698
 sys/src/9/port/rebootcmd.c - 664 sys sys 1015278340 1561
 sys/src/9/port/sd.h - 664 sys sys 1134411408 2494
-sys/src/9/port/segment.c - 664 sys sys 1134276516 13762
+sys/src/9/port/segment.c - 664 sys sys 1138749368 13939
 sys/src/9/port/swap.c - 664 sys sys 1138028310 7019
 sys/src/9/port/sysfile.c - 664 sys sys 1134042952 22178
 sys/src/9/port/sysproc.c - 664 sys sys 1137622456 15153
@@ -12346,7 +12346,7 @@ sys/src/cmd/ip/imap4d/utils.c - 664 sys sys 1015013077 2481
 sys/src/cmd/ip/ipconfig.c - 664 sys sys 1126103921 34865
 sys/src/cmd/ip/measure.c - 664 sys sys 944961011 3733
 sys/src/cmd/ip/mkfile - 664 sys sys 1131110598 1243
-sys/src/cmd/ip/ping.c - 664 sys sys 1135352233 5611
+sys/src/cmd/ip/ping.c - 664 sys sys 1138723947 5589
 sys/src/cmd/ip/ppp - 20000000775 sys sys 988249980 0
 sys/src/cmd/ip/ppp/block.c - 664 sys sys 1015090266 5353
 sys/src/cmd/ip/ppp/compress.c - 664 sys sys 1072729513 11774
@@ -13309,7 +13309,7 @@ sys/src/cmd/tapefs/v10fs.c - 664 sys sys 1014926385 3754
 sys/src/cmd/tapefs/v6fs.c - 664 sys sys 1014926385 3971
 sys/src/cmd/tapefs/zip.h - 664 sys sys 1097914153 1428
 sys/src/cmd/tapefs/zipfs.c - 664 sys sys 1097900277 6803
-sys/src/cmd/tar.c - 664 sys sys 1135171244 22081
+sys/src/cmd/tar.c - 664 sys sys 1138711857 22453
 sys/src/cmd/tbl - 20000000775 sys sys 954038038 0
 sys/src/cmd/tbl/mkfile - 664 sys sys 944961243 268
 sys/src/cmd/tbl/t.h - 664 sys sys 944961244 3987

+ 6 - 0
dist/replica/plan9.log

@@ -27511,3 +27511,9 @@
 1138555917 1 c sys/lib/plumb/basic - 664 sys sys 1138555264 2877
 1138555917 2 c sys/man/1/man - 664 sys sys 1138555093 2006
 1138566722 0 c sys/games/lib/fortunes - 664 sys sys 1138566736 257323
+1138712443 0 c sys/src/cmd/tar.c - 664 sys sys 1138711857 22453
+1138725047 0 c 386/bin/tar - 775 sys sys 1138723507 93772
+1138725047 1 c sys/src/cmd/ip/ping.c - 664 sys sys 1138723947 5589
+1138730448 0 c 386/bin/ip/ping - 775 sys sys 1138730269 76405
+1138750261 0 c sys/src/9/port/proc.c - 664 sys sys 1138749368 28702
+1138750261 1 c sys/src/9/port/segment.c - 664 sys sys 1138749368 13939

+ 19 - 1
sys/src/9/port/proc.c

@@ -122,7 +122,25 @@ sched(void)
 			getcallerpc(&p+2));
 
 	if(up){
-		if(up->nlocks.ref && up->state != Moribund && up->delaysched < 20){
+		/*
+		 * Delay the sched until the process gives up the locks
+		 * it is holding.  This avoids dumb lock loops.
+		 * Don't delay if the process is Moribund.
+		 * It called sched to die.
+		 * But do sched eventually.  This avoids a missing unlock
+		 * from hanging the entire kernel. 
+		 * But don't reschedule procs holding palloc or procalloc.
+		 * Those are far too important to be holding while asleep.
+		 *
+		 * This test is not exact.  There can still be a few instructions
+		 * in the middle of taslock when a process holds a lock
+		 * but Lock.p has not yet been initialized.
+		 */
+		if(up->nlocks.ref)
+		if(up->state != Moribund)
+		if(up->delaysched < 20
+		|| palloc.Lock.p == up
+		|| procalloc.Lock.p == up){
 			up->delaysched++;
  			delayedscheds++;
 			return;

+ 12 - 3
sys/src/9/port/segment.c

@@ -320,6 +320,7 @@ static struct {
 static void
 imagereclaim(void)
 {
+	int n;
 	Page *p;
 	uvlong ticks;
 
@@ -330,10 +331,18 @@ imagereclaim(void)
 
 	lock(&palloc);
 	ticks = fastticks(nil);
-	for(p = palloc.head; p; p = p->next) {
-		if(p->ref == 0 && p->image && canlock(p)) {
-			if(p->ref == 0)
+	n = 0;
+	/*
+	 * All the pages with images backing them are at the
+	 * end of the list (see putpage) so start there and work
+	 * backward.
+	 */
+	for(p = palloc.tail; p && p->image && n<1000; p = p->prev) {
+		if(p->ref == 0 && canlock(p)) {
+			if(p->ref == 0) {
+				n++;
 				uncachepage(p);
+			}
 			unlock(p);
 		}
 	}

+ 0 - 1
sys/src/cmd/ip/ping.c

@@ -185,7 +185,6 @@ rcvr(int fd, int msglen, int interval, int nmsg)
 		alarm(0);
 		now = nsec();
 		if(n <= 0){	/* read interrupted - time to go */
-fprint(2, "clean\n");
 			clean(0, now+MINUTE, nil);
 			continue;
 		}

+ 12 - 2
sys/src/cmd/tar.c

@@ -56,7 +56,7 @@ enum {
 	LF_PLAIN2 =	'0',
 	LF_LINK =	'1',
 	LF_SYMLINK1 =	'2',
-	LF_SYMLINK2 =	's',
+	LF_SYMLINK2 =	's',		/* 4BSD used this */
 	LF_CHR =	'3',
 	LF_BLK =	'4',
 	LF_DIR =	'5',
@@ -459,12 +459,13 @@ eotar(Hdr *hp)
 	return name(hp)[0] == '\0';
 }
 
+/* return the size from the header block, or zero for links, dirs, etc. */
 Off
 hdrsize(Hdr *hp)
 {
 	Off bytes = strtoull(hp->size, nil, 8);
 
-	if(isdir(hp))
+	if(isdir(hp) || islink(hp->linkflag))
 		bytes = 0;
 	return bytes;
 }
@@ -934,12 +935,17 @@ extract1(int ar, Hdr *hp, char *fname)
 	} else
 		print("%s\n", fname);
 
+	if (blksleft == 0)
+		bytes = 0;
 	for (; blksleft > 0; blksleft -= blksread) {
 		hbp = getblkrd(ar, (fd >= 0? Alldata: Justnxthdr));
 		if (hbp == nil)
 			sysfatal("unexpected EOF on archive extracting %s",
 				fname);
 		blksread = gothowmany(blksleft);
+		if (blksread <= 0)
+			fprint(2, "%s: got %ld blocks reading %s!\n",
+				argv0, blksread, fname);
 		wrbytes = Tblock*blksread;
 		if(wrbytes > bytes)
 			wrbytes = bytes;
@@ -948,6 +954,10 @@ extract1(int ar, Hdr *hp, char *fname)
 		putreadblks(ar, blksread);
 		bytes -= wrbytes;
 	}
+	if (bytes > 0)
+		fprint(2,
+		    "%s: %lld bytes uncopied at eof; %s not fully extracted\n",
+			argv0, bytes, fname);
 	if (fd >= 0) {
 		/*
 		 * directories should be wstated after we're done