Browse Source

Plan 9 from Bell Labs 2008-03-19

David du Colombier 13 years ago
parent
commit
1b619269fa
6 changed files with 61 additions and 29 deletions
  1. 6 7
      dist/replica/_plan9.db
  2. 5 5
      dist/replica/plan9.db
  3. 5 0
      dist/replica/plan9.log
  4. 11 9
      sys/man/4/cdfs
  5. 1 1
      sys/man/4/usbdisk
  6. 33 7
      sys/src/cmd/stats.c

+ 6 - 7
dist/replica/_plan9.db

@@ -418,7 +418,7 @@
 386/bin/srvold9p - 775 sys sys 1176520499 130362
 386/bin/ssh - 775 sys sys 1188447281 211126
 386/bin/sshnet - 775 sys sys 1188447288 289170
-386/bin/stats - 775 sys sys 1197732831 191135
+386/bin/stats - 775 sys sys 1205897310 191360
 386/bin/strings - 775 sys sys 1168402350 62855
 386/bin/strip - 775 sys sys 1188530204 81796
 386/bin/sum - 775 sys sys 1148500691 39505
@@ -5514,7 +5514,7 @@ rc/bin/diffy - 775 sys sys 1140694870 277
 rc/bin/dircp - 775 sys sys 1186289104 181
 rc/bin/diskparts - 775 sys sys 1178399618 624
 rc/bin/dmaon - 775 sys sys 1205288448 220
-rc/bin/doc2ps - 775 sys sys 1069793831 244
+rc/bin/doc2ps - 775 sys sys 1205813503 338
 rc/bin/doc2txt - 775 sys sys 1025197880 563
 rc/bin/doctype - 775 sys sys 1162921755 1727
 rc/bin/dosmnt - 775 sys sys 1109288224 303
@@ -7392,7 +7392,7 @@ sys/man/1/dd - 664 sys sys 1196638931 3346
 sys/man/1/delkey - 664 sys sys 1196638931 779
 sys/man/1/deroff - 664 sys sys 1196638931 1826
 sys/man/1/diff - 664 sys sys 1196638935 3089
-sys/man/1/doc2txt - 664 sys sys 1198243815 2518
+sys/man/1/doc2txt - 664 sys sys 1205815382 2628
 sys/man/1/doctype - 664 sys sys 1196638931 860
 sys/man/1/du - 664 sys sys 1196638931 2281
 sys/man/1/echo - 664 sys sys 1196638932 430
@@ -7721,7 +7721,7 @@ sys/man/4/INDEX - 664 sys sys 1196638942 1026
 sys/man/4/INDEX.html - 664 sys sys 1196638942 5147
 sys/man/4/acme - 664 sys sys 1196638943 10435
 sys/man/4/archfs - 664 sys sys 1196638943 533
-sys/man/4/cdfs - 664 sys sys 1205450230 4352
+sys/man/4/cdfs - 664 sys sys 1205857355 4480
 sys/man/4/cfs - 664 sys sys 1196638943 2136
 sys/man/4/consolefs - 664 sys sys 1196638943 4389
 sys/man/4/cwfs - 664 sys sys 1196638943 6553
@@ -7758,7 +7758,7 @@ sys/man/4/u9fs - 664 sys sys 1196638944 4748
 sys/man/4/upasfs - 664 sys sys 1196638944 6212
 sys/man/4/usb - 664 sys sys 1203552814 5677
 sys/man/4/usbd - 664 sys sys 1202846392 1035
-sys/man/4/usbdisk - 664 sys sys 1202847388 3041
+sys/man/4/usbdisk - 664 sys sys 1205857582 3044
 sys/man/4/vacfs - 664 sys sys 1196638944 1545
 sys/man/4/webcookies - 664 sys sys 1196638944 3525
 sys/man/4/webfs - 664 sys sys 1196638944 6518
@@ -13493,7 +13493,7 @@ sys/src/cmd/ssh/ssh.h - 664 sys sys 1091904420 6086
 sys/src/cmd/ssh/sshnet.c - 664 sys sys 1078840016 17641
 sys/src/cmd/ssh/sshserve.c - 664 sys sys 1135487956 5772
 sys/src/cmd/ssh/util.c - 664 sys sys 1154722953 4522
-sys/src/cmd/stats.c - 664 sys sys 1194215006 28141
+sys/src/cmd/stats.c - 664 sys sys 1205873637 28451
 sys/src/cmd/strings.c - 664 sys sys 1167860903 1474
 sys/src/cmd/strip.c - 664 sys sys 1131293244 2502
 sys/src/cmd/sum.c - 664 sys sys 1014926615 5548
@@ -15869,4 +15869,3 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
-rc/bin/doc2ps - 775 sys sys 1205813503 338

+ 5 - 5
dist/replica/plan9.db

@@ -418,7 +418,7 @@
 386/bin/srvold9p - 775 sys sys 1176520499 130362
 386/bin/ssh - 775 sys sys 1188447281 211126
 386/bin/sshnet - 775 sys sys 1188447288 289170
-386/bin/stats - 775 sys sys 1197732831 191135
+386/bin/stats - 775 sys sys 1205897310 191360
 386/bin/strings - 775 sys sys 1168402350 62855
 386/bin/strip - 775 sys sys 1188530204 81796
 386/bin/sum - 775 sys sys 1148500691 39505
@@ -7392,7 +7392,7 @@ sys/man/1/dd - 664 sys sys 1196638931 3346
 sys/man/1/delkey - 664 sys sys 1196638931 779
 sys/man/1/deroff - 664 sys sys 1196638931 1826
 sys/man/1/diff - 664 sys sys 1196638935 3089
-sys/man/1/doc2txt - 664 sys sys 1198243815 2518
+sys/man/1/doc2txt - 664 sys sys 1205815382 2628
 sys/man/1/doctype - 664 sys sys 1196638931 860
 sys/man/1/du - 664 sys sys 1196638931 2281
 sys/man/1/echo - 664 sys sys 1196638932 430
@@ -7721,7 +7721,7 @@ sys/man/4/INDEX - 664 sys sys 1196638942 1026
 sys/man/4/INDEX.html - 664 sys sys 1196638942 5147
 sys/man/4/acme - 664 sys sys 1196638943 10435
 sys/man/4/archfs - 664 sys sys 1196638943 533
-sys/man/4/cdfs - 664 sys sys 1205450230 4352
+sys/man/4/cdfs - 664 sys sys 1205857355 4480
 sys/man/4/cfs - 664 sys sys 1196638943 2136
 sys/man/4/consolefs - 664 sys sys 1196638943 4389
 sys/man/4/cwfs - 664 sys sys 1196638943 6553
@@ -7758,7 +7758,7 @@ sys/man/4/u9fs - 664 sys sys 1196638944 4748
 sys/man/4/upasfs - 664 sys sys 1196638944 6212
 sys/man/4/usb - 664 sys sys 1203552814 5677
 sys/man/4/usbd - 664 sys sys 1202846392 1035
-sys/man/4/usbdisk - 664 sys sys 1202847388 3041
+sys/man/4/usbdisk - 664 sys sys 1205857582 3044
 sys/man/4/vacfs - 664 sys sys 1196638944 1545
 sys/man/4/webcookies - 664 sys sys 1196638944 3525
 sys/man/4/webfs - 664 sys sys 1196638944 6518
@@ -13493,7 +13493,7 @@ sys/src/cmd/ssh/ssh.h - 664 sys sys 1091904420 6086
 sys/src/cmd/ssh/sshnet.c - 664 sys sys 1078840016 17641
 sys/src/cmd/ssh/sshserve.c - 664 sys sys 1135487956 5772
 sys/src/cmd/ssh/util.c - 664 sys sys 1154722953 4522
-sys/src/cmd/stats.c - 664 sys sys 1194215006 28141
+sys/src/cmd/stats.c - 664 sys sys 1205873637 28451
 sys/src/cmd/strings.c - 664 sys sys 1167860903 1474
 sys/src/cmd/strip.c - 664 sys sys 1131293244 2502
 sys/src/cmd/sum.c - 664 sys sys 1014926615 5548

+ 5 - 0
dist/replica/plan9.log

@@ -18806,3 +18806,8 @@
 1205811004 3 c 386/bin/aux/timesync - 775 sys sys 1205810535 129698
 1205811004 4 c 386/lib/libcontrol.a - 664 sys sys 1205810549 274730
 1205814604 0 c rc/bin/doc2ps - 775 sys sys 1205813503 338
+1205816406 0 c sys/man/1/doc2txt - 664 sys sys 1205815382 2628
+1205857803 0 c sys/man/4/cdfs - 664 sys sys 1205857355 4480
+1205857803 1 c sys/man/4/usbdisk - 664 sys sys 1205857582 3044
+1205874004 0 c sys/src/cmd/stats.c - 664 sys sys 1205873637 28451
+1205897405 0 c 386/bin/stats - 775 sys sys 1205897310 191360

+ 11 - 9
sys/man/4/cdfs

@@ -62,21 +62,23 @@ is the track number.
 .PP
 If the device is capable of writing discs
 and contains a writable disc, the top level
-directory also contains two empty directories
-.B wa
-and
-.BR wd .
+directory also contains an empty directory
+.B wd
+and, for CDs only,
+an empty directory
+.BR wa .
 Files created in these directories
 appear in the top level directory
-as new audio or data tracks, regardless of name.
+as new data or audio tracks, respectively, regardless of name.
 .PP
 At any time, any number of tracks
 may be open for reading or a single track
 may be open for writing.
-Writing a disc track is a real-time operation:
-the disc writer must be kept saturated with
-new data to avoid buffer underruns.
-To ensure this, copying from a file system
+Writing a disc track is a quasi-real-time operation:
+the disc writer should be kept saturated with
+new data to avoid buffer underruns,
+but modern drives will be told to cope with underruns transparently.
+To ensure saturation, copying from a file system
 stored on local disk or memory is recommended.
 .PP
 To fixate a disc (close a recordable disc by writing

+ 1 - 1
sys/man/4/usbdisk

@@ -40,7 +40,7 @@ is the number of a LUN to access,
 for all detected LUNs of the named or found USB device.
 .I Disk
 searches for a USB device with class 8 (storage),
-subclass 2 (ATAPI CD/DVD),
+subclass 2 (ATAPI CD/DVD/BD),
 5 (removable, ATAPI-like) or
 6 (SCSI transparent),
 and

+ 33 - 7
sys/src/cmd/stats.c

@@ -54,6 +54,7 @@ enum
 struct Machine
 {
 	char		*name;
+	char		*shortname;
 	int		remote;
 	int		statsfd;
 	int		swapfd;
@@ -67,6 +68,7 @@ struct Machine
 	ulong		devsysstat[10];
 	ulong		prevsysstat[10];
 	int		nproc;
+	int		lgproc;
 	ulong		netetherstats[8];
 	ulong		prevetherstats[8];
 	ulong		batterystats[2];
@@ -594,6 +596,28 @@ readswap(Machine *m, ulong *a)
 	return readnums(m, nelem(m->devswap), a, 0);
 }
 
+char*
+shortname(char *s)
+{
+	char *p, *e;
+
+	p = estrdup(s);
+	e = strchr(p, '.');
+	if(e)
+		*e = 0;
+	return p;
+}
+
+int
+ilog10(long j)
+{
+	int i;
+
+	for(i = 0; j >= 10; i++)
+		j /= 10;
+	return i;
+}
+	
 int
 initmach(Machine *m, char *name)
 {
@@ -607,6 +631,7 @@ initmach(Machine *m, char *name)
 	else
 		p = name;
 	m->name = estrdup(p);
+	m->shortname = shortname(p);
 	m->remote = (strcmp(p, mysysname) != 0);
 	if(m->remote == 0)
 		strcpy(mpt, "");
@@ -643,6 +668,7 @@ initmach(Machine *m, char *name)
 		m->nproc = n;
 	}else
 		m->nproc = 1;
+	m->lgproc = ilog10(m->nproc);
 
 	snprint(buf, sizeof buf, "%s/net/ether0/stats", mpt);
 	m->etherfd = open(buf, OREAD);
@@ -719,7 +745,7 @@ void
 readmach(Machine *m, int init)
 {
 	int n, i;
-	ulong a[8];
+	ulong a[nelem(m->devsysstat)];
 	char buf[32];
 
 	if(m->remote && (m->disable || setjmp(catchalarm))){
@@ -733,6 +759,8 @@ readmach(Machine *m, int init)
 	if (strcmp(m->name, buf) != 0){
 		free(m->name);
 		m->name = estrdup(buf);
+		free(m->shortname);
+		m->shortname = shortname(buf);
 		if(display != nil)	/* else we're still initializing */
 			eresized(0);
 	}
@@ -1084,13 +1112,13 @@ resize(void)
 		draw(screen, Rect(x-1, starty-1, x, screen->r.max.y), display->black, nil, ZP);
 		j = dx/stringwidth(mediumfont, "0");
 		n = mach[i].nproc;
-		if(n>1 && j>=1+3+(n>10)+(n>100)){	/* first char of name + (n) */
-			j -= 3+(n>10)+(n>100);
+		if(n>1 && j>=1+3+mach[i].lgproc){	/* first char of name + (n) */
+			j -= 3+mach[i].lgproc;
 			if(j <= 0)
 				j = 1;
-			snprint(buf, sizeof buf, "%.*s(%d)", j, mach[i].name, n);
+			snprint(buf, sizeof buf, "%.*s(%d)", j, mach[i].shortname, n);
 		}else
-			snprint(buf, sizeof buf, "%.*s", j, mach[i].name);
+			snprint(buf, sizeof buf, "%.*s", j, mach[i].shortname);
 		string(screen, Pt(x+Labspace, screen->r.min.y + Labspace), display->black, ZP, mediumfont, buf);
 	}
 
@@ -1361,8 +1389,6 @@ main(int argc, char *argv[])
 		parity = 1-parity;
 		for(i=0; i<nmach*ngraph; i++){
 			graph[i].newvalue(graph[i].mach, &v, &vmax, 0);
-			if (v > 1000000)
-				v = 1000000;	/* cap absurd values */
 			graph[i].update(&graph[i], v, vmax);
 		}
 		flushimage(display, 1);