Browse Source

Plan 9 from Bell Labs 2008-08-09

David du Colombier 13 years ago
parent
commit
620a18264e

+ 4 - 4
dist/replica/_plan9.db

@@ -7877,7 +7877,7 @@ sys/man/8/mkpaqfs - 664 sys sys 1196638947 890
 sys/man/8/mksacfs - 664 sys sys 1196638947 710
 sys/man/8/mouse - 664 sys sys 1196638947 2476
 sys/man/8/na - 664 sys sys 1196638947 859
-sys/man/8/ndb - 664 sys sys 1207767560 15239
+sys/man/8/ndb - 664 sys sys 1218247417 15243
 sys/man/8/newuser - 664 sys sys 1196638947 2418
 sys/man/8/nfsserver - 664 sys sys 1217138303 3807
 sys/man/8/partfs - 664 sys sys 1196638947 869
@@ -13225,7 +13225,7 @@ sys/src/cmd/proof/mkfile - 664 sys sys 944961622 180
 sys/src/cmd/proof/proof.h - 664 sys sys 955223407 919
 sys/src/cmd/proof/screen.c - 664 sys sys 1204590226 6673
 sys/src/cmd/ps.c - 664 sys sys 1144686672 2783
-sys/src/cmd/pump.c - 664 sys sys 1213765467 2941
+sys/src/cmd/pump.c - 664 sys sys 1218240660 3392
 sys/src/cmd/pwd.c - 664 sys sys 1067722792 287
 sys/src/cmd/qa - 20000000775 sys sys 1039727573 0
 sys/src/cmd/qa/a.h - 664 sys sys 1089299169 3252
@@ -14150,7 +14150,7 @@ sys/src/cmd/unix/winplumb.c - 664 sys sys 1047233509 5015
 sys/src/cmd/unix/winplumb.exe - 664 sys sys 1047233509 32768
 sys/src/cmd/unix/winstart - 775 sys sys 1047233540 60
 sys/src/cmd/unlnfs.c - 664 sys sys 1127525524 1914
-sys/src/cmd/unmount.c - 664 sys sys 1014926615 442
+sys/src/cmd/unmount.c - 664 sys sys 1218224318 526
 sys/src/cmd/upas - 20000000775 sys sys 1075080223 0
 sys/src/cmd/upas/README - 664 sys sys 944961329 1041
 sys/src/cmd/upas/alias - 20000000775 sys sys 1064589598 0
@@ -14428,7 +14428,7 @@ sys/src/cmd/venti/srv/venti.c - 664 sys sys 1196382019 5604
 sys/src/cmd/venti/srv/verifyarena.c - 664 sys sys 1191257292 5776
 sys/src/cmd/venti/srv/whack.c - 664 sys sys 1142736357 6419
 sys/src/cmd/venti/srv/whack.h - 664 sys sys 1142736357 966
-sys/src/cmd/venti/srv/wrarena.c - 664 sys sys 1210358091 4559
+sys/src/cmd/venti/srv/wrarena.c - 664 sys sys 1218240713 4601
 sys/src/cmd/venti/srv/www - 20000000775 sys sys 1189019173 0
 sys/src/cmd/venti/srv/www/stats.html - 664 sys sys 1177190826 869
 sys/src/cmd/venti/srv/www/stats.js - 664 sys sys 1177190826 9427

+ 4 - 4
dist/replica/plan9.db

@@ -7877,7 +7877,7 @@ sys/man/8/mkpaqfs - 664 sys sys 1196638947 890
 sys/man/8/mksacfs - 664 sys sys 1196638947 710
 sys/man/8/mouse - 664 sys sys 1196638947 2476
 sys/man/8/na - 664 sys sys 1196638947 859
-sys/man/8/ndb - 664 sys sys 1207767560 15239
+sys/man/8/ndb - 664 sys sys 1218247417 15243
 sys/man/8/newuser - 664 sys sys 1196638947 2418
 sys/man/8/nfsserver - 664 sys sys 1217138303 3807
 sys/man/8/partfs - 664 sys sys 1196638947 869
@@ -13225,7 +13225,7 @@ sys/src/cmd/proof/mkfile - 664 sys sys 944961622 180
 sys/src/cmd/proof/proof.h - 664 sys sys 955223407 919
 sys/src/cmd/proof/screen.c - 664 sys sys 1204590226 6673
 sys/src/cmd/ps.c - 664 sys sys 1144686672 2783
-sys/src/cmd/pump.c - 664 sys sys 1213765467 2941
+sys/src/cmd/pump.c - 664 sys sys 1218240660 3392
 sys/src/cmd/pwd.c - 664 sys sys 1067722792 287
 sys/src/cmd/qa - 20000000775 sys sys 1039727573 0
 sys/src/cmd/qa/a.h - 664 sys sys 1089299169 3252
@@ -14150,7 +14150,7 @@ sys/src/cmd/unix/winplumb.c - 664 sys sys 1047233509 5015
 sys/src/cmd/unix/winplumb.exe - 664 sys sys 1047233509 32768
 sys/src/cmd/unix/winstart - 775 sys sys 1047233540 60
 sys/src/cmd/unlnfs.c - 664 sys sys 1127525524 1914
-sys/src/cmd/unmount.c - 664 sys sys 1014926615 442
+sys/src/cmd/unmount.c - 664 sys sys 1218224318 526
 sys/src/cmd/upas - 20000000775 sys sys 1075080223 0
 sys/src/cmd/upas/README - 664 sys sys 944961329 1041
 sys/src/cmd/upas/alias - 20000000775 sys sys 1064589598 0
@@ -14428,7 +14428,7 @@ sys/src/cmd/venti/srv/venti.c - 664 sys sys 1196382019 5604
 sys/src/cmd/venti/srv/verifyarena.c - 664 sys sys 1191257292 5776
 sys/src/cmd/venti/srv/whack.c - 664 sys sys 1142736357 6419
 sys/src/cmd/venti/srv/whack.h - 664 sys sys 1142736357 966
-sys/src/cmd/venti/srv/wrarena.c - 664 sys sys 1210358091 4559
+sys/src/cmd/venti/srv/wrarena.c - 664 sys sys 1218240713 4601
 sys/src/cmd/venti/srv/www - 20000000775 sys sys 1189019173 0
 sys/src/cmd/venti/srv/www/stats.html - 664 sys sys 1177190826 869
 sys/src/cmd/venti/srv/www/stats.js - 664 sys sys 1177190826 9427

+ 4 - 0
dist/replica/plan9.log

@@ -20120,3 +20120,7 @@
 1218137404 1 c 386/bin/unvac - 775 sys sys 1218136577 228866
 1218137404 2 c 386/bin/vac - 775 sys sys 1218136581 229446
 1218137404 3 c 386/bin/vacfs - 775 sys sys 1218136585 243628
+1218225604 0 c sys/src/cmd/unmount.c - 664 sys sys 1218224318 526
+1218241805 0 c sys/src/cmd/venti/srv/wrarena.c - 664 sys sys 1218240713 4601
+1218241805 1 c sys/src/cmd/pump.c - 664 sys sys 1218240660 3392
+1218247205 0 c sys/man/8/ndb - 664 sys sys 1218247417 15243

+ 1 - 1
sys/man/8/ndb

@@ -290,7 +290,7 @@ default
 .BR /lib/ndb/local .
 .TP
 .B -n
-whenever a zone that we serve changes, send UDP NOTIFY
+whenever a DNS zone that we serve changes, send UDP NOTIFY
 messages to any dns slaves for that zone
 (see the
 .L dnsslave

+ 37 - 6
sys/src/cmd/pump.c

@@ -3,12 +3,15 @@
 #include <libc.h>
 
 uchar*	buf;
-ulong	nin;
-ulong	nout;
+
+Lock	arithlock;	/* protect 64-bit accesses: unlikely to be atomic */
+uvlong	nin;
+uvlong	nout;
+
 ulong	kilo;
 ulong	max;
 long	ssize;
-long	tsize;
+vlong	tsize;
 int	dsize;
 int	done;
 int	ibsize;
@@ -69,7 +72,7 @@ main(int argc, char *argv[])
 		ssize <<= 10;
 		break;
 	case 't':
-		tsize = atol(EARGF(usage()));
+		tsize = atoll(EARGF(usage()));
 		tsize *= 10584000;		/* minutes */
 		break;
 	} ARGEND
@@ -109,17 +112,30 @@ main(int argc, char *argv[])
 	exits(0);
 }
 
+/* call with arithlock held */
+static int
+sleepunlocked(long ms)
+{
+	int r;
+
+	unlock(&arithlock);
+	r = sleep(ms);
+	lock(&arithlock);
+	return r;
+}
+
 void
 dooutput(int f)
 {
 	long n, l, c;
 
+	lock(&arithlock);
 	for (;;) {
 		n = nin - nout;
 		if(n == 0) {
 			if(done)
 				break;
-			sleep(dsize);
+			sleepunlocked(dsize);
 			continue;
 		}
 		if(verb && n > max) {
@@ -127,11 +143,15 @@ dooutput(int f)
 			max = n;
 		}
 		l = nout % kilo;
+		unlock(&arithlock);
+
 		if(kilo-l < n)
 			n = kilo-l;
 		if(n > obsize)
 			n = obsize;
 		c = write(f, buf+l, n);
+
+		lock(&arithlock);
 		if(c != n) {
 			fprint(2, "%s: write error: %r\n", argv0);
 			break;
@@ -142,6 +162,7 @@ dooutput(int f)
 			break;
 		}
 	}
+	unlock(&arithlock);
 }
 
 void
@@ -149,17 +170,22 @@ doinput(int f)
 {
 	long n, l, c, xnin;
 
+	lock(&arithlock);
 	if(ssize > 0) {
 		for (xnin = 0; xnin < ssize && !done; xnin += c) {
 			n = kilo - (xnin - nout);
 			if(n == 0)
 				break;
+			unlock(&arithlock);
+
 			l = xnin % kilo;
 			if(kilo-l < n)
 				n = kilo-l;
 			if(n > ibsize)
 				n = ibsize;
 			c = read(f, buf+l, n);
+
+			lock(&arithlock);
 			if(c <= 0) {
 				if(c < 0)
 					fprint(2, "%s: read error: %r\n", argv0);
@@ -171,15 +197,19 @@ doinput(int f)
 	while(!done) {
 		n = kilo - (nin - nout);
 		if(n == 0) {
-			sleep(0);
+			sleepunlocked(0);
 			continue;
 		}
 		l = nin % kilo;
+		unlock(&arithlock);
+
 		if(kilo-l < n)
 			n = kilo-l;
 		if(n > ibsize)
 			n = ibsize;
 		c = read(f, buf+l, n);
+
+		lock(&arithlock);
 		if(c <= 0) {
 			if(c < 0)
 				fprint(2, "%s: read error: %r\n", argv0);
@@ -187,4 +217,5 @@ doinput(int f)
 		}
 		nin += c;
 	}
+	unlock(&arithlock);
 }

+ 17 - 11
sys/src/cmd/unmount.c

@@ -1,26 +1,32 @@
 #include <u.h>
 #include <libc.h>
-	
+
 void
 main(int argc, char *argv[])
 {
 	int r;
+	char *mnted, *mtpt;
 
-	if(argc < 2  || argc > 3) {
+	argv0 = argv[0];
+	switch (argc) {
+	case 2:
+		mnted = nil;
+		mtpt = argv[1];
+		break;
+	case 3:
+		mnted = argv[1];
+		mtpt = argv[2];
+		break;
+	default:
+		SET(mnted, mtpt);
 		fprint(2, "usage: unmount mountpoint\n");
 		fprint(2, "       unmount mounted mountpoint\n");
 		exits("usage");
 	}
 
 	/* unmount takes arguments in the same order as mount */
-	if(argc < 3)
-		r = unmount(0, argv[1]);
-	else
-		r = unmount(argv[1], argv[2]);
-
-	if(r < 0) {
-		fprint(2, "unmount:%r\n");
-		exits("error");
-	}
+	r = unmount(mnted, mtpt);
+	if(r < 0)
+		sysfatal("%s: %r", mtpt);
 	exits(0);
 }

+ 3 - 2
sys/src/cmd/venti/srv/wrarena.c

@@ -87,8 +87,8 @@ rdarena(Arena *arena, u64int offset)
 			break;
 		if(a < aa || ci.type == VtCorruptType){
 			if(ci.type == VtCorruptType)
-				fprint(2, "corrupt at %#llx: +%d\n",
-					a, ClumpSize+ci.size);
+				fprint(2, "%s: corrupt clump read at %#llx: +%d\n",
+					argv0, a, ClumpSize+ci.size);
 			continue;
 		}
 		lump = loadclump(arena, a, 0, &cl, score, 0);
@@ -137,6 +137,7 @@ threadmain(int argc, char *argv[])
 	ArenaHead head;
 	ZClump zerocl;
 
+	ventifmtinstall();
 	qlock(&godot);
 	aoffset = 0;
 	ARGBEGIN{