Browse Source

Plan 9 from Bell Labs 2007-05-09

David du Colombier 14 years ago
parent
commit
3372c73aa3
6 changed files with 49 additions and 49 deletions
  1. 7 7
      dist/replica/_plan9.db
  2. 7 7
      dist/replica/plan9.db
  3. 7 0
      dist/replica/plan9.log
  4. 1 1
      sys/man/2/ip
  5. 20 5
      sys/man/3/ether
  6. 7 29
      sys/src/libip/myetheraddr.c

+ 7 - 7
dist/replica/_plan9.db

@@ -302,14 +302,14 @@
 386/bin/ip/httpd/wikipost - 775 sys sys 1178568286 113828
 386/bin/ip/httpfile - 775 sys sys 1178568287 283924
 386/bin/ip/imap4d - 775 sys sys 1178568288 236690
-386/bin/ip/ipconfig - 775 sys sys 1178568288 157284
+386/bin/ip/ipconfig - 775 sys sys 1178654264 156933
 386/bin/ip/linklocal - 775 sys sys 1177530964 42790
 386/bin/ip/ping - 775 sys sys 1178568288 83220
 386/bin/ip/ppp - 775 sys sys 1178568289 218961
 386/bin/ip/pppoe - 775 sys sys 1168402326 77787
 386/bin/ip/pptp - 775 sys sys 1169612026 127215
 386/bin/ip/pptpd - 775 sys sys 1178568289 124670
-386/bin/ip/rarpd - 775 sys sys 1178568290 111605
+386/bin/ip/rarpd - 775 sys sys 1178654264 111254
 386/bin/ip/rexexec - 775 sys sys 1168402327 90215
 386/bin/ip/rip - 775 sys sys 1178568290 89908
 386/bin/ip/rlogind - 775 sys sys 1178568290 66192
@@ -339,7 +339,7 @@
 386/bin/mug - 775 sys sys 1168402336 176379
 386/bin/mv - 775 sys sys 1168402336 66629
 386/bin/ndb - 20000000775 sys sys 985743147 0
-386/bin/ndb/cs - 775 sys sys 1178568293 149435
+386/bin/ndb/cs - 775 sys sys 1178654265 149084
 386/bin/ndb/csquery - 775 sys sys 1176488418 61652
 386/bin/ndb/dns - 775 sys sys 1178568294 285534
 386/bin/ndb/dnsdebug - 775 sys sys 1178568295 260477
@@ -561,7 +561,7 @@
 386/lib/libgeometry.a - 664 sys sys 1168402366 50470
 386/lib/libhtml.a - 664 sys sys 1176432132 229152
 386/lib/libhttpd.a - 664 sys sys 1177283321 99734
-386/lib/libip.a - 664 sys sys 1176520528 35672
+386/lib/libip.a - 664 sys sys 1178654265 34710
 386/lib/libl.a - 664 sys sys 1168402367 5372
 386/lib/libmach.a - 664 sys sys 1173410637 785440
 386/lib/libmemdraw.a - 664 sys sys 1168402369 284092
@@ -7545,7 +7545,7 @@ sys/man/2/hypot - 664 sys sys 944959693 302
 sys/man/2/intmap - 664 sys sys 1015091523 2622
 sys/man/2/ioproc - 664 sys sys 1159419768 3060
 sys/man/2/iounit - 664 sys sys 1015091523 1001
-sys/man/2/ip - 664 sys sys 1173239323 7249
+sys/man/2/ip - 664 sys sys 1178598000 7246
 sys/man/2/isalpharune - 664 sys sys 1015091523 1059
 sys/man/2/keyboard - 664 sys sys 950892860 2065
 sys/man/2/lock - 664 sys sys 1174844415 5704
@@ -7626,7 +7626,7 @@ sys/man/3/cons - 664 sys sys 1133880397 8972
 sys/man/3/draw - 664 sys sys 1040457030 13813
 sys/man/3/dup - 664 sys sys 1015024778 1099
 sys/man/3/env - 664 sys sys 1015024778 1409
-sys/man/3/ether - 664 sys sys 984709635 2563
+sys/man/3/ether - 664 sys sys 1178597986 2890
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/fs - 664 sys sys 1175145095 3147
 sys/man/3/i82365 - 664 sys sys 954378906 884
@@ -15366,7 +15366,7 @@ sys/src/libip/equivip.c - 664 sys sys 1103554773 285
 sys/src/libip/ip.h - 664 sys sys 944961727 1438
 sys/src/libip/ipaux.c - 664 sys sys 985038059 1515
 sys/src/libip/mkfile - 664 sys sys 1065576347 320
-sys/src/libip/myetheraddr.c - 664 sys sys 1066515138 837
+sys/src/libip/myetheraddr.c - 664 sys sys 1178597962 382
 sys/src/libip/myipaddr.c - 664 sys sys 1069766545 841
 sys/src/libip/parseether.c - 664 sys sys 944961726 318
 sys/src/libip/parseip.c - 664 sys sys 1169595542 2429

+ 7 - 7
dist/replica/plan9.db

@@ -302,14 +302,14 @@
 386/bin/ip/httpd/wikipost - 775 sys sys 1178568286 113828
 386/bin/ip/httpfile - 775 sys sys 1178568287 283924
 386/bin/ip/imap4d - 775 sys sys 1178568288 236690
-386/bin/ip/ipconfig - 775 sys sys 1178568288 157284
+386/bin/ip/ipconfig - 775 sys sys 1178654264 156933
 386/bin/ip/linklocal - 775 sys sys 1177530964 42790
 386/bin/ip/ping - 775 sys sys 1178568288 83220
 386/bin/ip/ppp - 775 sys sys 1178568289 218961
 386/bin/ip/pppoe - 775 sys sys 1168402326 77787
 386/bin/ip/pptp - 775 sys sys 1169612026 127215
 386/bin/ip/pptpd - 775 sys sys 1178568289 124670
-386/bin/ip/rarpd - 775 sys sys 1178568290 111605
+386/bin/ip/rarpd - 775 sys sys 1178654264 111254
 386/bin/ip/rexexec - 775 sys sys 1168402327 90215
 386/bin/ip/rip - 775 sys sys 1178568290 89908
 386/bin/ip/rlogind - 775 sys sys 1178568290 66192
@@ -339,7 +339,7 @@
 386/bin/mug - 775 sys sys 1168402336 176379
 386/bin/mv - 775 sys sys 1168402336 66629
 386/bin/ndb - 20000000775 sys sys 985743147 0
-386/bin/ndb/cs - 775 sys sys 1178568293 149435
+386/bin/ndb/cs - 775 sys sys 1178654265 149084
 386/bin/ndb/csquery - 775 sys sys 1176488418 61652
 386/bin/ndb/dns - 775 sys sys 1178568294 285534
 386/bin/ndb/dnsdebug - 775 sys sys 1178568295 260477
@@ -561,7 +561,7 @@
 386/lib/libgeometry.a - 664 sys sys 1168402366 50470
 386/lib/libhtml.a - 664 sys sys 1176432132 229152
 386/lib/libhttpd.a - 664 sys sys 1177283321 99734
-386/lib/libip.a - 664 sys sys 1176520528 35672
+386/lib/libip.a - 664 sys sys 1178654265 34710
 386/lib/libl.a - 664 sys sys 1168402367 5372
 386/lib/libmach.a - 664 sys sys 1173410637 785440
 386/lib/libmemdraw.a - 664 sys sys 1168402369 284092
@@ -7545,7 +7545,7 @@ sys/man/2/hypot - 664 sys sys 944959693 302
 sys/man/2/intmap - 664 sys sys 1015091523 2622
 sys/man/2/ioproc - 664 sys sys 1159419768 3060
 sys/man/2/iounit - 664 sys sys 1015091523 1001
-sys/man/2/ip - 664 sys sys 1173239323 7249
+sys/man/2/ip - 664 sys sys 1178598000 7246
 sys/man/2/isalpharune - 664 sys sys 1015091523 1059
 sys/man/2/keyboard - 664 sys sys 950892860 2065
 sys/man/2/lock - 664 sys sys 1174844415 5704
@@ -7626,7 +7626,7 @@ sys/man/3/cons - 664 sys sys 1133880397 8972
 sys/man/3/draw - 664 sys sys 1040457030 13813
 sys/man/3/dup - 664 sys sys 1015024778 1099
 sys/man/3/env - 664 sys sys 1015024778 1409
-sys/man/3/ether - 664 sys sys 984709635 2563
+sys/man/3/ether - 664 sys sys 1178597986 2890
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/fs - 664 sys sys 1175145095 3147
 sys/man/3/i82365 - 664 sys sys 954378906 884
@@ -15366,7 +15366,7 @@ sys/src/libip/equivip.c - 664 sys sys 1103554773 285
 sys/src/libip/ip.h - 664 sys sys 944961727 1438
 sys/src/libip/ipaux.c - 664 sys sys 985038059 1515
 sys/src/libip/mkfile - 664 sys sys 1065576347 320
-sys/src/libip/myetheraddr.c - 664 sys sys 1066515138 837
+sys/src/libip/myetheraddr.c - 664 sys sys 1178597962 382
 sys/src/libip/myipaddr.c - 664 sys sys 1069766545 841
 sys/src/libip/parseether.c - 664 sys sys 944961726 318
 sys/src/libip/parseip.c - 664 sys sys 1169595542 2429

+ 7 - 0
dist/replica/plan9.log

@@ -48788,3 +48788,10 @@
 1178575216 0 a sys/man/3/bridge - 664 sys sys 1178574591 2921
 1178575216 1 c sys/man/3/ip - 664 sys sys 1178574701 24895
 1178577016 0 c sys/man/3/ip - 664 sys sys 1178575371 25066
+1178598616 0 c sys/man/2/ip - 664 sys sys 1178598000 7246
+1178598616 1 c sys/man/3/ether - 664 sys sys 1178597986 2890
+1178598616 2 c sys/src/libip/myetheraddr.c - 664 sys sys 1178597962 382
+1178654412 0 c 386/bin/ip/ipconfig - 775 sys sys 1178654264 156933
+1178654412 1 c 386/bin/ip/rarpd - 775 sys sys 1178654264 111254
+1178654412 2 c 386/bin/ndb/cs - 775 sys sys 1178654265 149084
+1178654412 3 c 386/lib/libip.a - 664 sys sys 1178654265 34710

+ 1 - 1
sys/man/2/ip

@@ -187,7 +187,7 @@ to a 6-byte Ethernet address starting at
 .IR eaddr .
 .I Myetheraddr
 reads the Ethernet address string from file
-.IB dev /1/stats
+.IB dev /addr
 and parses it into
 .IR eaddr .
 Both routines return a negative number on errors.

+ 20 - 5
sys/man/3/ether

@@ -3,27 +3,42 @@
 ether \- Ethernet device
 .SH SYNOPSIS
 .nf
-.B bind -a #l /net
+.B bind -a #l\fIn\fP /net
 
 .BI /net/ether n /clone
+.BI /net/ether n /addr
+.BI /net/ether n /ifstats
+.BI /net/ether n /stats
 .BI /net/ether n /[0-7]
 .BI /net/ether n /[0-7]/data
 .BI /net/ether n /[0-7]/ctl
 .BI /net/ether n /[0-7]/ifstats
 .BI /net/ether n /[0-7]/stats
 .BI /net/ether n /[0-7]/type
-
 .fi
 .SH DESCRIPTION
 The Ethernet interface,
 .BI /net/ether n\f1,
 is a directory
 containing subdirectories, one for each distinct Ethernet packet type,
-and a
-.B clone
-file.
+and
+.BR clone ,
+.BR addr ,
+.BR ifstats ,
+and
+.B stats
+files.
+.B stats
+and
+.B ifstats
+are the same as in the subdirectories (see below).
+Reading
+.B addr
+returns the MAC address of this interface in hex with no punctuation
+and no trailing newline.
 The number
 .I n
+(optional in the bind)
 is the device number of the card, permitting multiple cards to be used on a single machine.
 .PP
 Each directory contains files to control the associated connection,

+ 7 - 29
sys/src/libip/myetheraddr.c

@@ -6,45 +6,23 @@ int
 myetheraddr(uchar *to, char *dev)
 {
 	int n, fd;
-	char buf[256], *ptr;
+	char buf[256];
 
 	if(*dev == '/')
-		sprint(buf, "%s/stats", dev);
+		sprint(buf, "%s/addr", dev);
 	else
-		sprint(buf, "/net/%s/stats", dev);
+		sprint(buf, "/net/%s/addr", dev);
 
 	fd = open(buf, OREAD);
-	if(fd < 0) {
-		/* try the old place - this code will disappear on Nov 18th */
-		/* Make one exist */
-		if(*dev == '/')
-			sprint(buf, "%s/clone", dev);
-		else
-			sprint(buf, "/net/%s/clone", dev);
-		fd = open(buf, ORDWR);
-		if(fd >= 0)
-			close(fd);
-	
-		if(*dev == '/')
-			sprint(buf, "%s/0/stats", dev);
-		else
-			sprint(buf, "/net/%s/0/stats", dev);
-		fd = open(buf, OREAD);
-		if(fd < 0)
-			return -1;
-	}
+	if(fd < 0)
+		return -1;
 
-	n = read(fd, buf, sizeof(buf)-1);
+	n = read(fd, buf, sizeof buf -1 );
 	close(fd);
 	if(n <= 0)
 		return -1;
 	buf[n] = 0;
 
-	ptr = strstr(buf, "addr: ");
-	if(!ptr)
-		return -1;
-	ptr += 6;
-
-	parseether(to, ptr);
+	parseether(to, buf);
 	return 0;
 }