Browse Source

Plan 9 from Bell Labs 2004-07-30

David du Colombier 17 years ago
parent
commit
9950029d88

+ 15 - 9
dist/replica/_plan9.db

@@ -453,7 +453,7 @@
 386/bin/upas/unspam - 775 sys sys 1064598367 38
 386/bin/upas/vf - 775 sys sys 1087873352 90619
 386/bin/usb - 20000000775 sys sys 1019538890 0
-386/bin/usb/usbaudio - 775 sys sys 1085077118 172912
+386/bin/usb/usbaudio - 775 sys sys 1091071249 172909
 386/bin/usb/usbd - 775 sys sys 1085077118 122174
 386/bin/usb/usbmouse - 775 sys sys 1085077119 138047
 386/bin/usb/usbprinter - 775 sys sys 1089408719 222
@@ -3327,7 +3327,7 @@ sys/doc/venti/venti.pdf - 755 sys sys 1020384352 139090
 sys/doc/venti/venti.ps - 664 sys sys 1019852320 2012620
 sys/games - 20000000775 sys sys 952648872 0
 sys/games/lib - 20000000775 sys sys 952648879 0
-sys/games/lib/fortunes - 664 sys sys 1091022704 248857
+sys/games/lib/fortunes - 664 sys sys 1091127469 249033
 sys/include - 20000000775 sys sys 1016902416 0
 sys/include/9p.h - 664 sys sys 1044836327 4309
 sys/include/String.h - 664 sys sys 1055701304 1291
@@ -5092,7 +5092,7 @@ sys/man/8/scuzz - 664 sys sys 984709640 7916
 sys/man/8/secstore - 664 sys sys 1064807283 1306
 sys/man/8/securenet - 664 sys sys 954305552 3160
 sys/man/8/send - 664 sys sys 1045501634 2168
-sys/man/8/smtp - 664 sys sys 1087406045 4703
+sys/man/8/smtp - 664 sys sys 1091126310 4724
 sys/man/8/snoopy - 664 sys sys 1057752980 3802
 sys/man/8/stats - 664 sys sys 1067722908 4291
 sys/man/8/stub - 664 sys sys 1044830500 943
@@ -5313,7 +5313,7 @@ sys/src/9/pc/devarch.c - 664 sys sys 1087496483 18476
 sys/src/9/pc/devether.c - 664 sys sys 1078928204 10183
 sys/src/9/pc/devfloppy.c - 664 sys sys 1055689885 20024
 sys/src/9/pc/devi82365.c - 664 sys sys 1086406910 19989
-sys/src/9/pc/devlm78.c - 664 sys sys 1026847635 6038
+sys/src/9/pc/devlm78.c - 664 sys sys 1091129037 6255
 sys/src/9/pc/devlml.c - 664 sys sys 1026847636 7486
 sys/src/9/pc/devlml.h - 664 sys sys 1026847636 2948
 sys/src/9/pc/devlpt.c - 664 sys sys 1015014514 4420
@@ -5362,7 +5362,7 @@ sys/src/9/pc/main.c - 664 sys sys 1089046997 14677
 sys/src/9/pc/mem.h - 664 sys sys 1018553448 4573
 sys/src/9/pc/memory.c - 664 sys sys 1071245460 13028
 sys/src/9/pc/mkfile - 664 sys sys 1067810339 3219
-sys/src/9/pc/mmu.c - 664 sys sys 1049509456 10014
+sys/src/9/pc/mmu.c - 664 sys sys 1091110410 10043
 sys/src/9/pc/mouse.c - 664 sys sys 1065717607 6625
 sys/src/9/pc/mp.c - 664 sys sys 1084475127 17013
 sys/src/9/pc/mp.h - 664 sys sys 1015014520 6575
@@ -5378,7 +5378,7 @@ sys/src/9/pc/pcfl - 664 sys sys 1042004821 1563
 sys/src/9/pc/pcflop - 664 sys sys 1067722894 1383
 sys/src/9/pc/pci.c - 664 sys sys 1087657460 25736
 sys/src/9/pc/pcmciamodem.c - 664 sys sys 1048635123 1545
-sys/src/9/pc/piix4smbus.c - 664 sys sys 1067722684 5273
+sys/src/9/pc/piix4smbus.c - 664 sys sys 1091129037 5230
 sys/src/9/pc/plan9l.s - 664 sys sys 1015014521 910
 sys/src/9/pc/psaux.c - 664 sys sys 1026847650 915
 sys/src/9/pc/ptclbsum386.s - 664 sys sys 1015014521 1493
@@ -9342,7 +9342,7 @@ sys/src/cmd/gzip/mkfile - 664 sys sys 984758036 125
 sys/src/cmd/gzip/unzip.c - 664 sys sys 1050689595 13603
 sys/src/cmd/gzip/zip.c - 664 sys sys 1033183074 7054
 sys/src/cmd/gzip/zip.h - 664 sys sys 954778719 1428
-sys/src/cmd/hget.c - 664 sys sys 1081651071 24671
+sys/src/cmd/hget.c - 664 sys sys 1091129591 25650
 sys/src/cmd/history.c - 664 sys sys 1084471627 6117
 sys/src/cmd/hoc - 20000000775 sys sys 954036932 0
 sys/src/cmd/hoc/code.c - 664 sys sys 944961000 10041
@@ -10870,7 +10870,7 @@ sys/src/cmd/upas/send/skipequiv.c - 664 sys sys 944961322 1747
 sys/src/cmd/upas/send/translate.c - 664 sys sys 944961322 804
 sys/src/cmd/upas/send/tryit - 664 sys sys 944961322 584
 sys/src/cmd/upas/smtp - 20000000775 sys sys 988250017 0
-sys/src/cmd/upas/smtp/greylist.c - 664 sys sys 1075211327 6300
+sys/src/cmd/upas/smtp/greylist.c - 664 sys sys 1091126808 6470
 sys/src/cmd/upas/smtp/mkfile - 664 sys sys 1067722781 746
 sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1055703150 4887
 sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417
@@ -12339,4 +12339,10 @@ usr/glenda/lib/profile - 664 glenda glenda 1021580005 847
 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
-386/bin/usb/usbaudio - 775 sys sys 1091071249 172909
+386/9loaddebug - 775 sys sys 1091156989 270242
+386/9pc - 775 sys sys 1091156992 1808630
+386/9pccpu - 775 sys sys 1091156995 1464782
+386/9pcdisk - 775 sys sys 1091156999 2011236
+386/9pcf - 775 sys sys 1091157003 2342879
+386/bin/hget - 775 sys sys 1091156987 230376
+386/bin/upas/smtpd - 775 sys sys 1091156988 324025

+ 14 - 14
dist/replica/plan9.db

@@ -1,15 +1,15 @@
 386 - 20000000775 sys sys 1010957353 0
 386/9load - 775 sys sys 1088798345 188040
-386/9loaddebug - 775 sys sys 1089402462 270242
+386/9loaddebug - 775 sys sys 1091156989 270242
 386/9loadlite - 775 sys sys 1088798346 125004
 386/9loadlitedebug - 775 sys sys 1089402462 183654
-386/9pc - 775 sys sys 1090688306 1808618
+386/9pc - 775 sys sys 1091156992 1808630
 386/9pc.gz - 664 sys sys 1077049336 635727
-386/9pccpu - 775 sys sys 1089402468 1464770
+386/9pccpu - 775 sys sys 1091156995 1464782
 386/9pccpu.gz - 664 sys sys 1077049387 519909
-386/9pcdisk - 775 sys sys 1090688310 2011224
+386/9pcdisk - 775 sys sys 1091156999 2011236
 386/9pcdisk.gz - 664 sys sys 1040006345 703136
-386/9pcf - 775 sys sys 1090688315 2342867
+386/9pcf - 775 sys sys 1091157003 2342879
 386/9pcf.gz - 664 sys sys 1077049490 872650
 386/9pxeload - 775 sys sys 1088798346 188040
 386/_9pcdisk.gz - 664 sys sys 1039764191 695837
@@ -249,7 +249,7 @@
 386/bin/gview - 775 sys sys 1087873351 235313
 386/bin/gzip - 775 sys sys 1085077061 82899
 386/bin/hayes - 775 sys sys 1085077062 62579
-386/bin/hget - 775 sys sys 1089257531 224015
+386/bin/hget - 775 sys sys 1091156987 230376
 386/bin/history - 775 sys sys 1085077062 72883
 386/bin/hoc - 775 sys sys 1085077062 97889
 386/bin/html2ms - 775 sys sys 1085077063 64059
@@ -445,7 +445,7 @@
 386/bin/upas/scanmail - 775 sys sys 1085077115 126758
 386/bin/upas/send - 775 sys sys 1085077116 189534
 386/bin/upas/smtp - 775 sys sys 1085077116 271187
-386/bin/upas/smtpd - 775 sys sys 1089257540 324203
+386/bin/upas/smtpd - 775 sys sys 1091156988 324025
 386/bin/upas/spam - 775 sys sys 1064598366 36
 386/bin/upas/testscan - 775 sys sys 1085077117 81626
 386/bin/upas/token - 775 sys sys 1085077117 75518
@@ -3327,7 +3327,7 @@ sys/doc/venti/venti.pdf - 755 sys sys 1020384352 139090
 sys/doc/venti/venti.ps - 664 sys sys 1019852320 2012620
 sys/games - 20000000775 sys sys 952648872 0
 sys/games/lib - 20000000775 sys sys 952648879 0
-sys/games/lib/fortunes - 664 sys sys 1091022704 248857
+sys/games/lib/fortunes - 664 sys sys 1091127469 249033
 sys/include - 20000000775 sys sys 1016902416 0
 sys/include/9p.h - 664 sys sys 1044836327 4309
 sys/include/String.h - 664 sys sys 1055701304 1291
@@ -5092,7 +5092,7 @@ sys/man/8/scuzz - 664 sys sys 984709640 7916
 sys/man/8/secstore - 664 sys sys 1064807283 1306
 sys/man/8/securenet - 664 sys sys 954305552 3160
 sys/man/8/send - 664 sys sys 1045501634 2168
-sys/man/8/smtp - 664 sys sys 1087406045 4703
+sys/man/8/smtp - 664 sys sys 1091126310 4724
 sys/man/8/snoopy - 664 sys sys 1057752980 3802
 sys/man/8/stats - 664 sys sys 1067722908 4291
 sys/man/8/stub - 664 sys sys 1044830500 943
@@ -5313,7 +5313,7 @@ sys/src/9/pc/devarch.c - 664 sys sys 1087496483 18476
 sys/src/9/pc/devether.c - 664 sys sys 1078928204 10183
 sys/src/9/pc/devfloppy.c - 664 sys sys 1055689885 20024
 sys/src/9/pc/devi82365.c - 664 sys sys 1086406910 19989
-sys/src/9/pc/devlm78.c - 664 sys sys 1026847635 6038
+sys/src/9/pc/devlm78.c - 664 sys sys 1091129037 6255
 sys/src/9/pc/devlml.c - 664 sys sys 1026847636 7486
 sys/src/9/pc/devlml.h - 664 sys sys 1026847636 2948
 sys/src/9/pc/devlpt.c - 664 sys sys 1015014514 4420
@@ -5362,7 +5362,7 @@ sys/src/9/pc/main.c - 664 sys sys 1089046997 14677
 sys/src/9/pc/mem.h - 664 sys sys 1018553448 4573
 sys/src/9/pc/memory.c - 664 sys sys 1071245460 13028
 sys/src/9/pc/mkfile - 664 sys sys 1067810339 3219
-sys/src/9/pc/mmu.c - 664 sys sys 1049509456 10014
+sys/src/9/pc/mmu.c - 664 sys sys 1091110410 10043
 sys/src/9/pc/mouse.c - 664 sys sys 1065717607 6625
 sys/src/9/pc/mp.c - 664 sys sys 1084475127 17013
 sys/src/9/pc/mp.h - 664 sys sys 1015014520 6575
@@ -5378,7 +5378,7 @@ sys/src/9/pc/pcfl - 664 sys sys 1042004821 1563
 sys/src/9/pc/pcflop - 664 sys sys 1067722894 1383
 sys/src/9/pc/pci.c - 664 sys sys 1087657460 25736
 sys/src/9/pc/pcmciamodem.c - 664 sys sys 1048635123 1545
-sys/src/9/pc/piix4smbus.c - 664 sys sys 1067722684 5273
+sys/src/9/pc/piix4smbus.c - 664 sys sys 1091129037 5230
 sys/src/9/pc/plan9l.s - 664 sys sys 1015014521 910
 sys/src/9/pc/psaux.c - 664 sys sys 1026847650 915
 sys/src/9/pc/ptclbsum386.s - 664 sys sys 1015014521 1493
@@ -9342,7 +9342,7 @@ sys/src/cmd/gzip/mkfile - 664 sys sys 984758036 125
 sys/src/cmd/gzip/unzip.c - 664 sys sys 1050689595 13603
 sys/src/cmd/gzip/zip.c - 664 sys sys 1033183074 7054
 sys/src/cmd/gzip/zip.h - 664 sys sys 954778719 1428
-sys/src/cmd/hget.c - 664 sys sys 1081651071 24671
+sys/src/cmd/hget.c - 664 sys sys 1091129591 25650
 sys/src/cmd/history.c - 664 sys sys 1084471627 6117
 sys/src/cmd/hoc - 20000000775 sys sys 954036932 0
 sys/src/cmd/hoc/code.c - 664 sys sys 944961000 10041
@@ -10870,7 +10870,7 @@ sys/src/cmd/upas/send/skipequiv.c - 664 sys sys 944961322 1747
 sys/src/cmd/upas/send/translate.c - 664 sys sys 944961322 804
 sys/src/cmd/upas/send/tryit - 664 sys sys 944961322 584
 sys/src/cmd/upas/smtp - 20000000775 sys sys 988250017 0
-sys/src/cmd/upas/smtp/greylist.c - 664 sys sys 1075211327 6300
+sys/src/cmd/upas/smtp/greylist.c - 664 sys sys 1091126808 6470
 sys/src/cmd/upas/smtp/mkfile - 664 sys sys 1067722781 746
 sys/src/cmd/upas/smtp/mxdial.c - 664 sys sys 1055703150 4887
 sys/src/cmd/upas/smtp/rfc822.y - 664 sys sys 1064589606 13417

+ 14 - 0
dist/replica/plan9.log

@@ -16332,3 +16332,17 @@
 1091023263 2 c sys/src/9/ppc/mem.h - 664 sys sys 1091021860 7002
 1091023263 3 c sys/src/cmd/usb/audio/main.c - 664 sys sys 1091021907 9533
 1091071873 0 c 386/bin/usb/usbaudio - 775 sys sys 1091071249 172909
+1091111482 0 c sys/src/9/pc/mmu.c - 664 sys sys 1091110410 10043
+1091127684 0 c sys/games/lib/fortunes - 664 sys sys 1091127469 249033
+1091127684 1 c sys/man/8/smtp - 664 sys sys 1091126310 4724
+1091127684 2 c sys/src/cmd/upas/smtp/greylist.c - 664 sys sys 1091126808 6470
+1091129484 0 c sys/src/9/pc/piix4smbus.c - 664 sys sys 1091129037 5230
+1091129484 1 c sys/src/9/pc/devlm78.c - 664 sys sys 1091129037 6255
+1091131285 0 c sys/src/cmd/hget.c - 664 sys sys 1091129591 25650
+1091158290 0 c 386/9loaddebug - 775 sys sys 1091156989 270242
+1091158290 1 c 386/9pc - 775 sys sys 1091156992 1808630
+1091158290 2 c 386/9pccpu - 775 sys sys 1091156995 1464782
+1091158290 3 c 386/9pcdisk - 775 sys sys 1091156999 2011236
+1091158290 4 c 386/9pcf - 775 sys sys 1091157003 2342879
+1091158290 5 c 386/bin/hget - 775 sys sys 1091156987 230376
+1091158290 6 c 386/bin/upas/smtpd - 775 sys sys 1091156988 324025

+ 1 - 0
sys/games/lib/fortunes

@@ -4013,3 +4013,4 @@ I am he as you are he as you are me and we are all together. - forsyth after Len
 Network services at the Murray Hill, NJ, location (100001) will be unavailable due to UPS (Uninterrupted Power Supply) maintenance from 8:00 p.m. EDT on Saturday, June 26, to 4:00 a.m. EDT on Sunday, June 27.
 Don't show this message again.
 Service error -27.
+Beauty is more important in computing than anywhere else in technology because software is so complicated. Beauty is the ultimate defence against complexity. - David Gelernter

+ 2 - 1
sys/man/8/smtp

@@ -115,7 +115,8 @@ turns on forward DNS validation of non-trusted sender address.
 .B -g
 turns on grey/white list processing.  All mail is rejected (with a
 retry code) unless the sender's IP address is on the whitelist,
-.BR /mail/lib/whitelist .
+.BR /mail/lib/whitelist ,
+an append only file.
 Addresses can be added to the whitelist by the administrator.  However,
 the usual way for addresses to be added is by smtpd itself.  Whenever,
 a message is received and the sender's address isn't on the whitelist,

+ 70 - 67
sys/src/9/pc/devlm78.c

@@ -7,46 +7,47 @@
 #include "ureg.h"
 #include "../port/error.h"
 
-// this driver doesn't implement the management interrupts.  we
-// leave the LM78 interrupts set to whatever the BIOS did.  we do
-// allow reading and writing the the readouts and alarm values.
-// Read(2)ing or write(2)ing at offset 0x0-0x1f, is
-// equivalent to reading or writing lm78 registers 0x20-0x3f.
+/* this driver doesn't implement the management interrupts.  we
+ * leave the LM78 interrupts set to whatever the BIOS did.  we do
+ * allow reading and writing the the readouts and alarm values.
+ * Read(2)ing or write(2)ing at offset 0x0-0x1f, is
+ * equivalent to reading or writing lm78 registers 0x20-0x3f.
+ */
 enum
 {
-	// address of chip on serial interface
+	/*  address of chip on serial interface */
 	Serialaddr=	0x2d,
 
-	// parallel access registers
+	/*  parallel access registers */
 	Rpaddr=		0x5,
-	 Bbusy=		 (1<<7),
+	Bbusy=		 (1<<7),
 	Rpdata=		0x6,
 
-	// internal register addresses
+	/*  internal register addresses */
 	Rconfig=	0x40,
-	 Bstart=	 (1<<0),
-	 Bsmiena=	 (1<<1),
-	 Birqena=	 (1<<2),
-	 Bintclr=	 (1<<3),
-	 Breset=	 (1<<4),
-	 Bnmi=		 (1<<5),	// if set, use nmi, else irq
-	 Bpowbypass=	 (1<<6),
-	 Binit=		 (1<<7),
+	Bstart=		 (1<<0),
+	Bsmiena=	 (1<<1),
+	Birqena=	 (1<<2),
+	Bintclr=	 (1<<3),
+	Breset=		 (1<<4),
+	Bnmi=		 (1<<5),	/*  if set, use nmi, else irq */
+	Bpowbypass=	 (1<<6),
+	Binit=		 (1<<7),
 	Ristat1=	0x41,
 	Ristat2=	0x42,
 	Rsmimask1=	0x43,
 	Rsmimask2=	0x44,
 	Rnmimask1=	0x45,
 	Rnmimask2=	0x46,
-	Rvidfan=	0x47,		// set fan counter, and read voltage level
-	 Mvid=		 0x0f,
-	 Mfan=		 0xf0,
-	Raddr=		0x48,		// address used on serial bus
-	Rresetid=	0x49,		// chip reset and ID register
-	Rpost=		0x00,		// start of post ram
-	Rvalue=		0x20,		// start of value ram
-
-	VRsize=		0x20,		// size of value ram
+	Rvidfan=	0x47,		/*  set fan counter, and read voltage level */
+	Mvid=		 0x0f,
+	Mfan=		 0xf0,
+	Raddr=		0x48,		/*  address used on serial bus */
+	Rresetid=	0x49,		/*  chip reset and ID register */
+	Rpost=		0x00,		/*  start of post ram */
+	Rvalue=		0x20,		/*  start of value ram */
+
+	VRsize=		0x20,		/*  size of value ram */
 };
 
 enum
@@ -56,10 +57,10 @@ enum
 };
 
 static Dirtab lm78dir[] = {
-	"lm78vram",		{ Qlm78vram, 0 },		0,	0444,
+	"lm78vram",	{ Qlm78vram, 0 },	0,	0444,
 };
 
-// interface type
+/*  interface type */
 enum
 {
 	None=	0,
@@ -70,15 +71,15 @@ enum
 static struct {
 	QLock;
 	int	probed;
-	int 	ifc;	// which interface is connected
-	SMBus	*smbus;	// serial interface
-	int	port;	// parallel interface
+	int 	ifc;	/*  which interface is connected */
+	SMBus	*smbus;	/*  serial interface */
+	int	port;	/*  parallel interface */
 } lm78;
 
 extern SMBus*	piix4smbus(void);
 
-// wait for device to become quiescent and then set the
-// register address
+/*  wait for device to become quiescent and then set the */
+/*  register address */
 static void
 setreg(int reg)
 {
@@ -92,7 +93,7 @@ setreg(int reg)
 	error("lm78 broken");
 }
 
-// routines that actually touch the device
+/*  routines that actually touch the device */
 static void
 lm78wrreg(int reg, uchar val)
 {
@@ -149,10 +150,10 @@ lm78rdreg(int reg)
 	return val;
 }
 
-// start the chip monitoring but don't change any smi
-// interrupts and/or alarms that the BIOS may have set up.
-//
-// this isn't locked because it's thought to be idempotent
+/*  start the chip monitoring but don't change any smi 
+ *  interrupts and/or alarms that the BIOS may have set up. 
+ *  this isn't locked because it's thought to be idempotent 
+ */
 static void
 lm78enable(void)
 {
@@ -162,12 +163,12 @@ lm78enable(void)
 		error(Enodev);
 
 	if(lm78.probed == 0){
-		// make sure its really there
+		/*  make sure its really there */
 		if(lm78rdreg(Raddr) != Serialaddr){
 			lm78.ifc = None;
 			error(Enodev);
 		} else {
-			// start the sampling
+			/*  start the sampling */
 			config = lm78rdreg(Rconfig);
 			config = (config | Bstart) & ~(Bintclr|Binit);
 			lm78wrreg(Rconfig, config);
@@ -183,13 +184,13 @@ enum
 	PiixID=		0x122E,
 	Piix3ID=	0x7000,
 
-	Piix4PMID=	0x7113,		// PIIX4 power management function
+	Piix4PMID=	0x7113,		/*  PIIX4 power management function */
 
-	PCSC=		0x78,		// programmable chip select control register
+	PCSC=		0x78,		/*  programmable chip select control register */
 	PCSC8bytes=	0x01,
 };
 
-// figure out what kind of interface we could have
+/*  figure out what kind of interface we could have */
 void
 lm78reset(void)
 {
@@ -200,10 +201,10 @@ lm78reset(void)
 	p = nil;
 	while((p = pcimatch(p, IntelVendID, 0)) != nil){
 		switch(p->did){
-		// these bridges use the PCSC to map the lm78 into port space.
-		// for this case the lm78's CS# select is connected to the PIIX's
-		// PCS# output and the bottom 3 bits of address are passed to the
-		// LM78's A0-A2 inputs.
+		/*  these bridges use the PCSC to map the lm78 into port space. */
+		/*  for this case the lm78's CS# select is connected to the PIIX's */
+		/*  PCS# output and the bottom 3 bits of address are passed to the */
+		/*  LM78's A0-A2 inputs. */
 		case PiixID:
 		case Piix3ID:
 			pcs = pcicfgr16(p, PCSC);
@@ -214,14 +215,14 @@ lm78reset(void)
 				return;	
 			}
 
-			// enable the chip, use default address 0x50
+			/*  enable the chip, use default address 0x50 */
 			pcicfgw16(p, PCSC, 0x50|PCSC8bytes);
 			pcs = pcicfgr16(p, PCSC);
 			lm78.port = pcs & ~3;
 			lm78.ifc = Parallel;
 			return;
 
-		// this bridge puts the lm78's serial interface on the smbus
+		/*  this bridge puts the lm78's serial interface on the smbus */
 		case Piix4PMID:
 			lm78.smbus = piix4smbus();
 			if(lm78.smbus == nil)
@@ -233,24 +234,16 @@ lm78reset(void)
 	}
 }
 
-static Chan*
-lm78attach(char* spec)
+Walkqid *
+lm78walk(Chan* c, Chan *nc, char** name, int nname)
 {
-	lm78enable();
-
-	return devattach('T', spec);
+	return devwalk(c, nc, name, nname, lm78dir, nelem(lm78dir), devgen);
 }
 
-int
-lm78walk(Chan* c, char* name)
-{
-	return devwalk(c, name, lm78dir, nelem(lm78dir), devgen);
-}
-
-static void
-lm78stat(Chan* c, char* dp)
+static int
+lm78stat(Chan* c, uchar* dp, int n)
 {
-	devstat(c, dp, lm78dir, nelem(lm78dir), devgen);
+	return devstat(c, dp, n, lm78dir, nelem(lm78dir), devgen);
 }
 
 static Chan*
@@ -277,7 +270,7 @@ lm78read(Chan *c, void *a, long n, vlong offset)
 
 	off = offset;
 
-	switch(c->qid.path & ~CHDIR){
+	switch((ulong)c->qid.path){
 	case Qdir:
 		return devdirread(c, a, n, lm78dir, nelem(lm78dir), devgen);
 
@@ -289,7 +282,7 @@ lm78read(Chan *c, void *a, long n, vlong offset)
 			e = VRsize;
 		for(; off < e; off++)
 			*va++ = lm78rdreg(Rvalue+off);
-		return va - (uchar*)a;
+		return (int)(va - (uchar*)a);
 	}
 	return 0;
 }
@@ -302,7 +295,7 @@ lm78write(Chan *c, void *a, long n, vlong offset)
 
 	off = offset;
 
-	switch(c->qid.path){
+	switch((ulong)c->qid.path){
 	default:
 		error(Eperm);
 
@@ -319,14 +312,24 @@ lm78write(Chan *c, void *a, long n, vlong offset)
 	return 0;
 }
 
+extern Dev lm78devtab;
+
+static Chan*
+lm78attach(char* spec)
+{
+	lm78enable();
+
+	return devattach(lm78devtab.dc, spec);
+}
+
 Dev lm78devtab = {
 	'T',
 	"lm78",
 
 	lm78reset,
 	devinit,
+	devshutdown,
 	lm78attach,
-	devclone,
 	lm78walk,
 	lm78stat,
 	lm78open,

+ 1 - 0
sys/src/9/pc/mmu.c

@@ -87,6 +87,7 @@ mmuinit(void)
 
 	m->tss = malloc(sizeof(Tss));
 	memset(m->tss, 0, sizeof(Tss));
+	m->tss->iomap = 0xDFFF<<16;
 
 	/*
 	 * We used to keep the GDT in the Mach structure, but it

+ 32 - 32
sys/src/9/pc/piix4smbus.c

@@ -16,45 +16,45 @@ enum
 	// SMBus configuration registers (function 3)
 	SMBbase=	0x90,		// 4 byte base address (bit 0 == 1, bit 3:1 == 0)
 	SMBconfig=	0xd2,
-	 SMBintrselect=	(7<<1),
-	  SMIenable=	(0<<1),		//  interrupts sent to SMI#
-	  IRQ9enable=	(4<<1),		//  intettupts sent to IRQ9
-	 SMBenable=	(1<<0),		//  1 enables
+	SMBintrselect=	(7<<1),
+	SMIenable=	(0<<1),		//  interrupts sent to SMI#
+	IRQ9enable=	(4<<1),		//  intettupts sent to IRQ9
+	SMBenable=	(1<<0),		//  1 enables
 
 	// SMBus IO space registers
 	Hoststatus=	0x0,		//  (writing 1 bits reset the interrupt bits)
-	 Failed=	(1<<4),	 	//  transaction terminated by KILL
-	 Bus_error=	(1<<3),		//  transactio collision
-	 Dev_error=	(1<<2),		//  device error interrupt
-	 Host_complete=	(1<<1),		//  host command completion interrupt 
-	 Host_busy=	(1<<0),		//
+	Failed=		(1<<4),	 	//  transaction terminated by KILL
+	Bus_error=	(1<<3),		//  transactio collision
+	Dev_error=	(1<<2),		//  device error interrupt
+	Host_complete=	(1<<1),		//  host command completion interrupt 
+	Host_busy=	(1<<0),		//
 	Slavestatus=	0x1,		//  (writing 1 bits reset)
-	 Alert_sts=	(1<<5),		//  someone asserted SMBALERT#
-	 Shdw2_sts=	(1<<4),		//  slave accessed shadow 2 port
-	 Shdw1_sts=	(1<<3),		//  slave accessed shadow 1 port
-	 Slv_sts=	(1<<2),		//  slave accessed shadow 1 port
-	 Slv_bsy=	(1<<0),
+	Alert_sts=	(1<<5),		//  someone asserted SMBALERT#
+	Shdw2_sts=	(1<<4),		//  slave accessed shadow 2 port
+	Shdw1_sts=	(1<<3),		//  slave accessed shadow 1 port
+	Slv_sts=	(1<<2),		//  slave accessed shadow 1 port
+	Slv_bsy=	(1<<0),
 	Hostcontrol=	0x2,
-	 Start=		(1<<6),		//  start execution
-	 Cmd_prot=	(7<<2),		//  command protocol mask
-	  Quick=	(0<<2),		//   address only
-	  Byte=		(1<<2),		//   address + cmd
-	  ByteData=	(2<<2),		//   address + cmd + data
-	  WordData=	(3<<2),		//   address + cmd + data + data
-	 Kill=		(1<<1),		//  abort in progress command
-	 Ienable=	(1<<0),		//  enable completion interrupts
+	Start=		(1<<6),		//  start execution
+	Cmd_prot=	(7<<2),		//  command protocol mask
+	Quick=		(0<<2),		//   address only
+	Byte=		(1<<2),		//   address + cmd
+	ByteData=	(2<<2),		//   address + cmd + data
+	WordData=	(3<<2),		//   address + cmd + data + data
+	Kill=		(1<<1),		//  abort in progress command
+	Ienable=	(1<<0),		//  enable completion interrupts
 	Hostcommand=	0x3,
 	Hostaddress=	0x4,
-	 AddressMask=	(0x7f<<1),	//  target address
-	 Read=		(1<<0),		//  1 == read, 0 == write
+	AddressMask=	(0x7f<<1),	//  target address
+	Read=		(1<<0),		//  1 == read, 0 == write
 	Hostdata0=	0x5,
 	Hostdata1=	0x6,
 	Blockdata=	0x7,
 	Slavecontrol=	0x8,
-	 Alert_en=	(1<<3),		//  enable inter on SMBALERT#
-	 Shdw2_en=	(1<<2),		//  enable inter on external shadow 2 access
-	 Shdw1_en=	(1<<1),		//  enable inter on external shadow 1 access
-	 Slv_en=	(1<<0),		//  enable inter on access of host ctlr slave port
+	Alert_en=	(1<<3),		//  enable inter on SMBALERT#
+	Shdw2_en=	(1<<2),		//  enable inter on external shadow 2 access
+	Shdw1_en=	(1<<1),		//  enable inter on external shadow 1 access
+	Slv_en=		(1<<0),		//  enable inter on access of host ctlr slave port
 	Shadowcommand=	0x9,
 	Slaveevent=	0xa,
 	Slavedata=	0xc,
@@ -81,7 +81,7 @@ static void
 transact(SMBus *s, int type, int addr, int cmd, uchar *data)
 {
 	int tries, status;
-	char err[ERRLEN];
+	char err[256];
 
 	if(type < 0 || type > nelem(proto))
 		panic("piix4smbus: illegal transaction type %d", type);
@@ -96,7 +96,7 @@ transact(SMBus *s, int type, int addr, int cmd, uchar *data)
 	for(tries = 0; tries < 1000000; tries++){
 		if((inb(s->base+Hoststatus) & Host_busy) == 0)
 			break;
-		sched(nil);
+		sched();
 	}
 	if(tries >= 1000000){
 		// try aborting current transaction
@@ -104,7 +104,7 @@ transact(SMBus *s, int type, int addr, int cmd, uchar *data)
 		for(tries = 0; tries < 1000000; tries++){
 			if((inb(s->base+Hoststatus) & Host_busy) == 0)
 				break;
-			sched(nil);
+			sched();
 		}
 		if(tries >= 1000000){
 			snprint(err, sizeof(err), "SMBus jammed: %2.2ux", inb(s->base+Hoststatus));
@@ -138,7 +138,7 @@ transact(SMBus *s, int type, int addr, int cmd, uchar *data)
 		status = inb(s->base+Hoststatus);
 		if(status & (Failed|Bus_error|Dev_error|Host_complete))
 			break;
-		sched(nil);
+		sched();
 	}
 	if((status & Host_complete) == 0){
 		snprint(err, sizeof(err), "SMBus request failed: %2.2ux", status);

+ 51 - 6
sys/src/cmd/hget.c

@@ -4,6 +4,7 @@
 #include <bio.h>
 #include <ip.h>
 #include <libsec.h>
+#include <auth.h>
 
 typedef struct URL URL;
 struct URL
@@ -15,6 +16,7 @@ struct URL
 	char	*etag;
 	char	*redirect;
 	char	*postbody;
+	char	*cred;
 	long	mtime;
 };
 
@@ -316,7 +318,7 @@ int
 dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
 {
 	int fd, cfd;
-	int redirect, loop;
+	int redirect, auth, loop;
 	int n, rv, code;
 	long tot, vtime;
 	Tm *tm;
@@ -377,6 +379,9 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
 						"Pragma: no-cache\r\n",
 						u->host, u->page, u->host);
 			}
+			if(u->cred)
+				dfprint(fd,	"Authorization: Basic %s\r\n",
+						u->cred);
 		} else {
 			dfprint(fd,	"POST %s HTTP/1.0\r\n"
 					"Host: %s\r\n"
@@ -410,8 +415,10 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
 				cfd = -1;
 			}
 		}
+			
 		dfprint(fd, "\r\n", u->host);
 
+		auth = 0;
 		redirect = 0;
 		initibuf();
 		code = httprcode(fd);
@@ -449,6 +456,11 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
 			sysfatal("Bad Request");
 
 		case 401:	/* Unauthorized */
+			if (auth)
+				sysfatal("Authentication failed");
+			auth = 1;
+			break;
+
 		case 402:	/* ??? */
 			sysfatal("Unauthorized");
 
@@ -458,6 +470,9 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
 		case 404:	/* Not Found */
 			sysfatal("Not found on server");
 
+		case 407:	/* Proxy Authentication */
+			sysfatal("Proxy authentication required");
+
 		case 500:	/* Internal server error */
 			sysfatal("Server choked");
 
@@ -486,13 +501,15 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
 			return rv;
 		}
 
-		if(!redirect)
+		if(!redirect && !auth)
 			break;
 
-		if(u->redirect == nil)
-			sysfatal("redirect: no URL");
-		if(crackurl(u, u->redirect) < 0)
-			sysfatal("redirect: %r");
+		if (redirect){
+			if(u->redirect == nil)
+				sysfatal("redirect: no URL");
+			if(crackurl(u, u->redirect) < 0)
+				sysfatal("redirect: %r");
+		}
 	}
 
 	/* transfer whatever you get */
@@ -562,6 +579,7 @@ void	hhclen(char*, URL*, Range*);
 void	hhcrange(char*, URL*, Range*);
 void	hhuri(char*, URL*, Range*);
 void	hhlocation(char*, URL*, Range*);
+void	hhauth(char*, URL*, Range*);
 
 struct {
 	char *name;
@@ -573,6 +591,7 @@ struct {
 	{ "content-range:", hhcrange },
 	{ "uri:", hhuri },
 	{ "location:", hhlocation },
+	{ "WWW-Authenticate:", hhauth },
 };
 int
 httpheaders(int fd, int cfd, URL *u, Range *r)
@@ -764,6 +783,31 @@ hhlocation(char *p, URL *u, Range*)
 	u->redirect = strdup(p);
 }
 
+void
+hhauth(char *p, URL *u, Range*)
+{
+	char *f[4];
+	UserPasswd *up;
+	char *s, cred[64];
+
+	if (cistrncmp(p, "basic ", 6) != 0)
+		sysfatal("only Basic authentication supported");
+
+	if (gettokens(p, f, nelem(f), "\"") < 2)
+		sysfatal("garbled auth data");
+
+	if ((up = auth_getuserpasswd(auth_getkey, "proto=pass service=http dom=%q relm=%q",
+	    	u->host, f[1])) == nil)
+			sysfatal("cannot authenticate");
+
+	s = smprint("%s:%s", up->user, up->passwd);
+	if(enc64(cred, sizeof(cred), (uchar *)s, strlen(s)) == -1)
+		sysfatal("enc64");
+  		free(s);
+
+	assert(u->cred = strdup(cred));
+}
+
 enum
 {
 	/* ftp return codes */
@@ -1421,3 +1465,4 @@ output(Out *out, char *buf, int nb)
 	}
 	return n + d;
 }
+

+ 6 - 1
sys/src/cmd/upas/smtp/greylist.c

@@ -3,6 +3,7 @@
 #include "smtp.h"
 #include <ctype.h>
 #include <ip.h>
+#include <ndb.h>
 
 typedef struct {
 	int	existed;	/* these two are distinct to cope with errors */
@@ -240,6 +241,7 @@ isrcptrecent(char *rcpt)
 void
 vfysenderhostok(void)
 {
+	char *fqdn;
 	int recent = 0;
 	Link *l;
 
@@ -256,7 +258,10 @@ vfysenderhostok(void)
 
 		if (fd >= 0) {
 			seek(fd, 0, 2);			/* paranoia */
-			fprint(fd, "%s\n", nci->rsys);
+			if ((fqdn = csgetvalue(nil, "ip", nci->rsys, "dom", nil)) != nil)
+				fprint(fd, "# %s\n%s\n\n", fqdn, nci->rsys);
+			else
+				fprint(fd, "# unknown\n%s\n\n", nci->rsys);
 			close(fd);
 		}
 	} else {