Browse Source

Plan 9 from Bell Labs 2009-01-16

David du Colombier 15 years ago
parent
commit
b69e9c59e7
55 changed files with 681 additions and 888 deletions
  1. 4 3
      lib/face/48x48x8/.dict
  2. 98 56
      lib/pci
  3. 2 0
      rc/bin/ps2pdf
  4. 5 3
      sys/lib/dist/pc/mkfile
  5. 1 1
      sys/lib/lp/process/generic
  6. 1 1
      sys/lib/lp/process/gspipe
  7. 1 0
      sys/lib/mimetype
  8. 0 2
      sys/lib/sysconfig/proto/armpaqproto
  9. 5 0
      sys/lib/tmac/tmac.s
  10. 23 0
      sys/man/1/con
  11. 7 0
      sys/man/1/ps2pdf
  12. 6 0
      sys/man/2/exec
  13. 4 1
      sys/man/4/fossil
  14. 7 0
      sys/man/8/ping
  15. 2 2
      sys/src/9/pc/devarch.c
  16. 2 0
      sys/src/9/pc/ether82598.c
  17. 1 0
      sys/src/9/pc/main.c
  18. 18 14
      sys/src/9/pc/usbuhci.c
  19. 1 0
      sys/src/ape/lib/ap/power/tas.s
  20. 14 7
      sys/src/cmd/9660srv/9660srv.c
  21. 3 3
      sys/src/cmd/9660srv/iso9660.h
  22. 1 1
      sys/src/cmd/aquarela/smbglobals.c
  23. 22 9
      sys/src/cmd/auth/authsrv.c
  24. 13 7
      sys/src/cmd/auth/factotum/fs.c
  25. 3 1
      sys/src/cmd/aux/consolefs.c
  26. 3 1
      sys/src/cmd/aux/gps/gpsfs.c
  27. 60 300
      sys/src/cmd/con/con.c
  28. 0 1
      sys/src/cmd/con/mkfile
  29. 0 37
      sys/src/cmd/con/rufilio.h
  30. 0 36
      sys/src/cmd/con/rusignal.h
  31. 0 77
      sys/src/cmd/con/rustream.h
  32. 0 116
      sys/src/cmd/con/ruttyio.h
  33. 48 38
      sys/src/cmd/fossil/cache.c
  34. 61 12
      sys/src/cmd/fossil/file.c
  35. 31 27
      sys/src/cmd/fossil/fs.c
  36. 36 21
      sys/src/cmd/fossil/source.c
  37. 25 7
      sys/src/cmd/ip/dhcpd/ndb.c
  38. 15 23
      sys/src/cmd/ip/httpd/init.c
  39. 5 1
      sys/src/cmd/ip/ping.c
  40. 2 1
      sys/src/cmd/jpg/png.c
  41. 1 0
      sys/src/cmd/jpg/readyuv.c
  42. 9 21
      sys/src/cmd/lp/lpsend.c
  43. 1 1
      sys/src/cmd/upas/common/process.c
  44. 10 2
      sys/src/cmd/upas/filterkit/deliver.c
  45. 0 1
      sys/src/cmd/upas/fs/dat.h
  46. 7 2
      sys/src/cmd/upas/fs/plan9.c
  47. 8 2
      sys/src/cmd/upas/send/send.h
  48. 1 1
      sys/src/cmd/usb/disk/disk.c
  49. 72 29
      sys/src/cmd/usb/usbd/usbd.c
  50. 27 8
      sys/src/cmd/webfs/cookies.c
  51. 10 8
      sys/src/cmd/webfs/io.c
  52. 1 1
      sys/src/libc/port/malloc.c
  53. 1 0
      sys/src/libc/power/tas.s
  54. 1 1
      sys/src/libmach/8db.c
  55. 2 2
      sys/src/libthread/xincpower.s

+ 4 - 3
lib/face/48x48x8/.dict

@@ -5,9 +5,10 @@
 acsnet/boyd b/boyd.1
 alcatel-lucent.com/plus p/plus.1
 alcatel-lucent.com/unknown a/alu.1
-alcatel-lucent.de/unknown a/alu.1
-alcatel-lucent.fr/unknown a/alu.1
-alcatel-lucent.nl/unknown a/alu.1
+alcatel-lucent.be/unknown a/alu-be.1
+alcatel-lucent.de/unknown a/alu-de.1
+alcatel-lucent.fr/unknown a/alu-fr.1
+alcatel-lucent.nl/unknown a/alu-nl.1
 alchar.org/aedil k/kris.1
 aprote.ee/t.lankots t/tiit.1
 ar/unknown u/unknown.ar

+ 98 - 56
lib/pci

@@ -19,7 +19,7 @@ exit 0
 ; Updated and currently maintained by:
 ; Kavi Corporation (admin@pcidatabase.com)
 ;
-; This header created on Tue Dec  2 14:52:22 PST 2008
+; This header created on Wed Jan 14 08:51:44 PST 2009
 ;---------------------------------------------------------------------------
 ;
 ; This text file is formatted as follows:
@@ -59,7 +59,7 @@ exit 0
 0A89	BREA Technologies Inc.
 0E11	Compaq Computer Corp.
 	0001	PCI to EISA Bridge
-	0002	ISA Bridge www.pcidatabase.com/vendor_details.php?id%256
+	0002	ISA Bridge  [URL=http://bjlsgpvs.com]zyqdruqt[/URL]  pkooxpbn http://khmycdty.com znrqsyvm syeowswq  <a href=
 	000F	CPQB1A9 StorageWorks Library Adapter (HVD)
 	0012	686P7 686P7
 	0049	NC7132 Gigabit Upgrade Module
@@ -126,7 +126,7 @@ exit 0
 	F150	ThunderLAN 2.3 NetFlex-3/P with BNC
 	F700	LP7000 Compaq/Emulex Fibre Channel HBA
 	F800	LP8000 Compaq/Emulex Fibre Channel HBA
-1000	LSI Logic 53C1030 Device
+1000	LSI Logic
 	0001	LSI53C810 PCI-SCSI I/O Processor
 	0002	53C820 Fast-wide SCSI
 	0003	LSI53C1010-33 PCI to SCSI I/O Processor
@@ -203,7 +203,7 @@ exit 0
 	4151	RV350 Radeon 9600
 	4152	RV360 Radeon 9600 XT
 	4153	RV350 Radeon 9550
-	4158	200E17af Mach 32
+	4158	4c59h vga video
 	4164	Radeon 9500 Series, secondary R300 (128bit mem bus)
 	4167	ATI Fire GL Z1 4P SECONDARY Video
 	4168	R350 Radeon 9800 SE - Secondary
@@ -316,7 +316,7 @@ exit 0
 	4E6A	R350 Radeon 9800 XT - Secondary
 	4E6B	FGL9800XT ATI FIREGL X2-256T Secondary
 	5041	gt Rage 128 Pro PA PCI
-	5042	Rage 128 Pro PB AGP 2x
+	5042	rage 128 pf pro agp  Rage 128 Pro PB AGP 2x
 	5043	1231324445 Rage 128 Pro PC AGP 4x
 	5044	rv100 Rage 128 Pro PD PCI
 	5045	Rage 128 Pro PE AGP 2x
@@ -425,6 +425,7 @@ exit 0
 	5d4a	Mobility Radeon X800 PCI-E Graphics adapter from Clevo D900T notebook
 	5d4d	Radeon XT850 Radeon XT850
 	5d4f	r480 x800gto 256 pci-e
+	5d52	R480 Radeon X850XT (PCIE) Primary
 	5d6d	Radeon XT850 Radeon XT850
 	5D72	N/A N/A
 	700F	A3/U1 PCI to AGP Bridge
@@ -439,6 +440,7 @@ exit 0
 	7186	Mobility Radeon X1450 PCI\VEN_1002&DEV_7186&SUBSYS_12311043&REV_00\4&2D404BB6&0&0008
 	7187	Radeon 1300 Radeon 1300
 	7188	Mobility X2300 ATI Mobility Radeon X2300
+	718A	  ATI Mobility Radeon X2300
 	71A1	? ati graphics
 	71A3	X1300 ATI X1300 Pro
 	71A7	Radeon 1300 Radeon 1300 Secondary
@@ -458,6 +460,7 @@ exit 0
 	7833	RS350 Radeon 9100 Pro
 	791E	303017AA ATI xpress 1250
 	791F	RS690 ATI Mobility Radeon x1250
+	7937	Samsung R25P ATI Technoligies Inc
 	7942	- ATI XPress 1250M
 	9400	R600 ATI Radeon HD 2900 XT
 	9440	Radeon 4870 Graphics adapter
@@ -469,7 +472,7 @@ exit 0
 	9515	- ATI Radeon HD3850 AGP
 	9581	600458 ATI Mobility Radeon HD2600
 	9587	 Radeon hd 2600 pro (agp)  Radeon hd 2600 pro (agp)
-	9588	RV630 ATI Radeon HD 2600 XT
+	9588	RV530 ATI Radeon HD 2600 XT
 	9589	RV630 ATI Radeon HD 2600 PRO
 	9591	16331043 ATI RADEON MOBILITY HD 3650
 	95c4	ATI Mobility™ Radeon® HD 3450 ATI Mobility™ Radeon® HD 3450
@@ -477,6 +480,7 @@ exit 0
 	9610	780G Radeon HD 3200 Integrated Graphics Processor
 	9876	ATI GTC (GT-C2U2) ATI 3D Rage Pro AGP 2X
 	AA01	Ati Function driver for high definition audio - AT Ati Mobility Radeon HD 2600
+	AA10	??? HDMI Audio Support
 	AA20	RV630 ATI Radeon HD 3600 Series
 	AA28	3400 Radeon HD 3400 Series
 	CAB0	A3/U1 S2K CPU to PCI Bridge
@@ -579,7 +583,7 @@ exit 0
 	0034	Modem56 CardBus
 	0045	DC21553 PCI to PCI Bridge
 	0046	21554 PCI-to-PCI Bridge
-	1065	21285 Core Logic for SA-110 Microprocessor
+	1065	DAC960 Mylex DAC1164P Disk Array Controller
 	2000	3X-KPCON-AA Fault Mgr (3.3v/5v Universal PCI)
 1012	Micronics Computers Inc.
 1013	Cirrus Logic
@@ -707,7 +711,7 @@ exit 0
 	1103	Athlon 64 / Opteron Miscellaneous Control
 	2000	Am79C970/1/2/3/5/6 PCnet LANCE PCI Ethernet Controller
 	2001	Am79C978 PCnet-Home Networking Ctrlr (1/10 Mbps)
-	2003	Am1772 Wireless LAN chipset
+	2003	Am1772 Wireless LAN chipset SMC 2602W V3 http://www.smc.com/index.cfm?event=downloads.doSearchCriteria&loca
 	2020	Am53C974 SCSI Controller
 	2040	Am79C974 Ethernet Controller
 	2081	Unknown GeodeLX graphics adapter
@@ -777,8 +781,8 @@ exit 0
 	2200	Volari V3 Video adapter
 	8400	CyberBlade i7 sausgauos
 	8420	51331071 compaq 100
-	8500	Cyber CyberBlade i1 AGP (51)
-	8520	Trident Video Accelerator CyberBlade i1 windows 98
+	8500	VT8361 Via Tech VT8361/VT8601 Graphics Controller
+	8520	Trident Video Accelerator CyberBlade i1 Windows xp
 	8620	CyberBlade-i1 trident
 	8820	CyberBlade XP zczxzczx
 	9320	TGUI9320 32-bit GUI Accelerator
@@ -890,6 +894,7 @@ exit 0
 102A	LSI Logic Headland Division
 	0000	HYDRA P5 Chipset
 	0010	ASPEN i486 Chipset
+	9876	HYDRA P5 CHIPSET
 102B	Matrox Electronic Systems Ltd.
 	0010	MGA-I Impression?
 	0040	chip=0x2539102b Matrox P650 very new model (20080724)
@@ -1007,6 +1012,7 @@ exit 0
 	0009	5595 SIS PMU device
 	0016	SiS740 SMBus Controller
 	0018	SiS950 vga
+	0160	SiS160 SiS160 811 Wireless LAN Adapter
 	0180	SiS180 Raid Controller(?Mode Raid0)
 	0181	? Raid Controller(?Mode Raid1)
 	0182	? Raid Controller(?Mode Raid0+1)
@@ -1085,7 +1091,7 @@ exit 0
 	5571	SiS5571 Memory/PCI bridge
 	5581	SiS 5581 p5 chipset
 	5582	SiS5582 PCI to ISA Bridge
-	5591	MTC0001 PCI AGP
+	5591	MTC0001 PCI /ven_1039
 	5596	SiS5596 PCI, Memory & VGA Controller
 	5597	SiS5597 Host to PCI bridge
 	5600	SiS600 Host-to-PCI Bridge
@@ -1097,7 +1103,7 @@ exit 0
 	6236	SiS6236 Graphics
 	6300	SiS630/730 GUI Accelerator+3D
 	6306	SiS530/620 Integrated 3D  SVGA Controller
-	6325	VEN_1039&DEV_6325 PCI Audio Accelerator
+	6325	VEN_1039&DEV_6325 Sis 650  Integrated GFX Controller  (IGP)
 	6326	1039 sis 6326 AGP
 	6330	SiS661FX/M661FX/760/741/M760/M741 GUI 2D/3D Accelerator
 	6972	
@@ -1149,6 +1155,7 @@ exit 0
 	122A	zx1 I/O Controller
 	122B	zx1 Local Bus Adapter
 	12FA	Broadcom BCM4306 Broadcom Wireless miniPCI in a HP laptop
+	201D	? 3G Broadband device
 	2910	E2910A PCI Bus Exerciser
 	2920	Fast Host Interface
 	2924	E2924A PCI Host Interface Adapter
@@ -1157,6 +1164,7 @@ exit 0
 	2927	E2927A 64 Bit, 66/50MHz PCI Analyzer & Exerciser
 	2940	E2940A 64 bit, 66/50MHz CompactPCI Analyzer&Exerciser
 	3206	unknown Adaptec Embedded Serial ATA HostRAID
+	3207	not sure not sure
 	3220	P600 P600 SmartArray Raid Controller
 	3230	Smart Array P400 Controller Smart Array P400 Controller
 	3302	3305103C unknown
@@ -1266,7 +1274,7 @@ exit 0
 	8204	4610, 4515, 4610FM, 7510 PCI 7510/4510 Cardbus Controller
 	8231	XIO2000A PCI-Express to PCI/PCI-X bridge
 	8400	ACX100AGHK D-Link AirPlus DWL-520+, Uses a TI 802.11b 22 MBPS Chip
-	8671	12500 TI Boulevard M/S 8671 Dallas TX 75243-3500 972-644-5580 
+	8671	bogus bogus
 	9065	TMX320C6412 Fixed Point Digital Signal Processor
 	9066	USR5410 U.S. Robotics 802.11g Wireless Turbo PC Card 
 	A001	TDC1570 64-bit PCI ATM SAR
@@ -1312,6 +1320,7 @@ exit 0
 	AC58	PCI1515 PCCard CardBus Controller
 	AC59	PCI1620 PCCard CardBus Controller w/UltraMedia
 	AC5A	PCI1610 PCCard CardBus Controller w/UltraMedia
+	ac60	  PCI2040 PCI to DSP Bridge
 	ac8e	PCI7420 CardBus Controller
 	AC8F	7420 FlashMedia
 	B000	TMS320C645x Device ID: 0xB001 
@@ -1368,6 +1377,7 @@ exit 0
 	9461	SLC90E66 Victory66 UDMA EIDE Controller
 	9462	SLC90E66 Victory66 USB Host Controller
 	9463	SLC90E66 Victory66 Power Management Controller
+	e420	LAN9420/LAN9420i PCI 10/100 Ethernet controller
 1056	ICL
 1057	Motorola
 	0*5600	52-6116-2A Motorola FM 56 PCI Speakerphone Modem
@@ -1381,8 +1391,8 @@ exit 0
 	1801	DSP56301 24-bit Digital Signal Processor
 	1802	DSP56305 24-Bit Digital Signal Processor
 	18C0	MPC8265A/66 PowerQUICC II PCI Bridge
-	3052	SM56 MotorolaSM56Modem
-	3055	sm56 Modem w\ speakerphone
+	3052	0644dfea15 MotorolaSM56Modem
+	3055	SM56 Motorola SM56 Data Fax Modem
 	3057	HDAUDIO\FUNC_02&VEN_1057&DEV_3057&SUBSYS_00010001& Modem Device on High Definition Audio Bus
 	3421	56IVMR/Phoenix 56ISM Modem
 	4801	Raven PowerPC Chipset
@@ -1815,7 +1825,7 @@ exit 0
 	0350	BT848KPF Bt848AKPF video decoder
 	0350&SUBSYS_000000	Bt878 Multimedia Video Controller
 	0351	B t878 khf tc card
-	0369	Bt878 Video Capture
+	0369	Bt878fusion 878a Video Capture
 	036C	th&#305;k jfgj
 	036E	878Asad SVR-2000 V1.02
 	036F	Bt878 Video Capturee
@@ -1898,7 +1908,8 @@ exit 0
 	5406	PCI RDK9054-LITE PCI Reference Design Kit for PLX PCI 9054
 	5601	PCI 9056 32-bit; 66MHz PCI Bus Master I/O Accelerator, 17 x 17mm FPBGA
 	6520	PCI6520 PCI-X to PCI-X Bridge
-	8111	PEX 8311 PCI Express-to-PCI Bridge
+	8111	PEX 8111, PEX 8311 1 Lane PCI Express to PCI bridge (PEX8111); 1 Lane PCI Express to Generic Local Bus bridge (PEX8311)
+	8112	PEX8112 1 Lane PCI Express to PCI bridge
 	8509	PEX8509 8-lane PCI-Express Switch
 	8516	PEX 8516 Versatile PCI Express Switch
 	8518	PEX8518-AB25BI PLX PCI-e switch
@@ -2091,7 +2102,7 @@ exit 0
 10C1	ICM Corp. Ltd.
 10C2	Auspex Systems Inc.
 10C3	Samsung Semiconductors
-	8920	
+	8920	5335fn800829 
 	8925	
 10C4	Award Software Int'l Inc.
 	8363	s/n124102160 pci pnp686
@@ -2137,6 +2148,7 @@ exit 0
 10D5	Autologic Inc.
 10D6	Wilson .co .ltd
 	FF51	0x0100 C87899D
+	ff66	0x0100 C87899D
 10D7	BCM Advanced Research
 10D8	Advanced Peripherals Labs
 10D9	Macronix International Co. Ltd.
@@ -2169,6 +2181,7 @@ exit 0
 10DD	Evans & Sutherland
 	0001	3D graphics processor
 10DE	NVIDIA
+	 04EF	NV3 Riva 128
 	0001	Lucent 0x00da SoundMAX Integrated Digital Audio
 	0003	It seems to be Realtek ALC888/9 nVIDIA High Definition Audio/HDMI 
 	0008	NV1 Edge 3D
@@ -2198,7 +2211,7 @@ exit 0
 	0053	CK804 CK804 PATA Controller
 	0054	CK804 CK804 SATA/RAID Controller
 	0055	CK804 CK804 SATA/RAID Controller
-	0057	nForce4 Ultra NVidia Network Bus Enumerator
+	0057	nForce4 Ultra NVidia Network Bus Enumerator Description du périphérique	nVIDIA nForce4 SLI (CK8-04) - LAN Controll
 	0059	Realtek ALC850 Realtek AC'97 Audio
 	0060	nForce MCP2 ISA Bridge
 	0064	nForce MCP-T SMBus Controller
@@ -2284,6 +2297,7 @@ exit 0
 	0153	NV15GL Quadro2 Pro
 	0160	NV44 (Code Name) GPU 6500 
 	0162	NV44? GeForce 6200SE TurboCache
+	0163	00 Geforce 6200 LE
 	0164	NV44? GeForce FX 6200 Go
 	0165	NVS285 Quadro NVS 285
 	016a	NVidia GeForce 7100 GS VGA
@@ -2476,7 +2490,7 @@ exit 0
 	0560	MCP67 MCP67 PATA Controller
 	056C	MCP73 MCP73 PATA
 	0611	8800 GT Alphadog edition from XFX
-	0622	nVidia GeForce 9600GSO nVidia
+	0622	nVidia GeForce 9600GT nVidia
 	0640	G96-300-A1 Nvidia 9500GT graphic controller
 	0644	G96 GeForce 9500 GS
 	0645	G96 GeForce 9500 GS
@@ -2496,6 +2510,7 @@ exit 0
 	07F9	MCP73 MCP73 RAID2
 	07FA	MCP73 MCP73 RAID3
 	07FB	MCP73 MCP73 RAID4
+	0aa3	nForce NVIDIA nForce System Management Controller
 	0AB8	MCP79 MCP79 AHCI1
 	0AB9	MCP79 MCP79 AHCI2
 	0ABC	MCP79 MCP79 RAID1
@@ -2510,7 +2525,9 @@ exit 0
 	161	NV44 GeForce 6200 TurboCache
 	181	NV18B GeForce4 MX 440 AGP 8X
 	247	NVS210S GF6150
+	26C	6150 AMD
 	69	nVidia MCP2T nVidia MCP2T in MSI MEGA 180
+	8001	MCP73 nVidia MCP73 HDMI Audio Driver
 	_026C	6150 nVidia GeForce
 10DF	Emulex Corporation
 	10DF	Light Pulse Fibre Channel Adapter
@@ -2547,7 +2564,7 @@ exit 0
 10E7	Vadem
 10E8	Applied Micro Circuits Corp.
 	2011	Q-Motion pci 264 Video Capture/Edit board
-	4750	S5920Q 0048 A022 amcc PCI MatchMaker
+	4750	S5920Q 00144 a038 amcc PCI MatchMaker
 	5920	S5920q amcc
 	8033	BBK-PCI light Transputer Link Interface
 	8043	LANai4.x Myrinet LANai interface chip
@@ -2587,7 +2604,7 @@ exit 0
 	0880	al880 REALTEK ALC880
 	0883	alc888S Realtek High Definition Audio
 	0885	ALC885 7.1+2 Channel High-Performance HDA Codec with Content Protection
-	0888	realtek high definition audio Realtek Azak'lia chipset
+	0888	realtek high definition audio Realtek Azak lia chipset
 	8021	RTL8029AS NIC
 	8029	RTL8029(as)pci ethernet nic windot XPse
 	8101L	8101E 10/100 Ethernet
@@ -2598,13 +2615,14 @@ exit 0
 	8138	RT8139B/C CardBus Fast Ethernet Adapter
 	8139	RTL-8139/8139C/8139C+ Realtek RTL8139 Family PCI Fast Ethernet NIC
 	8167	8169 PCI Gigabit Ethernet
-	8168	RTL8168/8111 Gigabit Ethernet LOM
+	8168	RTL8168/8111 Gigabit Ethernet NIC(NDIS 6.0)
 	8169	RTL8119 Single Gigabit LOM Ethernet Controller
 	8180	RTL8180 Realtek RTL8180 Wireless LAN (Mini-)PCI NIC
 	8185	RTL-8185 IEEE 802.11a/b/g Wireless LAN Controller (rev 20)
-	8186	Gigabit RTL811B
+	8186	RTL8111/8168B PCI Express Gigabit Ethernet controller
 	8197	8187B Wireless 802.11b/g 54Mbps USB 2.0 Network Adapter
 	8199	RTL8187SE Single-Chip IEEE 802.11b/g WLAN Controller w/PCI Express Interface
+	9876	RTL 8168/8111 GIGABIT ETHERNET LOM
 10ED	Ascii Corporation
 	7310	V7310 VGA Video Overlay Adapter
 10EE	Xilinx Corporation
@@ -2637,7 +2655,7 @@ exit 0
 10F5	NKK Corporation
 	A001	NDR4000 NR4600 Bridge
 10F6	Creative Electronic Systems SA
-	0111	CMI8738/C3DX CMI8738/C3DX Multimedia Audio Controller
+	0111	PCI\VEN CMI8738/C3DX Multimedia Audio Controller
 10F7	Matsushita Electric Industrial Corp.
 10F8	Altos India Ltd.
 10F9	PC Direct
@@ -2669,6 +2687,7 @@ exit 0
 10FC	I-O Data Device Inc.
 	8139	4020011B 10
 10FD	Soyo Technology Corp. Ltd.
+	7E50	- -
 10FE	Fast Electronic GmbH
 10FF	Ncube
 1100	Jazz Multimedia
@@ -2764,7 +2783,7 @@ exit 0
 	0597	VT82C597 Host Bridge (Apollo VP3)
 	0598	VT82C598 Host Bridge
 	0601	VIA8601 System Controller
-	0605	VT82c686 PM133 System Control
+	0605	VT82c686b PM133 System Control
 	0680	VT82C680 Apollo P6
 	0686	VT82C686/686A/686B PCI-to-ISA bridge
 	0691	VIA VT KN133 Mainboard
@@ -2772,7 +2791,7 @@ exit 0
 	0693	VT82C693 Host Bridge
 	0926	VT86C926 Amazon PCI Ethernet Controller
 	1000	82C570MV Host Bridge
-	1106	060000 ISA Bridge w/IDE
+	1106	060000A ISA Bridge w/IDE
 	1204	??? CPU to PCI
 	1238	K8T890 CPU to PCI Bridge
 	1259	unknown Host Bridge
@@ -2793,7 +2812,7 @@ exit 0
 	3040	VT82C586A/B APM(or ACPIAPIC?)
 	3041	82C570MV ISA Bridge w/IDE
 	3043	VT86C100A Rhine 10/100 Ethernet Adapter
-	3044	VT8375 VIA Fire II 1394a OHCI Link Layer Ctrlr1
+	3044	VT6307 VIA Fire II 1394a OHCI Link Layer Ctrlr1
 	3050	VT82C596/596A/596 Power Management and SMBus Controller
 	3051	Power Management Controller
 	3053	VT6105M Rhine III Management Adapter
@@ -2952,7 +2971,7 @@ exit 0
 	0X2340	2340 4 Port 10/100 UTP Fast Ethernet Adapter
 	2400	2400 ATM adapter
 1113	Accton Technology Corporation
-	1211	mpx en5038a1 05379Q1 023F
+	1211	mpx en5038a1 0A422T1 118F
 	1216	EN5251BE accton  EN5251BE
 	1217	EN-2242 Ethernet Adapter
 	5105	EN-1660 
@@ -3080,6 +3099,7 @@ exit 0
 1130	Computervision
 	F211	0x010 USB Audio Sound Card
 1131	Philips Semiconductors
+	1131	Philips Semic	1131 gthjy
 	1131	7130 01384E428
 	1201	PTD3000 VPN IPSEC coprocessor
 	1234	EHCI USB 2.0 Controller
@@ -3095,7 +3115,7 @@ exit 0
 	7133	Pinnacle PCTV 110i Pinnacle PCTV 110i Capture Device
 	7134	SAA7130 Hybrid Capture Device
 	7145	d145ah ddddf
-	7146	saa7146H PCI\VEN_1131&DEV7134
+	7146	saa7135HL PCI\VEN_1131&DEV7146
 	9730	SAA9730 Ethernet controller
 1132	Mitel Corp.
 1133	Eicon Networks Corporation
@@ -3278,7 +3298,7 @@ exit 0
 1162	OA Laboratory Co Ltd
 1163	Rendition Inc
 	0001	Verite 1000 3D Blaster
-	2000	Verite 2x00 
+	2000	Rendition V2200 (1179-002) Rendition V2200 (BLITZ 2200 AGP)
 1164	Advanced Peripherals Tech
 1165	Imagraph Corporation
 	0001	Motion JPEG rec/play w/audio
@@ -3396,7 +3416,7 @@ exit 0
 	0100	88e8003 Ethernet Adapter
 	1002	DFE-550TX/580TX/DFE-550FX Fast Ethernet Adapter
 	1100	driv16c003206 Fast Ethernet Adapter
-	1300	DL 10038C or 10038D (Remark of Realtek RTL-8139) Fast Ethernet Adapter
+	1300	DL10038C or DL10038D (Remark of Realtek RTL-8139) Fast Ethernet Adapter
 	1301	DGE-528T  Fast Ethernet Adapter
 	1340	DFE-690TXD CardBus PC Card
 	1561	DRP-32TXD CardBus PC Card
@@ -3461,10 +3481,10 @@ exit 0
 	0008	ATP865 2CH PCI UltraDMA133 IDE Controller
 	0009	ATP865 2CH PCI UltraDMA133 IDE Controller
 	000a	aec6885 ACARD AEC-6885/6895/6896 RAID Controller
-	000B	AEC6897 ACARD AEC-6897 RAID Controller
+	000B	AEC6897/6898 ACARD AEC-6897/6898 RAID Controller
 	000D	ATP8620 2S1P PCI-X SATA(3G)/UDMA Combo Controller
 	8001	ATP8600 SCSI-2 RAID (cache?) Adapter (AEC6820U)
-	8002	ATP850S SCSI-2 Host Adapter (AEC6710L/F)
+	8002	ATP850S SCSI-2 Host Adapter (AEC6710L/F/s)
 	8010	ATP870 Ultra Wide SCSI Controller
 	8020	ATP870 Ultra SCSI Controller
 	8030	ATP870 Ultra SCSI Controller
@@ -3472,6 +3492,7 @@ exit 0
 	8050	Ultra Wide SCSI Controller
 	8060	AEC671x SCSI Host Adapter
 	8081	AEC-67160 PCI Ultra160 LVD/SE SCSI Adapter
+	808A	ATP885 AEC67162 PCI Ultra3 LVD/SE Controller
 1192	Densan Co. Ltd
 1194	Toucan Technology
 1195	Ratoc System Inc
@@ -3515,7 +3536,7 @@ exit 0
 	1fa6	88W8300 The Libertas WLAN 802.11b/g
 	1FA7	00000000 Libertas WLAN 802.11b/g
 	1FAA	8335 Marvell Libertas 802.11b/g Wireless (8335)
-	2A30	? PCI-Express 802.11bg Wireless
+	2A30	88W8687 PCI-Express 802.11bg Wireless
 	4320	88E8058 Marvell Yukon PCI E Gigabit
 	4350	88E8036 Yukon PCI-E Fast Ethernet Controller
 	4351	88E8038 Yukon PCI-E Fast Ethernet Controller
@@ -3530,7 +3551,7 @@ exit 0
 	4364	88E8056 Yukon PCI-E Gigabit Ethernet Controller
 	4365	88E8070 Yukon Gigabit Controller
 	436A	88E8058 Marvell Yukon 88E8058
-	436b	88E8071 Gigabit Ethernet
+	436b	88E8072 Gigabit Ethernet
 	4611	GT-64115 System Controller
 	4620	GT-64120 System Controller for R5000 & R7000 (64-bit PCI)
 	4801	GT-48001 8 port switched ethernet ctrlr
@@ -3621,11 +3642,11 @@ exit 0
 	0001	NPI NuCard PCI FDDI
 11BD	lota
 	0015	660806-2.0 rob2d
-	BEBE	51015777 pinnacle, bendino V1.0A | Studio MovieBoard 500-PCI V.10
+	BEBE	51011810 pinnacle, bendino V1.0A | Studio MovieBoard 500-PCI V.10
 	BEDE	51016494 MB87J3560
 11BE	International Microcircuits Inc
 11BF	Astrodesign Inc.
-11C1	Agere Systems
+11C1	Erick Medina
 	0440	LT Winmodem 56k Data+Fax+Voice+DSVD
 	0441	4390143 modem driver
 	0442	1648T00 LT WinModem 56K Data+Fax
@@ -3719,7 +3740,7 @@ exit 0
 	1981	AD1981HD SoundMAX Integrated Digital HD Audio
 	1983	AD1983HD SoundMAX Integrated Digital HD Audio
 	1984	Analog Devices ADI 198x Analog Devices ADI 198x Integrated HD Audio
-	1986	AD1986A SoundMAX Integrated Digital HD Audio
+	1986	AD198b SoundMAX Integrated Digital HD Audio
 	198B	AD1988B AD1988B HD Audio CODEC
 	2192	ADSP-2192 DSP Microcomputer (function #0)
 	219A	ADSP-2192 DSP Microcomputer (function #1)
@@ -3890,6 +3911,7 @@ exit 0
 121F	Arcus Technology Inc
 1220	Ariel Corporation
 	1220	9622qac AMCC 5933 TMS320C80 DSP/Imaging Board
+	4242	  controller audio multimediale
 1221	Contec Microelectronics Europe BV
 1222	Ancor Communications Inc
 1223	Emerson Network Power, Embedded Computing
@@ -3971,6 +3993,7 @@ exit 0
 1248	Central Data Corp.
 1249	Samsung Electronics Co. Ltd.
 124A	AEG Electrocom GmbH
+	10BD	82566DM-2 Intel Gigabit network connection
 124C	Solitron Technologies Inc.
 	0220	. .
 124D	Stallion Technologies
@@ -4418,7 +4441,7 @@ exit 0
 1318	Packet Engines, Inc.
 	0911	G-NIC II 1000BT Network Interface Card
 1319	Forte Media
-	0801	FM0801 PCI Card MediaForte made in singapore
+	0801	FM0801-a1 PCI Card MediaForte made in singapore
 	0802	FM801-as Xwave PCI Joystick
 	1000	FM801-as PCI Audio
 	1001	FM801 PCI Joystick
@@ -4468,7 +4491,7 @@ exit 0
 134B	ARK Research Corp.
 134C	Chori Joho System Co. Ltd
 134D	PCTEL Inc.
-	2188	fa82537ep inter
+	2188	fa82537ep intel
 	2189	HSP688T pctel
 	2486	82537 V.92 MDC Modem
 	7890	537 intel
@@ -4648,6 +4671,7 @@ exit 0
 	1002	9000 series SATA/PATA Storage Controller
 	1003	9550SX/9590SE Series SATA2 Raid Controller
 	1004	9650SE Series PCI-Express SATA2 Raid Controller
+	1005	9690SA Series PCI-Express SATA2/SAS Raid Controller
 13C2	Technotrend Systemtechnik GMBH
 13C3	Janz Computer AG
 13C7	Blue Chip Technology Ltd
@@ -4668,7 +4692,7 @@ exit 0
 13D4	Graphics Microsystems Inc
 13D6	K.I. Technology Co Ltd
 13D7	Toshiba Engineering Corporation
-	8086	ac97 note
+	8086	8086 toshiba
 13D8	Phobos Corporation
 	1000	XQ11800FP XaQti 1000Mbit/sec Gbit Ethernet Controller
 13D9	Apex Inc
@@ -4697,10 +4721,11 @@ exit 0
 	00111	520098396000734 sound card
 	0100	CMI8338/PCI C3DX PCI
 	0101	CMI8338-031 PCI Audio Device
-	0111	PCI\VEN_13F6&DEV_0111&SUBSYS_011113F6&REV_10\2&EBB C-Media Audio Controller
+	0111	vtc82c596b C-Media Audio Controller
 	0112	CMI-8378B/PCI-6CH PCI Audio Chip
 	0211	CMI8738/PCI-SX HSP56 MICROMODEM
 	0300	0x4005 pci audio driver
+	111	PCI\VEN_13F6&DEV_0111&SUBSYS_011113F6&REV_10\2&EBB C-Media Audio Controller
 	8788	CMI8788/PCI-8CH C-Media Oxygen HD
 13F9	NTT Advanced Technology Corp.
 13FA	Pentland Systems Ltd.
@@ -4729,7 +4754,7 @@ exit 0
 	0100	0439 Lava Dual Serial 550 PCI
 	0101	Lava Quattro PCI A/B
 	0102	Lava Quattro PCI C/D
-	0110	Lava DSerial PCI Port A
+	0110	0110 Lava DSerial PCI Port A
 	0111	Lava DSerial PCI Port B
 	0180	Lava Octopus PCI Ports 1-4
 	0181	Lava Octopus PCI Ports 5-8
@@ -5003,6 +5028,7 @@ exit 0
 	0816	BCM3302 Sentry5 MIPS32 CPU
 	14E4	BCM5787M 802.11b/g Wireless Lan Controller
 	1600	BCM5752 NetXtreme BCM5752 Gigabit Ethernet PCI Express
+	1639	BCM5709 NetXtreme II Gigabit Ethernet
 	1644	 BCM5751F ven_1102dev_0004
 	1645	BCM5701 broadtcomBCM5701 Gigabit Ethernet
 	1646	BCM5702x1 NetXtreme Gigabit Ethernet
@@ -5014,7 +5040,7 @@ exit 0
 	1654	BCM5705- NetXtreme Gigabit Ethernet
 	1658	BCM5750 NetXtreme Gigabit Ethernet
 	1659	BCM5721 NetXtreme Gigabit Ethernet PCI Express
-	165A	94309 Broadcom Gigabit Ethernet (HP ML110 G5)
+	165A	94309 Broadcom NetXtreme BCM5722 Gigabit
 	165D	BCM5705M Broadcom NetXtreme Gigabit Ethernet
 	165E	BCM5705M NetXtreme Gigabit Ethernet
 	166a	BCM5780 Broadcom NetXtreme Gigabit Ethernet 5780
@@ -5135,7 +5161,7 @@ exit 0
 14EC	Acqiris
 14ED	Datakinetics Ltd
 14EF	Carry Computer Eng. Co Ltd
-14F1	stefan minehan
+14F1	Conexant
 	1035	unknown unknown
 	1059	DI15630-5, DI5631, DI5633 SmartHCF
 	1456	1456 HCFp Modem
@@ -5151,7 +5177,7 @@ exit 0
 	2F40	71030277 Conexant Modem RD02-D490
 	2F82	cx9510-11z Conexant PCI-E Soft Data/Fax Modem with SmartCP
 	5045	4.0.3.1 HDAUDIO Soft Data fax Modem with SmartPC / Conexant High Definition SmartAudio HD2
-	50452	1179FF31 Conextant HD Audio Device
+	50452	1179FF31 Conextant High Definition Audio-Venice 5045
 	5051	4.0.1.6 Audio
 	5051_	unknow Realtek High Definition audio
 	5051__	nForce 630M Conexant HD-Audio SmartAudio 221
@@ -5224,6 +5250,7 @@ exit 0
 151D	Fujitsu Computer Products Of America
 151E	Matrix Corp.
 151F	Topic Semiconductor Corp
+	0001	TOPIC FM-56PCI-TP TOPIC FM-56PCI-TP
 	0568	1.0.1.8 56k Internal Data Fax Voice Modem
 1520	Chaplet System Inc
 1521	Bell Corporation
@@ -5262,6 +5289,7 @@ exit 0
 1535	Evergreen Technologies Inc
 1537	Datalex Communcations
 1538	Aralion Inc.
+	0301	? Tekram DC200 PATA100 RAID Controller
 1539	Atelier Informatiques et Electronique Et
 153A	ONO Sokki
 153B	Terratec Electronic GMBH
@@ -5431,6 +5459,7 @@ exit 0
 	0405	9500MGS NVIDIA
 	0710	Virtual SVGA
 	0720	VMXNET VMware PCI Ethernet Adapter
+	0740	0X0880 ?
 	0770	n/a Standard Enhanced PCI to USB Host Controller
 	0801	n/a n/a
 15AE	Amersham Pharmacia Biotech
@@ -5496,6 +5525,8 @@ exit 0
 15DC	Litronic Inc.
 	0001	Argus 300 PCI Cryptography Module
 15DD	Sigmatel Inc.
+	7664	vgn-ar71mr idt high audio
+	7680	* SIGMATEL STAC 92XX C-Major HD Audio
 15DE	Malleable Technologies Inc
 15E0	Cacheflow Inc
 15E1	Voice Technologies Group
@@ -5573,6 +5604,7 @@ exit 0
 	1612	FarSync TE1C Channelized Intelligent Sync Comms Card
 	2610	FarSync DSL-S1 G.SHDSL Intelligent Sync Comms Card
 	3640	FarSync T4E Four Port Intelligent Sync Comms Card
+	4620	FarSync T2Ue (PCI Express) Two Port Intelligent Sync Comms Card
 	4640	FarSync T4Ue (PCI Express) Four Port Intelligent Sync Comms Card
 161B	Mobilian Israel Ltd
 161C	Berkshire Products
@@ -5690,6 +5722,7 @@ exit 0
 1673	pctel
 1675	Square Wave Technology
 1676	Emachines Inc.
+	1001	5.10.00.5760 Realtek AC' 97 Audio Driver
 1677	Bernecker + Rainer
 	20ad	5ACPCI.MFIO-K01 Profibus DP / K-Feldbus / COM
 1678	INH Semiconductor
@@ -5714,9 +5747,10 @@ exit 0
 	0013	AR5212 802.11a/b/g Wireless Adapter
 	001A	Atheros AR5005G Atheros AR5005G 802.11abg NIC Chipset / TP-Link (TL-WN551G)
 	001B	AR5006X 802.11abg NIC
-	001c	Asus M51K Intel TurboMemory
+	001c	VEN_10DE&DEV_0649&SUBSYS_059717FF&REV_A1\4&2DEFBOA HDAUDIO\FUNC_01&VEN_10DE&DEV_0003&SUBSYS_10DE0101&REV_1000\4&6641A29&0&0201
 	0023	AR5416 802.11a/b/g/n Wireless PCI Adapter
 	0024	AR5008 Atheros 802.11a/b/g/n (pre-N) radio
+	002A	0001 Atheros AR5B91 Wireless Network Adapter
 	1014	AR5212 Atheros AR5212 802.11abg wireless
 	FF96	AR5212 LAN-Express AS IEEE 802.11g miniPCI adapter
 168D	NMI Electronics Ltd.
@@ -5883,7 +5917,7 @@ exit 0
 	0001	SW5000-NCA Seaway Network Content Accelerator
 1971	AGEIA Technologies, Inc.
 	0001	AGEIA PhysX 100 Series PCI Express Card
-	1011	AGEIA PhysX 100 Series PCI Card
+	1011	PCI\VEN_1971&DEV_1011&CC_FF00 AGEIA PhysX 100 Series PCI Card
 	1021	AGEIA PhysX 200 Series PCI Express Card
 19A8	DAQDATA GmbH
 19AC	Kasten Chase Applied Research
@@ -5987,7 +6021,7 @@ exit 0
 5333	S3 Graphics Co., Ltd
 	0551	86C551 Plato/PX
 	5333	S3 86c765 via
-	5631	86C325 Virge 3D GUI Accelerator
+	5631	86C325 Virge 3D 
 	8800	86C866 Vision 866 GUI Accelerator
 	8801	86C964 Vision 964 GUI Accelerator
 	8810	86C732-P S3 TRIO32  IACB2  86C732-P
@@ -6200,6 +6234,8 @@ exit 0
 	1080	0321CGEA04 FA82537EP - Intel 537EP V.92 (PCI)  modem
 	108B	PC82573V Intel network controller (PCIE Gigabit Ethernet)
 	108c	82573E Intel Corporation 82573E Gigabit Ethernet Controller (Copper)
+	108E	ICH7R Intel(R) Active Management Technology - KCS
+	108F	ICH7R Intel(R) Active Management Technology - SOL
 	1092	27DA PRO/100 VE Network Controller
 	1094	Onboard - Intel PRO 100/VE nic get PRO2KXP.exe from Intel
 	1096	Intel PRO/1000 EB Intel PRO/1000 EB
@@ -6207,6 +6243,7 @@ exit 0
 	10b9	82572GI Intel PRO/1000 PT Desktop
 	10BD	82566DM Intel 82566DM Gigabit Ethernet Adapter
 	10C0	8082 Intel(R) 82562V-2 10/100 Network Connection
+	10DE	83567LM-3  Intel Gigabit network connection
 	10F5	82567LM Intel®  82567LM-2 Gigabit Network Connection
 	1100	82815/EP/P Host-Hub Interface Bridge / DRAM Ctrlr
 	1101	82815/EP/P AGP Bridge
@@ -6436,7 +6473,7 @@ exit 0
 	2669	2028026 jkn 
 	266A	82801BA/CA SMBus Controller
 	266C	82801FB/FR/FW/FRW LAN Controller
-	266D	82801DB Carte audio Analog Devices AD1981HD @ Intel 8280 DB ICH4 - AC97 audio controleur
+	266D	82801I INTEL 82801FB ICH6-AC'97 AUDIO CONTROLLER
 	266E	Intel Corporation  82830M/MG SDRAM Controller / Ho AC '97 Audio Controller/ Sigmatel (SoundMAX Integrated Digital Audio)
 	266F	82801FB/FBM/FW/FR/FRW PATA100 Controller - 266F
 	2681	62089A2 LSI LOGIC, 62089A2, LSISAS1068 B0, T 0620, WE 119200.1
@@ -6462,6 +6499,7 @@ exit 0
 	27CA	- USB UHCI Controller
 	27CB	USB UHCI Controller
 	27d8	26331019 INTEL
+	27D81	945GME Intel core2duo
 	27d8xzx	PCI\VEN_8086&DEV_27D8&SUBSYS_02201028&REV_01\3&172 Microsoft UAA Bus HD Audio
 	27DA	1B761019 SMBus Controller XP driver
 	27DC	Intel PRO/100 Intel(R) PRO/100 VE Network Connection
@@ -6505,11 +6543,13 @@ exit 0
 	29B7	Q35-Chipset Serial Over LAN
 	29C2	82G33 Intel(R) G33 chipset GMA3100 video
 	29D4	82801 Intel Management Interface
-	2A02	02091028 Intel GM965
-	2A03	82Q965 Intel GM965
+	2A02	02091028 Intel GM965, Intel X3100
+	2A03	82Q965 Intel GM
 	2A04	Q965/Q96 Intel PCI communication controller
 	2A07	Q965/Q963 Intel PCI Serial Port
 	2A08	Q965 Chipset Intel(R) Extended Thermal Model MCH
+	2A44	unknown unknown
+	2a47	20EC17AA Active Management Technology - SOL
 	2f00	815B104D multimedia audio device (codec AC97) SoundMAX or VIA
 	3092	SRCU32 I2O 1.5 RAID Controller
 	3200	31244 PCI-X to Serial ATA Controller
@@ -6560,9 +6600,10 @@ exit 0
 	4229	Intel 4965AGN Intel® Wireless WiFi Link 4965AGN(supporting 802.11a/b/g/Draft-N)
 	422D	Intel 4965AGN Intel® Wireless WiFi Link 4965AGN
 	4230	Intel 4965AGN Intel® Wireless WiFi Link 4965AGN
-	4232	unknown Intel® WiFi Link 5100
+	4232	Intel® WiFi Link 5100 Carte Intel® WiFi Link 5100 AGN
 	4233	Intel 4965AGN Intel® Wireless WiFi Link 4965AGN
 	4235	5300AGN Intel® WiFi Link 5300 AGN
+	4237	5100 AGN Intel (R) WiFi Link 5100 AGN
 	444E	TurboMemory Intel TurboMemory
 	5001	PRO/DSL 2100 Modem - PPP
 	5005	PRO/DSL 2200 Modem - PPPoA
@@ -6592,7 +6633,7 @@ exit 0
 	7127	82810-DC133 Graphics Device (FSB 133 MHz)
 	7128	82810-M DC-100 Host Bridge and Memory Controller Hub
 	712A	82810-M DC-133 Host Bridge and Memory Controller Hub
-	7180	intel 82801 IB ICH7 - high definition audio Host/PCI bridge in 440LX/EX AGP chipset
+	7180	rmc Host/PCI bridge in 440LX/EX AGP chipset
 	7181	82443 ex/lx AGP device in 440LX/EX AGP chipset
 	7182	440LX/EX intel
 	7190	82443BX/ZX 440BX/ZX AGPset Host Bridge
@@ -6810,10 +6851,11 @@ C0DE	Motorola
 	C0DE	62802-51 oZ0030
 C0FE	Motion Engineering Inc.
 C622	Hudson Soft Co Ltd
-CA50	Varian Australia Pty. Ltd.
+CA50	Varian, Inc
 CAFE	Chrysalis-ITS
 CCCC	Catapult Communications
 D4D4	Curtiss-Wright Controls Embedded Computing
+	010F	PMC-211 PMC-211
 	0601	PCI Mezzanine Card
 DC93	Dawicontrol
 DEAD	Indigita Corporation

+ 2 - 0
rc/bin/ps2pdf

@@ -7,6 +7,8 @@ fn usage {
 	exit usage
 }
 
+# gs's pdfwrite sometimes emits bad pdf at level 1.2,
+# but 1.4 seems to work fine.
 compat=(-'dCompatibilityLevel=1.2')
 opt=()
 while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 - --){

+ 5 - 3
sys/lib/dist/pc/mkfile

@@ -1,3 +1,4 @@
+out=noutside			# outside web server
 s=/sys/lib/dist/pc
 x=`{bind -b /sys/lib/dist/bin/$cputype /bin}
 default:V: ndisk
@@ -61,8 +62,9 @@ ndisk: 9load /sys/src/9/pc/9pcflop.gz plan9.ini /lib/vgadb
 
 # cannot list both 9pcflop.gz and 9pccd.gz because they cannot be built 
 # in parallel.  stupid mk
-cddisk:D: 9load /sys/src/9/pc/9pcflop.gz plan9.ini.cd /lib/vgadb
+cddisk:DV: 9load /sys/src/9/pc/9pcflop.gz plan9.ini.cd /lib/vgadb
 	mk -a /sys/src/9/pc/9pccd.gz
+	mk -a /sys/src/9/pc/9pcflop.gz
 	rfork n
 	bind plan9.ini.cd plan9.ini
 	dd -if /dev/zero -of cddisk -bs 1024 -count 2880 >[2]/dev/null
@@ -74,8 +76,8 @@ clean:V:
 	rm -rf boot boot.bz2 boot.bflz boot.raw root.bz2 9pcflop ndisk 9load cddisk proto.cp 9loaddebug
 
 install:V: ndisk 9loaddebug
-	9fs outside
-	dst=/n/outside/sys/lib/dist/web.protect
+	9fs $out
+	dst=/n/$out/sys/lib/dist/web.protect
 	cp 9loaddebug $dst
 	gzip -9 < ndisk > $dst/plan9.flp.gz
 	#mk clean

+ 1 - 1
sys/lib/lp/process/generic

@@ -134,7 +134,7 @@ case postscript
 	case *
 		echo $type(2) file is improper for $LPDEST >[1=2]
 	}
-case HPJCL
+case HPJCL HP
 	switch ($LPCLASS) {
 	case *HPJCL*
 		$proc/noproc <$temp

+ 1 - 1
sys/lib/lp/process/gspipe

@@ -21,4 +21,4 @@ gs $GSOPT - >/dev/null
 
 cat $GSTMPFILE
 rm -f $GSTMPFILE
-exit
+exit ''

+ 1 - 0
sys/lib/mimetype

@@ -21,6 +21,7 @@
 .bcpio		application	x-bcpio		-		m
 .bib		text		plain		-		y # BibTex input
 .bmp		image		bmp		-		y # bitmapped image
+.bz2		-		-		bzip2		m # bzipped file
 .c		text		plain		-		y # C program
 .c++		text		plain		-		y # C++ program
 .cacert		application	x-x509-ca-cert	-		y # DER X.509 CA certificate

+ 0 - 2
sys/lib/sysconfig/proto/armpaqproto

@@ -13,8 +13,6 @@ acme
 			*
 	mail
 		readme
-		arm
-			*
 	wiki
 		guide
 adm

+ 5 - 0
sys/lib/tmac/tmac.s

@@ -1101,6 +1101,10 @@ Murray Hill, New Jersey 07974
 Bell Laboratories
 Piscataway, New Jersey 08854
 ..
+.de AW
+Bell Laboratories
+2018 Antwerp, Belgium
+..
 .de BT
 .nr PX \\n(.s
 .nr PF \\n(.f
@@ -1116,6 +1120,7 @@ Piscataway, New Jersey 08854
 .de PP
 .RT
 .if \\n(1T .sp \\n(PDu
+.ne 2v
 .ti +\\n(PIu
 ..
 .	\"SH - (unnumbered) section heading

+ 23 - 0
sys/man/1/con

@@ -17,6 +17,10 @@ con, telnet, rx, hayes, xms, xmr \- remote login, execution, and XMODEM file tra
 ]
 ]
 [
+.B -S
+.I svc
+]
+[
 .B -c
 .I cmd
 ]
@@ -26,6 +30,10 @@ con, telnet, rx, hayes, xms, xmr \- remote login, execution, and XMODEM file tra
 [
 .B -dCrn
 ]
+[
+.B -s
+.I svc
+]
 .RI [ net !] machine
 .PP
 .B rx
@@ -122,6 +130,21 @@ misinterpretation of
 with parity as
 .SM UTF\c
 \&.
+.TP
+.B -S
+Post a pipe as
+.BI /srv/ svc
+and connect it to standard input and output.
+This can be used with
+.B -n
+to create a standing connection that
+.IR consolefs (4),
+for example,
+can then open.
+For
+.IR telnet ,
+this option is
+.BR -s .
 .PP
 The
 .RB control\- \e

+ 7 - 0
sys/man/1/ps2pdf

@@ -81,3 +81,10 @@ command-line option.
 .B /rc/bin/pdf2ps
 .SH SEE ALSO
 .IR gs (1)
+.SH BUGS
+.IR Gs 's
+.I pdfwrite
+sometimes emits bad PDF at the default level 1.2.
+Adding
+.BR '-dCompatibilityLevel=1.4'
+should cure it.

+ 6 - 0
sys/man/2/exec

@@ -185,3 +185,9 @@ There can be no return to the calling process from a successful
 or
 .IR execl ;
 the calling image is lost.
+.SH BUGS
+There is a large but finite limit on the size of an argment list,
+typically around 409,600 bytes.
+The kernel constant
+.B TSTKSIZ
+controls this.

+ 4 - 1
sys/man/4/fossil

@@ -500,4 +500,7 @@ with little effort.
 .PP
 The
 .B -m
-option currently assumes a block size of 8K bytes.
+option currently assumes a block size of 8K bytes,
+and a single file system per
+.I fossil
+instance.

+ 7 - 0
sys/man/8/ping

@@ -14,6 +14,9 @@ ping, gping, traceroute, hogports \- probe the Internet
 ] [
 .B -s
 .I size
+] [
+.B -w
+.I waittime
 ]
 .I destination
 .PP
@@ -109,6 +112,10 @@ sets the length of the message to be
 bytes, ICMP header included.
 The size cannot be smaller than 32 or
 larger than 8192.  The default is 64.
+.TP
+.B w
+sets the additional time in milliseconds to wait
+after all packets are sent.
 .PP
 .I Gping
 is a

+ 2 - 2
sys/src/9/pc/devarch.c

@@ -605,8 +605,8 @@ static X86type x86intel[] =
 	{ 6,	8,	16,	"PentiumIII/Xeon", },
 	{ 6,	0xB,	16,	"PentiumIII/Xeon", },
 	{ 6,	0xF,	16,	"Xeon5000-series", },
-	{ 6,	0x16,	16,	"Core 2", },	/* 64-bit capable */
-	{ 6,	0x17,	16,	"Core 2", },
+	{ 6,	0x16,	16,	"Core 2 (Intel 64)", },
+	{ 6,	0x17,	16,	"Core 2 (Intel 64)", },
 	{ 6,	0x1c,	16,	"Atom", },
 	{ 0xF,	1,	16,	"P4", },	/* P4 */
 	{ 0xF,	2,	16,	"PentiumIV/Xeon", },

+ 2 - 0
sys/src/9/pc/ether82598.c

@@ -262,6 +262,7 @@ enum {
 
 typedef struct {
 	Pcidev	*p;
+	Ether	*edev;
 	u32int	*reg;
 	u32int	*reg3;
 	uchar	flag;
@@ -800,6 +801,7 @@ attach(Ether *e)
 	char buf[KNAMELEN];
 
 	c = e->ctlr;
+	c->edev = e;			/* point back to Ether* */
 	qlock(&c->alock);
 	if(c->alloc){
 		qunlock(&c->alock);

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

@@ -713,6 +713,7 @@ reboot(void *entry, void *code, ulong size)
 	print("rebooting...\n");
 
 	/* off we go - never to return */
+	coherence();
 	(*f)(PADDR(entry), PADDR(code), size);
 }
 

+ 18 - 14
sys/src/9/pc/usbuhci.c

@@ -382,7 +382,7 @@ queuetd(Ctlr *ctlr, QH *q, TD *t, int vf, char *why)
 		lt->link = PCIWADDR(lt->next) | vf;
 	lt->link = Terminate;
 	ilock(ctlr);
-	XPRINT("queuetd %s: t=%p lt=%p q=%p first=%p last=%p entries=%.8lux\n",
+	XPRINT("usbuhci: queuetd %s: t=%p lt=%p q=%p first=%p last=%p entries=%.8lux\n",
 		why, t, lt, q, q->first, q->last, q->entries);
 	if(q->first != nil){
 		q->last->link = PCIWADDR(t) | vf;
@@ -404,7 +404,7 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
 	Block *b;
 	int n, err;
 
-	XPRINT("cleanTD: %#lux %#lux %#lux %#lux\n",
+	XPRINT("usbuhci: cleanTD: %#lux %#lux %#lux %#lux\n",
 		t->link, t->status, t->dev, t->buffer);
 	if(t->ep != nil && t->ep->debug)
 		dumptd(t, 0);
@@ -413,9 +413,9 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
 	err = t->status & (AnyError & ~NAKed);
 	/* TO DO: on t->status&AnyError, q->entries will not have advanced */
 	if (err) {
-		XPRINT("cleanTD: Error %#lux %#lux %#lux %#lux\n",
+		XPRINT("usbuhci: cleanTD: Error %#lux %#lux %#lux %#lux\n",
 			t->link, t->status, t->dev, t->buffer);
-		print("cleanTD %d/%d: Error %#lux %#lux %#lux %#lux\n",
+		print("usbuhci: cleanTD %d/%d: Error %#lux %#lux %#lux %#lux\n",
 			t->ep->dev->x, t->ep->x,
 			t->link, t->status, t->dev, t->buffer);
 	}
@@ -445,19 +445,20 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
 		wakeup(&t->ep->dir[Dirin].rend);	/* TO DO */
 		break;
 	case Utoksetup:
-		XPRINT("cleanTD: Utoksetup %#p\n", &t->ep);
+		XPRINT("usbuhci: cleanTD: Utoksetup %#p\n", &t->ep);
 		/*
 		 * don't really need to wakeup: subsequent IN or OUT
 		 * gives status./
 		 */
 		if(t->ep != nil) {
 			wakeup(&t->ep->dir[Dirout].rend);	/* TO DO */
-			XPRINT("cleanTD: wakeup %#p\n", &t->ep->dir[Dirout].rend);
+			XPRINT("usbuhci: cleanTD: wakeup %#p\n",
+				&t->ep->dir[Dirout].rend);
 		}
 		break;
 	case Utokout:
 		/* TO DO: mark it done somewhere */
-		XPRINT("cleanTD: TokOut %#p\n", &t->ep);
+		XPRINT("usbuhci: cleanTD: TokOut %#p\n", &t->ep);
 		ilock(ctlr);		/* e->ntd++ is ilocked */
 		if(t->ep != nil){
 			if(t->bp){
@@ -471,7 +472,8 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
 			if(--t->ep->ntd < 0)
 				panic("cleantd ntd");
 			wakeup(&t->ep->dir[Dirout].rend);	/* TO DO */
-			XPRINT("cleanTD: wakeup %#p\n", &t->ep->dir[Dirout].rend);
+			XPRINT("usbuhci: cleanTD: wakeup %#p\n",
+				&t->ep->dir[Dirout].rend);
 		}
 		iunlock(ctlr);
 		break;
@@ -487,7 +489,7 @@ cleanq(Ctlr *ctlr, QH *q, int discard, int vf)
 	ilock(ctlr);
 	tp = nil;
 	for(t = q->first; t != nil;){
-		XPRINT("cleanq: %#lux %#lux %#lux %#lux %#lux %#p\n",
+		XPRINT("usbuchi: cleanq: %#lux %#lux %#lux %#lux %#lux %#p\n",
 		    t->link, t->status, t->dev, t->buffer, t->flags, t->next);
 		if(t->status & Active){
 			if(t->status & NAKed){
@@ -498,7 +500,7 @@ cleanq(Ctlr *ctlr, QH *q, int discard, int vf)
 				continue;
 			}
 			if(t->flags & CancelTD){
-				XPRINT("cancelTD: %#p\n", t);
+				XPRINT("usbuchi: cancelTD: %#p\n", t);
 				/* ensure interrupt next frame */
 				t->status = (t->status & ~Active) | IOC;
 				tp = t;
@@ -986,7 +988,7 @@ cleaniso(Endpt *e, int frnum)
 	id = e->x<<7 | (e->dev->x&0x7F);
 	do {
 		if (td->status & AnyError)
-			XPRINT("usbisoerror 0x%lux\n", td->status);
+			XPRINT("usbuhci: usbisoerror 0x%lux\n", td->status);
 		n = (td->status + 1) & 0x3ff;
 		e->nbytes += n;
 		if ((td->flags & IsoClean) == 0)
@@ -1001,7 +1003,8 @@ cleaniso(Endpt *e, int frnum)
 			if ((td->flags & IsoClean) == 0){
 				e->buffered -= n;
 				if (e->buffered < 0){
-//					print("e->buffered %d?\n", e->buffered);
+//					print("usbuchi: e->buffered %d?\n",
+//						e->buffered);
 					e->buffered = 0;
 				}
 			}
@@ -1142,7 +1145,8 @@ isoio(Ctlr *ctlr, Endpt *e, void *a, long n, ulong offset, int w)
 	}
 	p = a;
 	if (offset != 0 && offset != e->foffset){
-		iprint("offset %lud, foffset %llud\n", offset, e->foffset);
+		iprint("usbuhci: offset %lud, foffset %llud\n",
+			offset, e->foffset);
 		/* Seek to a specific position */
 		frnum = (IN(Frnum) + 8) & 0x3ff;
 		td = x->td0 + frnum;
@@ -1155,7 +1159,7 @@ isoio(Ctlr *ctlr, Endpt *e, void *a, long n, ulong offset, int w)
 		    (((w? (td->dev>>21): td->status) + 1) & 0x7ff)){
 			td = td->next;
 			if (td == x->xtd)
-				iprint("trouble\n");
+				iprint("usbuhci: trouble\n");
 		}
 		ilock(&ctlr->activends);
 		isolock = 1;

+ 1 - 0
sys/src/ape/lib/ap/power/tas.s

@@ -7,6 +7,7 @@ tas1:
 	LWAR	(R4), R3
 	CMP	R3, $0
 	BNE	tas0
+	DCBT	(R4)				/* fix 405 errata cpu_210 */
 	STWCCC	R5, (R4)
 	BNE	tas1
 tas0:

+ 14 - 7
sys/src/cmd/9660srv/9660srv.c

@@ -40,6 +40,14 @@ Xfsub	isosub =
 	ireaddir, iread, iwrite, iclunk, iremove, istat, iwstat
 };
 
+static vlong
+fakemax(vlong len)
+{
+	if(len == (1UL << 31) - 1)	/* max. 9660 size? */
+		len = (1ULL << 63) - 1;	/* pretend it's vast */
+	return len;
+}
+
 static void
 ireset(void)
 {}
@@ -362,12 +370,11 @@ static long
 iread(Xfile *f, char *buf, vlong offset, long count)
 {
 	int n, o, rcnt = 0;
-	long size;
-	vlong addr;
+	vlong size, addr;
 	Isofile *ip = f->ptr;
 	Iobuf *p;
 
-	size = l32(ip->d.size);
+	size = fakemax(l32(ip->d.size));
 	if(offset >= size)
 		return 0;
 	if(offset+count > size)
@@ -494,13 +501,13 @@ getdrec(Xfile *f, void *buf)
 {
 	Isofile *ip = f->ptr;
 	int len = 0, boff = 0;
-	ulong size;
 	vlong addr;
+	uvlong size;
 	Iobuf *p = 0;
 
 	if(!ip)
 		return -1;
-	size = l32(ip->d.size);
+	size = fakemax(l32(ip->d.size));
 	while(ip->offset < size){
 		addr = (l32(ip->d.addr)+ip->d.attrlen)*ip->blksize + ip->offset;
 		boff = addr % Sectorsize;
@@ -745,8 +752,8 @@ rzdir(Xfs *fs, Dir *d, int fmt, Drec *dp)
 		}
 	}
 	d->length = 0;
-	if((d->mode & DMDIR) == 0)
-		d->length = l32(dp->size);
+	if((d->mode & DMDIR) == 0)	
+		d->length = fakemax(l32(dp->size));
 	d->type = 0;
 	d->dev = 0;
 	d->atime = gtime(dp->date);

+ 3 - 3
sys/src/cmd/9660srv/iso9660.h

@@ -135,8 +135,8 @@ struct	Isofile
 {
 	short	fmt;		/* 'z' if iso, 'r' if high sierra */
 	short	blksize;
-	long	offset;		/* true offset when reading directory */
-	long odelta;	/* true size of directory just read */
-	long	doffset;	/* plan9 offset when reading directory */
+	vlong	offset;		/* true offset when reading directory */
+	long	odelta;		/* true size of directory just read */
+	vlong	doffset;	/* plan9 offset when reading directory */
 	Drec	d;
 };

+ 1 - 1
sys/src/cmd/aquarela/smbglobals.c

@@ -14,7 +14,7 @@ SmbGlobals smbglobals = {
 	.pipelanman = "/PIPE/LANMAN",
 	.l2sectorsize = 9,
 	.l2allocationsize = 14,
-	.convertspace = 1,
+	.convertspace = 0,
 	.log = {
 		.fd = -1,
 		.print = 0,

+ 22 - 9
sys/src/cmd/auth/authsrv.c

@@ -641,7 +641,7 @@ mschap(Ticketreq *tr)
 	uchar hash2[MShashlen];
 	uchar resp[MSresplen];
 	OMSchapreply reply;
-	int lmok, ntok;
+	int dupe, lmok, ntok;
 	DigestState *s;
 	uchar digest[SHA1dlen];
 
@@ -664,24 +664,36 @@ mschap(Ticketreq *tr)
 	secret = findsecret(KEYDB, tr->uid, sbuf);
 	hkey = findkey(KEYDB, tr->hostid, hbuf);
 	if(hkey == 0 || secret == 0){
-		replyerror("mschap-fail bad response %s", raddr);
+		replyerror("mschap-fail bad response %s/%s(%s)",
+			tr->uid, tr->hostid, raddr);
 		logfail(tr->uid);
 		exits(0);
 	}
 
-	/*
-	 *  check for match on LM algorithm
-	 */
 	lmhash(hash, secret);
 	mschalresp(resp, hash, chal);
 	lmok = memcmp(resp, reply.LMresp, MSresplen) == 0;
-
 	nthash(hash, secret);
 	mschalresp(resp, hash, chal);
 	ntok = memcmp(resp, reply.NTresp, MSresplen) == 0;
+	dupe = memcmp(reply.LMresp, reply.NTresp, MSresplen) == 0;
 
-	if(!ntok){
-		replyerror("mschap-fail bad response %s %ux", raddr, (lmok<<1)|ntok);
+	/*
+	 * It is valid to send the same response in both the LM and NTLM 
+	 * fields provided one of them is correct, if neither matches,
+	 * or the two fields are different and either fails to match, 
+	 * the whole sha-bang fails.
+	 *
+	 * This is an improvement in security as it allows clients who
+	 * wish to do NTLM auth (which is insecure) not to send
+	 * LM tokens (which is very insecure).
+	 *
+	 * Windows servers supports clients doing this also though
+	 * windows clients don't seem to use the feature.
+	 */
+	if((!ntok && !lmok) || ((!ntok || !lmok) && !dupe)){
+		replyerror("mschap-fail bad response %s/%s(%s) %d,%d,%d",
+			tr->uid, tr->hostid, raddr, dupe, lmok, ntok);
 		logfail(tr->uid);
 		exits(0);
 	}
@@ -695,7 +707,8 @@ mschap(Ticketreq *tr)
 		exits(0);
 
 	if(debug)
-		syslog(0, AUTHLOG, "mschap-ok %s %s %ux", tr->uid, raddr, (lmok<<1)|ntok);
+		replyerror("mschap-ok %s/%s(%s) %ux",
+			tr->uid, tr->hostid, raddr);
 
 	nthash(hash, secret);
 	md4(hash, 16, hash2, 0);

+ 13 - 7
sys/src/cmd/auth/factotum/fs.c

@@ -449,12 +449,16 @@ readlist(int off, int (*gen)(int, char*, uint, Fsstate*), Req *r, Fsstate *fss)
 	}
 }
 
+enum { Nearend = 2, };			/* at least room for \n and NUL */
+
+/* result in `a', of `n' bytes maximum */
 static int
 keylist(int i, char *a, uint n, Fsstate *fss)
 {
-	char buf[512];
+	int wb;
 	Keyinfo ki;
 	Key *k;
+	static char zero[Nearend];
 
 	k = nil;
 	mkkeyinfo(&ki, fss, nil);
@@ -463,14 +467,16 @@ keylist(int i, char *a, uint n, Fsstate *fss)
 	ki.usedisabled = 1;
 	if(findkey(&k, &ki, "") != RpcOk)
 		return 0;
-	snprint(buf, sizeof buf, "key %A %N\n", k->attr, k->privattr);
+
+	memset(a + n - Nearend, 0, Nearend);
+	wb = snprint(a, n, "key %A %N\n", k->attr, k->privattr);
 	closekey(k);
-	strcpy(buf+sizeof buf-2, "\n");	/* if line is really long, just truncate */
-	if(strlen(buf) > n)
+	if (wb >= n - 1 && a[n - 2] != '\n' && a[n - 2] != '\0') {
+		/* line won't fit in `a', so just truncate */
+		strcpy(a + n - 2, "\n");
 		return 0;
-	n = strlen(buf);
-	memmove(a, buf, n);
-	return n;
+	}
+	return wb;
 }
 
 static int

+ 3 - 1
sys/src/cmd/aux/consolefs.c

@@ -577,7 +577,8 @@ bcastmembers(Fs *fs, Console *c, char *msg, Fid *f)
 void
 handler(void*, char *msg)
 {
-	if(strstr(msg, "reopen"))
+	if(strstr(msg, "reopen") != nil ||
+	   strstr(msg, "write on closed pipe") != nil)
 		noted(NCONT);
 	noted(NDFLT);
 }
@@ -671,6 +672,7 @@ fsrun(void *v)
 	fs = a[0];
 	pfd = a[1];
 	fs->fd = pfd[0];
+	notify(handler);
 	for(;;){
 		d = dirstat(consoledb);
 		if(d != nil && d->mtime != dbmtime){

+ 3 - 1
sys/src/cmd/aux/gps/gpsfs.c

@@ -97,6 +97,7 @@ char *serial = "/dev/eia0";
 Gpsmsg gpsmsg[] = {
 [ASTRAL]	= { "ASTRAL",	 0,	0},
 [GPGGA]		= { "$GPGGA",	15,	0},
+/* NMEA 2.3 permits optional 8th field, mode */
 [GPGLL]		= { "$GPGLL",	 7,	0},
 [GPGSA]		= { "$GPGSA",	18,	0},
 [GPGSV]		= { "$GPGSV",	0,	0},
@@ -282,7 +283,8 @@ gpstrack(void *)
 		if(n == 0)
 			continue;
 		tp = type(t[0]);
-		if(tp >= 0 && tp < nelem(gpsmsg) && gpsmsg[tp].tokens && gpsmsg[tp].tokens != n){
+		if(tp >= 0 && tp < nelem(gpsmsg) && gpsmsg[tp].tokens &&
+		    gpsmsg[tp].tokens > n){
 			gpsmsg[tp].errors++;
 			if(debug)
 				fprint(2, "%s: Expect %d tokens, got %d\n",

+ 60 - 300
sys/src/cmd/con/con.c

@@ -1,17 +1,11 @@
 #include <u.h>
 #include <libc.h>
 
-#include "rustream.h"
-#include "ruttyio.h"
-#include "rusignal.h"
-#include "rufilio.h"
-
 int debug;		/* true if debugging */
 int ctl = -1;		/* control fd (for break's) */
 int raw;		/* true if raw is on */
 int consctl = -1;	/* control fd for cons */
 int ttypid;		/* pid's if the 2 processes (used to kill them) */
-int msgfd = -1;		/* mesgld file descriptor (for signals to be written to) */
 int outfd = 1;		/* local output file descriptor */
 int cooked;		/* non-zero forces cooked mode */
 int returns;		/* non-zero forces carriage returns not to be filtered out */
@@ -26,7 +20,8 @@ int baud;
 int notkbd;
 int nltocr;		/* translate kbd nl to cr  and vice versa */
 
-typedef struct Msg Msg;
+static char *srv;
+
 #define MAXMSG (2*8192)
 
 int	dodial(char*, char*, char*);
@@ -35,16 +30,10 @@ void	fromnet(int);
 long	iread(int, void*, int);
 long	iwrite(int, void*, int);
 int	menu(int);
-void	msgfromkbd(int);
-void	msgfromnet(int);
-int	msgwrite(int, void*, int);
 void	notifyf(void*, char*);
 void	pass(int, int, int);
 void	rawoff(void);
 void	rawon(void);
-int	readupto(int, char*, int);
-int	sendctl(int, int);
-int	sendctl1(int, int, int);
 void	stdcon(int);
 char*	system(int, char*);
 void	dosystem(int, char*);
@@ -61,7 +50,8 @@ void	simple(char*, char*);
 void
 usage(void)
 {
-	punt("usage: con [-CdnrRsTv] [-b baud] [-l [user]] [-c cmd] net!host[!service]");
+	punt("usage: con [-CdnrRsTv] [-b baud] [-l [user]] [-c cmd] [-S svc] "
+		"net!host[!service]");
 }
 
 void
@@ -75,13 +65,19 @@ main(int argc, char *argv[])
 	case 'b':
 		baud = atoi(EARGF(usage()));
 		break;
+	case 'C':
+		cooked = 1;
+		break;
+	case 'c':
+		cmd = EARGF(usage());
+		break;
 	case 'd':
 		debug = 1;
 		break;
 	case 'l':
 		limited = 1;
 		if(argv[1] != nil && argv[1][0] != '-')
-			remuser = ARGF();
+			remuser = EARGF(usage());
 		break;
 	case 'n':
 		notkbd = 1;
@@ -89,24 +85,21 @@ main(int argc, char *argv[])
 	case 'r':
 		returns = 0;
 		break;
+	case 's':
+		strip = 1;
+		break;
+	case 'S':
+		srv = EARGF(usage());
+		break;
 	case 'R':
 		nltocr = 1;
 		break;
 	case 'T':
 		crtonl = 1;
 		break;
-	case 'C':
-		cooked = 1;
-		break;
-	case 'c':
-		cmd = ARGF();
-		break;
 	case 'v':
 		verbose = 1;
 		break;
-	case 's':
-		strip = 1;
-		break;
 	default:
 		usage();
 	}ARGEND
@@ -342,16 +335,11 @@ menu(int net)
 			return -1;
 		case 'i':
 			buf[0] = 0x1c;
-			if(msgfd <= 0)
-				write(net, buf, 1);
-			else
-				sendctl1(msgfd, M_SIGNAL, SIGQUIT);
+			write(net, buf, 1);
 			done = 1;
 			break;
 		case 'b':
-			if(msgfd >= 0)
-				sendctl(msgfd, M_BREAK);
-			else if(ctl >= 0)
+			if(ctl >= 0)
 				write(ctl, "k", 1);
 			done = 1;
 			break;
@@ -374,6 +362,21 @@ menu(int net)
 	return 0;
 }
 
+void
+post(char *srv, int fd)
+{
+	int f;
+	char buf[32];
+
+	f = create(srv, OWRITE /* |ORCLOSE */ , 0666);
+	if(f < 0)
+		sysfatal("create %s: %r", srv);
+	snprint(buf, sizeof buf, "%d", fd);
+	if(write(f, buf, strlen(buf)) != strlen(buf))
+		sysfatal("write %s: %r", srv);
+	close(f);
+}
+
 /*
  *  the real work.  two processes pass bytes back and forth between the
  *  terminal and the network.
@@ -382,7 +385,23 @@ void
 stdcon(int net)
 {
 	int netpid;
-
+	int p[2];
+	char *svc;
+
+	svc = nil;
+	if (srv) {
+		if(pipe(p) < 0)
+			sysfatal("pipe: %r");
+		if (srv[0] != '/')
+			svc = smprint("/srv/%s", srv);
+		else
+			svc = srv;
+		post(svc, p[0]);
+		close(p[0]);
+		dup(p[1], 0);
+		dup(p[1], 1);
+		/* pipe is now std in & out */
+	}
 	ttypid = getpid();
 	switch(netpid = rfork(RFMEM|RFPROC)){
 	case -1:
@@ -391,13 +410,18 @@ stdcon(int net)
 	case 0:
 		notify(notifyf);
 		fromnet(net);
+		if (svc)
+			remove(svc);
 		postnote(PNPROC, ttypid, "die yankee dog");
 		exits(0);
 	default:
 		notify(notifyf);
 		fromkbd(net);
+		if (svc)
+			remove(svc);
 		if(notkbd)
-			for(;;)sleep(0);
+			for(;;)
+				sleep(0);
 		postnote(PNPROC, netpid, "die yankee dog");
 		exits(0);
 	}
@@ -582,15 +606,9 @@ system(int fd, char *cmd)
 		break;
 	default:
 		close(pfd[0]);
-		while((n = read(pfd[1], buf, sizeof(buf))) > 0){
-			if(msgfd >= 0){
-				if(msgwrite(fd, buf, n) != n)
-					break;
-			} else {
-				if(write(fd, buf, n) != n)
-					break;
-			}
-		}
+		while((n = read(pfd[1], buf, sizeof(buf))) > 0)
+			if(write(fd, buf, n) != n)
+				break;
 		p = waitpid();
 		outfd = 1;
 		close(pfd[1]);
@@ -663,261 +681,3 @@ iwrite(int f, void *a, int n)
 		return n;
 	return m;
 }
-
-/*
- *  The rest is to support the V10 mesgld protocol.
- */
-
-/*
- *  network orderings
- */
-#define get2byte(p) ((p)[0] + ((p)[1]<<8))
-#define get4byte(p) ((p)[0] + ((p)[1]<<8) + ((p)[2]<<16) + ((p)[3]<<24))
-#define put2byte(p, i) ((p)[0]=(i), (p)[1]=(i)>>8)
-#define put4byte(p, i) ((p)[0]=(i), (p)[1]=(i)>>8, (p)[2]=(i)>>16, (p)[3]=(i)>>24)
-
-/*
- *  tty parameters
- */
-int sgflags = ECHO;
-
-/*
- *  a mesgld message
- */
-struct Msg {
-	struct mesg h;
-	char b[MAXMSG];
-};
-
-
-/*
- *  send an empty mesgld message
- */
-int
-sendctl(int net, int type)
-{
-	Msg m;
-
-	m.h.type = type;
-	m.h.magic = MSGMAGIC;
-	put2byte(m.h.size, 0);
-	if(iwrite(net, &m, sizeof(struct mesg)) != sizeof(struct mesg))
-		return -1;
-	return 0;
-}
-
-/*
- *  send a one byte mesgld message
- */
-int
-sendctl1(int net, int type, int parm)
-{
-	Msg m;
-
-	m.h.type = type;
-	m.h.magic = MSGMAGIC;
-	m.b[0] = parm;
-	put2byte(m.h.size, 1);
-	if(iwrite(net, &m, sizeof(struct mesg)+1) != sizeof(struct mesg)+1)
-		return -1;
-	return 0;
-}
-
-/*
- *  read n bytes.  return -1 if it fails, 0 otherwise.
- */
-int
-readupto(int from, char *a, int len)
-{
-	int n;
-
-	while(len > 0){
-		n = iread(from, a, len);
-		if(n < 0)
-			return -1;
-		a += n;
-		len -= n;
-	}
-	return 0;
-}
-
-/*
- *  Decode a mesgld message from the network
- */
-void
-msgfromnet(int net)
-{
-	ulong com;
-	struct stioctl *io;
-	struct sgttyb *sg;
-	struct ttydevb *td;
-	struct tchars *tc;
-	int len;
-	Msg m;
-
-	for(;;){
-		/* get a complete mesgld message */
-		if(readupto(net, (char*)&m.h, sizeof(struct mesg)) < 0)
-			break;
-		if(m.h.magic != MSGMAGIC){
-			fprint(2, "con: bad message magic 0x%ux\n", m.h.magic);
-			break;
-		}
-		len = get2byte(m.h.size);
-		if(len > sizeof(m.b)){
-			len = sizeof(m.b);
-			fprint(2, "con: mesgld message too long\n");
-		}
-		if(len && readupto(net, m.b, len) < 0)
-			break;
-
-		/* decode */
-		switch(m.h.type){
-		case M_HANGUP:
-			if(debug)
-				fprint(2, "M_HANGUP\n");
-			return;
-		case M_DATA:
-			if(debug)
-				fprint(2, "M_DATA %d bytes\n", len);
-			if(iwrite(outfd, m.b, len) != len){
-				if(outfd == 1)
-					return;
-				outfd = 1;
-				if(iwrite(outfd, m.b, len) != len)
-					return;
-			}
-			continue;
-		case M_IOCTL:
-			break;
-		default:
-			/* ignore */
-			if(debug)
-				fprint(2, "con: unknown message\n");
-			continue;
-		}
-	
-		/*
-		 *  answer an ioctl
-		 */
-		io = (struct stioctl *)m.b;
-		com = get4byte(io->com);
-		if(debug)
-			fprint(2, "M_IOCTL %lud\n", com);
-		switch(com){
-		case FIOLOOKLD:
-			put4byte(io->data, tty_ld);
-			len = 0;
-			break;
-		case TIOCGETP:
-			sg = (struct sgttyb *)io->data;
-			sg->sg_ispeed = sg->sg_ospeed = B9600;
-			sg->sg_erase = 0010;	/* back space */
-			sg->sg_kill = 0025;	/* CNTL U */
-			put2byte(sg->sg_flags, sgflags);
-			len = sizeof(struct sgttyb);
-			break;
-		case TIOCSETN:
-		case TIOCSETP:
-			sg = (struct sgttyb *)io->data;
-			sgflags = get2byte(sg->sg_flags);
-			if((sgflags&(RAW|CBREAK)) || !(sgflags&ECHO))
-				rawon();
-			else
-				rawoff();
-			len = 0;
-			break;
-		case TIOCGETC:
-			tc = (struct tchars *)io->data;
-			tc->t_intrc = 0177;
-			tc->t_quitc = 0034;
-			tc->t_startc = 0;
-			tc->t_stopc = 0;
-			tc->t_eofc = 0004;
-			tc->t_brkc = 0;
-			len = sizeof(struct tchars);
-			break;
-		case TIOCSETC:
-			len = 0;
-			break;
-		case TIOCGDEV:
-			td = (struct ttydevb *)io->data;
-			td->ispeed = td->ospeed = B9600;
-			put2byte(td->flags, 0);
-			len = sizeof(struct ttydevb);
-			break;
-		case TIOCSDEV:
-			len = 0;
-			break;
-		default:
-			/*
-			 *  unimplemented
-			 */
-			m.b[len] = 0;
-			if(sendctl(net, M_IOCNAK) < 0)
-				return;
-			continue;
-		}
-	
-		/*
-		 *  acknowledge
-		 */
-		m.h.type = M_IOCACK;
-		m.h.magic = MSGMAGIC;
-		len += 4;
-		put2byte(m.h.size, len);
-		len += sizeof(struct mesg);
-		if(iwrite(net, &m, len) != len)
-			return;
-	}
-}
-
-/*
- *  Read the keyboard, convert to mesgld messages, and write it to the network.
- *  '^\' gets us into the menu.
- */
-void
-msgfromkbd(int net)
-{
-	long n;
-	char buf[MAXMSG];
-
-	for(;;){
-		n = iread(0, buf, sizeof(buf));
-		if(n < 0)
-			return;
-		if(n && memchr(buf, 0034, n)){
-			if(menu(net) < 0)
-				return;
-		} else {
-			if(msgwrite(net, buf, n) != n)
-				return;
-		}
-	}
-}
-
-int
-msgwrite(int fd, void *buf, int len)
-{
-	Msg m;
-	int n;
-
-	n = len;
-	memmove(m.b, buf, n);
-	put2byte(m.h.size, n);
-	m.h.magic = MSGMAGIC;
-	m.h.type = M_DATA;
-	n += sizeof(struct mesg);
-	if(iwrite(fd, &m, n) != n)
-		return -1;
-	
-	put2byte(m.h.size, 0);
-	m.h.magic = MSGMAGIC;
-	m.h.type = M_DELIM;
-	n = sizeof(struct mesg);
-	if(iwrite(fd, &m, n) != n)
-		return -1;
-
-	return len;
-}
-

+ 0 - 1
sys/src/cmd/con/mkfile

@@ -15,5 +15,4 @@ UPDATE=\
 
 </sys/src/cmd/mkmany
 
-con.$O:	rustream.h ruttyio.h rusignal.h rufilio.h
 

+ 0 - 37
sys/src/cmd/con/rufilio.h

@@ -1,37 +0,0 @@
-/*
- * general file and stream ioctls
- */
-
-/*
- * for FIOINSLD
- */
-struct	insld {
-	short	ld;
-	short	level;
-};
-
-/*
- * for passing files across streams
- */
-struct	passfd {
-	int	fd;
-	short	uid;
-	short	gid;
-	short	nice;
-	char	logname[8];
-};
-
-/*
- * file ioctls
- */
-#define	FIOCLEX		(('f'<<8)|1)
-#define	FIONCLEX	(('f'<<8)|2)
-#define	FIOPUSHLD	(('f'<<8)|3)
-#define	FIOPOPLD	(('f'<<8)|4)
-#define	FIOLOOKLD	(('f'<<8)|5)
-#define FIOINSLD	(('f'<<8)|6)
-#define	FIOSNDFD	(('f'<<8)|7)
-#define	FIORCVFD	(('f'<<8)|8)
-#define	FIOACCEPT	(('f'<<8)|9)
-#define	FIOREJECT	(('f'<<8)|10)
-#define	FIONREAD	(('f'<<8)|127)

+ 0 - 36
sys/src/cmd/con/rusignal.h

@@ -1,36 +0,0 @@
-#define NSIG	32
-
-#define	SIGHUP	1	/* hangup */
-#define	SIGINT	2	/* interrupt */
-#define	SIGQUIT	3	/* quit */
-#define	SIGILL	4	/* illegal instruction (not reset when caught) */
-#define	SIGTRAP	5	/* trace trap (not reset when caught) */
-#define	SIGIOT	6	/* IOT instruction */
-#define	SIGEMT	7	/* EMT instruction */
-#define	SIGFPE	8	/* floating point exception */
-#define		K_INTOVF 1	/* integer overflow */
-#define		K_INTDIV 2	/* integer divide by zero */
-#define		K_FLTOVF 3	/* floating overflow */
-#define		K_FLTDIV 4	/* floating/decimal divide by zero */
-#define		K_FLTUND 5	/* floating underflow */
-#define		K_DECOVF 6	/* decimal overflow */
-#define		K_SUBRNG 7	/* subscript out of range */
-#define	SIGKILL	9	/* kill (cannot be caught or ignored) */
-#define	SIGKIL	9
-#define	SIGBUS	10	/* bus error */
-#define	SIGSEGV	11	/* segmentation violation */
-#define	SIGSYS	12	/* bad argument to system call */
-#define	SIGPIPE	13	/* write on a pipe with no one to read it */
-#define	SIGALRM	14	/* alarm clock */
-#define	SIGTERM	15	/* software termination signal from kill */
-
-#define	SIGSTOP	17	/* sendable stop signal not from tty */
-#define	SIGTSTP	18	/* stop signal from tty */
-#define	SIGCONT	19	/* continue a stopped process */
-#define	SIGCHLD	20	/* to parent on child stop or exit */
-#define	SIGTTIN	21	/* to readers pgrp upon background tty read */
-#define	SIGTTOU	22	/* like TTIN for output if (tp->t_local&LTOSTOP) */
-#define SIGTINT	23	/* to pgrp on every input character if LINTRUP */
-#define	SIGXCPU	24	/* exceeded CPU time limit */
-#define	SIGXFSZ	25	/* exceeded file size limit */
-#define	SIGLAB	26	/* file label changed; secure unix only (not reset) */

+ 0 - 77
sys/src/cmd/con/rustream.h

@@ -1,77 +0,0 @@
-/*
- * Control messages (regular priority)
- */
-#define	M_DATA	0		/* regular data (not ctl) */
-#define	M_BREAK	01		/* line break */
-#define	M_HANGUP 02		/* line disconnect */
-#define	M_DELIM	03		/* data delimiter */
-#define	M_ECHO	04		/* request ACK (1 param) */
-#define	M_ACK	05		/* response to ECHO (1 param) */
-#define	M_IOCTL	06		/* ioctl; set/get params */
-#define	M_DELAY 07		/* real-time xmit delay (1 param) */
-#define	M_CTL	010		/* device-specific control message */
-#define	M_PASS	011		/* pass file */
-#define	M_YDEL	012		/* stream has started generating delims */
-#define	M_NDEL	013		/* stream has stopped generating delims */
-
-/*
- * Control messages (high priority; go to head of queue)
- */
-#define	M_SIGNAL 0101		/* generate process signal */
-#define	M_FLUSH	0102		/* flush your queues */
-#define	M_STOP	0103		/* stop transmission immediately */
-#define	M_START	0104		/* restart transmission after stop */
-#define	M_IOCACK 0105		/* acknowledge ioctl */
-#define	M_IOCNAK 0106		/* negative ioctl acknowledge */
-#define	M_CLOSE	0107		/* channel closes (dk only) */
-#define	M_IOCWAIT 0110		/* stop ioctl timeout, ack/nak follows later */
-
-/*
- * ioctl message packet
- */
-
-#define	STIOCSIZE	16
-#define	STIOCHDR	4
-
-struct stioctl {
-	unsigned char com[STIOCHDR];	/* four-byte command, low order byte first */
-	char data[STIOCSIZE];	/* depends on command */
-};
-
-/*
- * header for messages, see mesg.c
- */
-#define MSLEN 2
-struct mesg {
-	char		type;
-	unsigned char	magic;
-	unsigned char	size[MSLEN];	/* 2 byte size, low order first */
-};
-
-#define	MSGMAGIC	0345
-#define	MSGHLEN	4	/* true length of struct mesg in bytes */
-
-/*
- * magic numbers of line disciplines
- */
-
-#define	tty_ld		0	/* tty processing */
-#define	cdkp_ld		1	/* URP protocol -- character mode (same as 1) */
-#define	rdk_ld		2	/* raw datakit protocol */
-#define	pk_ld		3	/* packet driver */
-#define	mesg_ld		4	/* data message protocol */
-#define	dkp_ld		5	/* URP protocol -- block mode */
-#define	ntty_ld		6	/* new tty processing */
-#define	buf_ld		7	/* buffer up characters till timeout */
-#define	trc_ld		8	/* stream tracer */
-#define	rmesg_ld	9	/* reverse message processing */
-#define	ip_ld		10	/* IP - push on net interfaces (il, ec, ...) */
-#define	tcp_ld		11	/* TCP (inet) - only one instance, on /dev/ip6 */
-#define	chroute_ld	12	/* Chaosnet - push on net interfaces (il, ec, ...) */
-#define	arp_ld		13	/* Ethernet address resolution - on net interfaces */
-#define	udp_ld		14	/* UDP (inet) - only one instance, on /dev/ip */
-#define	chaos_ld	15	/* Chaosnet - only one, above any chroute_ld */
-#define	filter_ld	16	/* Delimiter filtering */
-#define	dump_ld		17	/* Debug dumper */
-#define	conn_ld		18	/* Connection line discipline */
-#define	uxp_ld		19	/* unix common control protocol */

+ 0 - 116
sys/src/cmd/con/ruttyio.h

@@ -1,116 +0,0 @@
-/*
- * teletype-related ioctls
- */
-
-struct sgttyb {
-	char	sg_ispeed;		/* no longer set/returned by kernel */
-	char	sg_ospeed;		/* no longer set/returned by kernel */
-	char	sg_erase;		/* erase character */
-	char	sg_kill;		/* kill character */
-	unsigned char	sg_flags[2];	/* mode flags, low byte first */
-};
-
-/*
- * Structure for setting and getting tty device parammeters.
- */
-struct ttydevb {
-	char	ispeed;			/* input speed */
-	char	ospeed;			/* output speed */
-	unsigned char	flags[2];		/* mode flags, low byte first */
-};
-
-/*
- * List of special characters
- */
-struct tchars {
-	char	t_intrc;	/* interrupt */
-	char	t_quitc;	/* quit */
-	char	t_startc;	/* start output */
-	char	t_stopc;	/* stop output */
-	char	t_eofc;		/* end-of-file */
-	char	t_brkc;		/* input delimiter (like nl) */
-};
-
-/*
- * modes in sg_flags
- */
-#define	TANDEM	01
-#define	CBREAK	02
-#define	LCASE	04
-#define	ECHO	010
-#define	CRMOD	020
-#define	RAW	040
-/* 0300: former parity bits */
-#define	NLDELAY	001400
-#define	TBDELAY	006000
-#define	XTABS	06000
-#define	CRDELAY	030000
-#define	VTDELAY	040000
-#define BSDELAY 0100000
-#define ALLDELAY 0177400
-
-/*
- * Delay algorithms
- */
-#define	CR0	0
-#define	CR1	010000
-#define	CR2	020000
-#define	CR3	030000
-#define	NL0	0
-#define	NL1	000400
-#define	NL2	001000
-#define	NL3	001400
-#define	TAB0	0
-#define	TAB1	002000
-#define	TAB2	004000
-#define	FF0	0
-#define	FF1	040000
-#define	BS0	0
-#define	BS1	0100000
-
-/*
- * Speeds
- */
-#define B0	0
-#define B50	1
-#define B75	2
-#define B110	3
-#define B134	4
-#define B150	5
-#define B200	6
-#define B300	7
-#define B600	8
-#define B1200	9
-#define	B1800	10
-#define B2400	11
-#define B4800	12
-#define B9600	13
-#define EXTA	14
-#define EXTB	15
-
-/*
- * device flags
- */
-
-#define	F8BIT	040	/* eight-bit path */
-#define	ODDP	0100
-#define	EVENP	0200
-#define ANYP	0300
-
-/*
- * tty ioctl commands
- */
-#define	TIOCHPCL	(('t'<<8)|2)
-#define	TIOCGETP	(('t'<<8)|8)
-#define	TIOCSETP	(('t'<<8)|9)
-#define	TIOCSETN	(('t'<<8)|10)
-#define	TIOCEXCL	(('t'<<8)|13)
-#define	TIOCNXCL	(('t'<<8)|14)
-#define	TIOCFLUSH	(('t'<<8)|16)
-#define	TIOCSETC	(('t'<<8)|17)
-#define	TIOCGETC	(('t'<<8)|18)
-#define	TIOCSBRK	(('t'<<8)|19)
-#define TIOCGDEV	(('t'<<8)|23)	/* get device parameters */
-#define TIOCSDEV	(('t'<<8)|24)	/* set device parameters */
-#define	TIOCSPGRP	(('t'<<8)|118)	/* set pgrp of tty */
-#define	TIOCGPGRP	(('t'<<8)|119)	/* get pgrp of tty */

+ 48 - 38
sys/src/cmd/fossil/cache.c

@@ -322,7 +322,7 @@ cacheCheck(Cache *c)
 		}
 	}
 if(c->nheap + refed != c->nblocks){
-fprint(2, "cacheCheck: nheap %d refed %d nblocks %ld\n", c->nheap, refed, c->nblocks);
+fprint(2, "%s: cacheCheck: nheap %d refed %d nblocks %ld\n", argv0, c->nheap, refed, c->nblocks);
 cacheDump(c);
 }
 	assert(c->nheap + refed == c->nblocks);
@@ -330,11 +330,11 @@ cacheDump(c);
 	for(i = 0; i < c->nblocks; i++){
 		b = &c->blocks[i];
 		if(b->ref){
-if(1)fprint(2, "p=%d a=%ud %V ref=%d %L\n", b->part, b->addr, b->score, b->ref, &b->l);
+if(1)fprint(2, "%s: p=%d a=%ud %V ref=%d %L\n", argv0, b->part, b->addr, b->score, b->ref, &b->l);
 			refed++;
 		}
 	}
-if(refed > 0)fprint(2, "cacheCheck: in used %d\n", refed);
+if(refed > 0)fprint(2, "%s: cacheCheck: in used %d\n", argv0, refed);
 }
 
 
@@ -360,11 +360,14 @@ cacheBumpBlock(Cache *c)
 			vtSleep(c->heapwait);
 			if(c->nheap == 0){
 				printed = 1;
-				fprint(2, "entire cache is busy, %d dirty -- waking flush thread\n", c->ndirty);
+				fprint(2, "%s: entire cache is busy, %d dirty "
+					"-- waking flush thread\n",
+					argv0, c->ndirty);
 			}
 		}
 		if(printed)
-			fprint(2, "cache is okay again, %d dirty\n", c->ndirty);
+			fprint(2, "%s: cache is okay again, %d dirty\n",
+				argv0, c->ndirty);
 	}
 
 	b = c->heap[0];
@@ -387,7 +390,7 @@ cacheBumpBlock(Cache *c)
 	}
 
 
-if(0)fprint(2, "droping %d:%x:%V\n", b->part, b->addr, b->score);
+if(0)fprint(2, "%s: dropping %d:%x:%V\n", argv0, b->part, b->addr, b->score);
 	/* set block to a reasonable state */
 	b->ref = 1;
 	b->part = PartError;
@@ -496,7 +499,7 @@ _cacheLocal(Cache *c, int part, u32int addr, int mode, u32int epoch)
 		if(b->part != part || b->addr != addr)
 			continue;
 		if(epoch && b->l.epoch != epoch){
-fprint(2, "_cacheLocal want epoch %ud got %ud\n", epoch, b->l.epoch);
+fprint(2, "%s: _cacheLocal want epoch %ud got %ud\n", argv0, epoch, b->l.epoch);
 			vtUnlock(c->lk);
 			vtSetError(ELabelMismatch);
 			return nil;
@@ -533,7 +536,7 @@ fprint(2, "_cacheLocal want epoch %ud got %ud\n", epoch, b->l.epoch);
 	 * For now, I'm not going to worry about it.
 	 */
 
-if(0)fprint(2, "cacheLocal: %d: %d %x\n", getpid(), b->part, b->addr);
+if(0)fprint(2, "%s: cacheLocal: %d: %d %x\n", argv0, getpid(), b->part, b->addr);
 	bwatchLock(b);
 	vtLock(b->lk);
 	b->nlock = 1;
@@ -547,7 +550,7 @@ if(0)fprint(2, "cacheLocal: %d: %d %x\n", getpid(), b->part, b->addr);
 	}
 	if(epoch && b->l.epoch != epoch){
 		blockPut(b);
-fprint(2, "_cacheLocal want epoch %ud got %ud\n", epoch, b->l.epoch);
+fprint(2, "%s: _cacheLocal want epoch %ud got %ud\n", argv0, epoch, b->l.epoch);
 		vtSetError(ELabelMismatch);
 		return nil;
 	}
@@ -603,8 +606,8 @@ cacheLocalData(Cache *c, u32int addr, int type, u32int tag, int mode, u32int epo
 	if(b == nil)
 		return nil;
 	if(b->l.type != type || b->l.tag != tag){
-		fprint(2, "cacheLocalData: addr=%d type got %d exp %d: tag got %ux exp %ux\n",
-			addr, b->l.type, type, b->l.tag, tag);
+		fprint(2, "%s: cacheLocalData: addr=%d type got %d exp %d: tag got %ux exp %ux\n",
+			argv0, addr, b->l.type, type, b->l.tag, tag);
 		vtSetError(ELabelMismatch);
 		blockPut(b);
 		return nil;
@@ -649,7 +652,7 @@ cacheGlobal(Cache *c, uchar score[VtScoreSize], int type, u32int tag, int mode)
 	}
 
 	if(b == nil){
-if(0)fprint(2, "cacheGlobal %V %d\n", score, type);
+if(0)fprint(2, "%s: cacheGlobal %V %d\n", argv0, score, type);
 
 		b = cacheBumpBlock(c);
 
@@ -724,7 +727,7 @@ cacheAllocBlock(Cache *c, int type, u32int tag, u32int epoch, u32int epochLow)
 	addr = fl->last;
 	b = cacheLocal(c, PartLabel, addr/n, OReadOnly);
 	if(b == nil){
-		fprint(2, "cacheAllocBlock: xxx %R\n");
+		fprint(2, "%s: cacheAllocBlock: xxx %R\n", argv0);
 		vtUnlock(fl->lk);
 		return nil;
 	}
@@ -736,7 +739,7 @@ cacheAllocBlock(Cache *c, int type, u32int tag, u32int epoch, u32int epochLow)
 				blockPut(b);
 				fl->last = 0;
 				vtSetError("disk is full");
-				fprint(2, "cacheAllocBlock: xxx1 %R\n");
+				fprint(2, "%s: cacheAllocBlock: xxx1 %R\n", argv0);
 				vtUnlock(fl->lk);
 				return nil;
 			}
@@ -746,7 +749,7 @@ cacheAllocBlock(Cache *c, int type, u32int tag, u32int epoch, u32int epochLow)
 			b = cacheLocal(c, PartLabel, addr/n, OReadOnly);
 			if(b == nil){
 				fl->last = addr;
-				fprint(2, "cacheAllocBlock: xxx2 %R\n");
+				fprint(2, "%s: cacheAllocBlock: xxx2 %R\n", argv0);
 				vtUnlock(fl->lk);
 				return nil;
 			}
@@ -763,7 +766,7 @@ Found:
 	blockPut(b);
 	b = cacheLocal(c, PartData, addr, OOverWrite);
 	if(b == nil){
-		fprint(2, "cacheAllocBlock: xxx3 %R\n");
+		fprint(2, "%s: cacheAllocBlock: xxx3 %R\n", argv0);
 		return nil;
 	}
 assert(b->iostate == BioLabel || b->iostate == BioClean);
@@ -774,14 +777,14 @@ assert(b->iostate == BioLabel || b->iostate == BioClean);
 	lab.epoch = epoch;
 	lab.epochClose = ~(u32int)0;
 	if(!blockSetLabel(b, &lab, 1)){
-		fprint(2, "cacheAllocBlock: xxx4 %R\n");
+		fprint(2, "%s: cacheAllocBlock: xxx4 %R\n", argv0);
 		blockPut(b);
 		return nil;
 	}
 	vtZeroExtend(vtType[type], b->data, 0, c->size);
 if(0)diskWrite(c->disk, b);
 
-if(0)fprint(2, "fsAlloc %ud type=%d tag = %ux\n", addr, type, tag);
+if(0)fprint(2, "%s: fsAlloc %ud type=%d tag = %ux\n", argv0, addr, type, tag);
 	lastAlloc = addr;
 	fl->nused++;
 	vtUnlock(fl->lk);
@@ -821,7 +824,8 @@ cacheCountUsed(Cache *c, u32int epochLow, u32int *used, u32int *total, u32int *b
 			blockPut(b);
 			b = cacheLocal(c, PartLabel, addr/n, OReadOnly);
 			if(b == nil){
-				fprint(2, "flCountUsed: loading %ux: %R\n", addr/n);
+				fprint(2, "%s: flCountUsed: loading %ux: %R\n",
+					argv0, addr/n);
 				break;
 			}
 		}
@@ -895,7 +899,7 @@ blockPut(Block* b)
 	if(b == nil)
 		return;
 
-if(0)fprint(2, "blockPut: %d: %d %x %d %s\n", getpid(), b->part, b->addr, c->nheap, bioStr(b->iostate));
+if(0)fprint(2, "%s: blockPut: %d: %d %x %d %s\n", argv0, getpid(), b->part, b->addr, c->nheap, bioStr(b->iostate));
 
 	if(b->iostate == BioDirty)
 		bwatchDependency(b);
@@ -1036,8 +1040,8 @@ blockDependency(Block *b, Block *bb, int index, uchar *score, Entry *e)
 		assert(b->l.type == BtData);
 
 	if(bb->iostate != BioDirty){
-		fprint(2, "%d:%x:%d iostate is %d in blockDependency\n",
-			bb->part, bb->addr, bb->l.type, bb->iostate);
+		fprint(2, "%s: %d:%x:%d iostate is %d in blockDependency\n",
+			argv0, bb->part, bb->addr, bb->l.type, bb->iostate);
 		abort();
 	}
 
@@ -1046,7 +1050,7 @@ blockDependency(Block *b, Block *bb, int index, uchar *score, Entry *e)
 		return;
 
 	assert(bb->iostate == BioDirty);
-if(0)fprint(2, "%d:%x:%d depends on %d:%x:%d\n", b->part, b->addr, b->l.type, bb->part, bb->addr, bb->l.type);
+if(0)fprint(2, "%s: %d:%x:%d depends on %d:%x:%d\n", argv0, b->part, b->addr, b->l.type, bb->part, bb->addr, bb->l.type);
 
 	p->part = bb->part;
 	p->addr = bb->addr;
@@ -1130,7 +1134,9 @@ blockRollback(Block *b, uchar *buf)
 			superUnpack(&super, buf);
 			addr = globalToLocal(p->old.score);
 			if(addr == NilBlock){
-				fprint(2, "rolling back super block: bad replacement addr %V\n", p->old.score);
+				fprint(2, "%s: rolling back super block: "
+					"bad replacement addr %V\n",
+					argv0, p->old.score);
 				abort();
 			}
 			super.active = addr;
@@ -1198,8 +1204,8 @@ blockWrite(Block *b)
 		 * which means it hasn't been written out since we last saw it.
 		 */
 		if(bb->iostate != BioDirty){
-			fprint(2, "%d:%x:%d iostate is %d in blockWrite\n",
-				bb->part, bb->addr, bb->l.type, bb->iostate);
+			fprint(2, "%s: %d:%x:%d iostate is %d in blockWrite\n",
+				argv0, bb->part, bb->addr, bb->l.type, bb->iostate);
 			/* probably BioWriting if it happens? */
 			if(bb->iostate == BioClean)
 				goto ignblock;
@@ -1212,8 +1218,8 @@ blockWrite(Block *b)
 			 * We don't know how to temporarily undo
 			 * b's dependency on bb, so just don't write b yet.
 			 */
-			if(0) fprint(2, "blockWrite skipping %d %x %d %d; need to write %d %x %d\n",
-				b->part, b->addr, b->vers, b->l.type, p->part, p->addr, bb->vers);
+			if(0) fprint(2, "%s: blockWrite skipping %d %x %d %d; need to write %d %x %d\n",
+				argv0, b->part, b->addr, b->vers, b->l.type, p->part, p->addr, bb->vers);
 			return 0;
 		}
 		/* keep walking down the list */
@@ -1247,7 +1253,7 @@ blockSetIOState(Block *b, int iostate)
 	Cache *c;
 	BList *p, *q;
 
-if(0) fprint(2, "iostate part=%d addr=%x %s->%s\n", b->part, b->addr, bioStr(b->iostate), bioStr(iostate));
+if(0) fprint(2, "%s: iostate part=%d addr=%x %s->%s\n", argv0, b->part, b->addr, bioStr(b->iostate), bioStr(iostate));
 
 	c = b->c;
 
@@ -1386,8 +1392,8 @@ blockCopy(Block *b, u32int tag, u32int ehi, u32int elo)
 	Label l;
 
 	if((b->l.state&BsClosed) || b->l.epoch >= ehi)
-		fprint(2, "blockCopy %#ux %L but fs is [%ud,%ud]\n",
-			b->addr, &b->l, elo, ehi);
+		fprint(2, "%s: blockCopy %#ux %L but fs is [%ud,%ud]\n",
+			argv0, b->addr, &b->l, elo, ehi);
 
 	bb = cacheAllocBlock(b->c, b->l.type, tag, ehi, elo);
 	if(bb == nil){
@@ -1513,7 +1519,8 @@ doRemoveLink(Cache *c, BList *p)
 
 	/* sanity check */
 	if(b->l.epoch > p->epoch){
-		fprint(2, "doRemoveLink: strange epoch %ud > %ud\n", b->l.epoch, p->epoch);
+		fprint(2, "%s: doRemoveLink: strange epoch %ud > %ud\n",
+			argv0, b->l.epoch, p->epoch);
 		blockPut(b);
 		return;
 	}
@@ -1546,7 +1553,8 @@ doRemoveLink(Cache *c, BList *p)
 			doRemoveLink(c, &bl);
 			b = cacheLocalData(c, p->addr, p->type, p->tag, OReadOnly, 0);
 			if(b == nil){
-				fprint(2, "warning: lost block in doRemoveLink\n");
+				fprint(2, "%s: warning: lost block in doRemoveLink\n",
+					argv0);
 				return;
 			}
 		}
@@ -1583,7 +1591,7 @@ blistAlloc(Block *b)
 	 	 * blockDirty used to flush but no longer does.
 		 */
 		assert(b->iostate == BioClean);
-		fprint(2, "blistAlloc: called on clean block\n");
+		fprint(2, "%s: blistAlloc: called on clean block\n", argv0);
 		return nil;
 	}
 
@@ -1617,7 +1625,7 @@ blistAlloc(Block *b)
 			vtWakeup(c->flush);
 			vtSleep(c->blrend);
 			if(c->blfree == nil)
-				fprint(2, "flushing for blists\n");
+				fprint(2, "%s: flushing for blists\n", argv0);
 		}
 	}
 
@@ -1950,8 +1958,8 @@ flushFill(Cache *c)
 		p++;
 	}
 	if(ndirty != c->ndirty){
-		fprint(2, "ndirty mismatch expected %d found %d\n",
-			c->ndirty, ndirty);
+		fprint(2, "%s: ndirty mismatch expected %d found %d\n",
+			argv0, c->ndirty, ndirty);
 		c->ndirty = ndirty;
 	}
 	vtUnlock(c->lk);
@@ -2040,7 +2048,9 @@ flushThread(void *a)
 				 * Pause a little.
 				 */
 				if(i==0){
-					// fprint(2, "flushthread found nothing to flush - %d dirty\n", c->ndirty);
+					// fprint(2, "%s: flushthread found "
+					//	"nothing to flush - %d dirty\n",
+					//	argv0, c->ndirty);
 					sleep(250);
 				}
 				break;

+ 61 - 12
sys/src/cmd/fossil/file.c

@@ -1,4 +1,5 @@
 #include "stdinc.h"
+#include "9.h"			/* for consPrint */
 #include "dat.h"
 #include "fns.h"
 #include "error.h"
@@ -16,12 +17,12 @@ struct File {
 
 	int	partial;	/* file was never really open */
 	int	removed;	/* file has been removed */
-	int	dirty;		/* dir is dirty with respect to meta data in block */
-	u32int	boff;		/* block offset within msource for this file's meta data */
+	int	dirty;	/* dir is dirty with respect to meta data in block */
+	u32int	boff;	/* block offset within msource for this file's meta data */
 
-	DirEntry dir;		/* meta data for this file */
+	DirEntry dir;	/* meta data for this file, including component name */
 
-	File	*up;		/* parent file */
+	File	*up;		/* parent file (directory) */
 	File	*next;		/* sibling */
 
 	/* data for file */
@@ -159,6 +160,7 @@ fileRoot(Source *r)
 	root->boff = 0;
 	root->up = mr;
 	root->source = r0;
+	r0->file = root;			/* point back to source */
 	r0 = nil;
 	root->msource = r1;
 	r1 = nil;
@@ -201,8 +203,10 @@ Err:
 }
 
 static Source *
-fileOpenSource(File *f, u32int offset, u32int gen, int dir, uint mode, int issnapshot)
+fileOpenSource(File *f, u32int offset, u32int gen, int dir, uint mode,
+	int issnapshot)
 {
+	char *rname, *fname;
 	Source *r;
 
 	if(!sourceLock(f->source, mode))
@@ -216,7 +220,15 @@ fileOpenSource(File *f, u32int offset, u32int gen, int dir, uint mode, int issna
 		goto Err;
 	}
 	if(r->dir != dir && r->mode != -1){
-fprint(2, "fileOpenSource: dir mismatch %d %d\n", r->dir, dir);
+		/* this hasn't been as useful as we hoped it would be. */
+		rname = sourceName(r);
+		fname = fileName(f);
+		consPrint("%s: source %s for file %s: fileOpenSource: "
+			"dir mismatch %d %d\n",
+			f->source->fs->name, rname, fname, r->dir, dir);
+		free(rname);
+		free(fname);
+
 		vtSetError(EBadMeta);
 		goto Err;
 	}
@@ -283,17 +295,22 @@ _fileWalk(File *f, char *elem, int partial)
 		 */
 		ff->partial = 1;
 	}else if(ff->dir.mode & ModeDir){
-		ff->source = fileOpenSource(f, ff->dir.entry, ff->dir.gen, 1, ff->mode, ff->issnapshot);
-		ff->msource = fileOpenSource(f, ff->dir.mentry, ff->dir.mgen, 0, ff->mode, ff->issnapshot);
+		ff->source = fileOpenSource(f, ff->dir.entry, ff->dir.gen,
+			1, ff->mode, ff->issnapshot);
+		ff->msource = fileOpenSource(f, ff->dir.mentry, ff->dir.mgen,
+			0, ff->mode, ff->issnapshot);
 		if(ff->source == nil || ff->msource == nil)
 			goto Err;
 	}else{
-		ff->source = fileOpenSource(f, ff->dir.entry, ff->dir.gen, 0, ff->mode, ff->issnapshot);
+		ff->source = fileOpenSource(f, ff->dir.entry, ff->dir.gen,
+			0, ff->mode, ff->issnapshot);
 		if(ff->source == nil)
 			goto Err;
 	}
 
 	/* link in and up parent ref count */
+	if (ff->source)
+		ff->source->file = ff;		/* point back */
 	ff->next = f->down;
 	f->down = ff;
 	ff->up = f;
@@ -337,7 +354,8 @@ _fileOpen(Fs *fs, char *path, int partial)
 			elem[n] = 0;
 			ff = _fileWalk(f, elem, partial && *p=='\0');
 			if(ff == nil){
-				vtSetError("%.*s: %R", utfnlen(opath, p-opath), opath);
+				vtSetError("%.*s: %R", utfnlen(opath, p-opath),
+					opath);
 				goto Err;
 			}
 			fileDecRef(f);
@@ -464,6 +482,7 @@ fileCreate(File *f, char *elem, ulong mode, char *uid)
 	sourceUnlock(f->msource);
 
 	ff->source = r;
+	r->file = ff;			/* point back */
 	ff->msource = mr;
 
 	if(mode&ModeTemporary){
@@ -572,7 +591,7 @@ Err1:
 	return -1;
 }
 
-/* 
+/*
  * Changes the file block bn to be the given block score.
  * Very sneaky.  Only used by flfmt.
  */
@@ -1205,6 +1224,7 @@ fileRemove(File *f, char *uid)
 		assert(ff->removed);
 
 	sourceRemove(f->source);
+	f->source->file = nil;		/* erase back pointer */
 	f->source = nil;
 	if(f->msource){
 		sourceRemove(f->msource);
@@ -1770,7 +1790,7 @@ fileGetSources(File *f, Entry *e, Entry *ee)
 	|| !getEntry(f->msource, ee, 0))
 		return 0;
 	return 1;
-}	
+}
 
 /*
  * Walk down to the block(s) containing the Entries
@@ -1791,3 +1811,32 @@ fileWalkSources(File *f)
 	sourceUnlock(f->msource);
 	return 1;
 }
+
+/*
+ * convert File* to full path name in malloced string.
+ * this hasn't been as useful as we hoped it would be.
+ */
+char *
+fileName(File *f)
+{
+	char *name, *pname;
+	File *p;
+	static char root[] = "/";
+
+	if (f == nil)
+		return strdup("/**GOK**");
+
+	p = fileGetParent(f);
+	if (p == f)
+		name = strdup(root);
+	else {
+		pname = fileName(p);
+		if (strcmp(pname, root) == 0)
+			name = smprint("/%s", f->dir.elem);
+		else
+			name = smprint("%s/%s", pname, f->dir.elem);
+		free(pname);
+	}
+	fileDecRef(p);
+	return name;
+}

+ 31 - 27
sys/src/cmd/fossil/fs.c

@@ -10,13 +10,12 @@ static void snapClose(Snap*);
 Fs *
 fsOpen(char *file, VtSession *z, long ncache, int mode)
 {
-	Fs *fs;
-	Disk *disk;
-	int fd;
+	int fd, m;
+	uchar oscore[VtScoreSize];
 	Block *b, *bs;
+	Disk *disk;
+	Fs *fs;
 	Super super;
-	int m;
-	uchar oscore[VtScoreSize];
 
 	switch(mode){
 	default:
@@ -45,6 +44,7 @@ fsOpen(char *file, VtSession *z, long ncache, int mode)
 
 	fs = vtMemAllocZ(sizeof(Fs));
 	fs->mode = mode;
+	fs->name = vtStrDup(file);
 	fs->blockSize = diskBlockSize(disk);
 	fs->elk = vtLockAlloc();
 	fs->cache = cacheAlloc(disk, z, ncache, mode);
@@ -65,7 +65,7 @@ fsOpen(char *file, VtSession *z, long ncache, int mode)
 	fs->ehi = super.epochHigh;
 	fs->elo = super.epochLow;
 
-//fprint(2, "fs->ehi %d fs->elo %d active=%d\n", fs->ehi, fs->elo, super.active);
+//fprint(2, "%s: fs->ehi %d fs->elo %d active=%d\n", argv0, fs->ehi, fs->elo, super.active);
 
 	fs->source = sourceRoot(fs, super.active, mode);
 	if(fs->source == nil){
@@ -75,7 +75,8 @@ fsOpen(char *file, VtSession *z, long ncache, int mode)
 		 */
 		if(mode == OReadOnly || strcmp(vtGetError(), EBadRoot) != 0)
 			goto Err;
-		b = cacheLocalData(fs->cache, super.active, BtDir, RootTag, OReadWrite, 0);
+		b = cacheLocalData(fs->cache, super.active, BtDir, RootTag,
+			OReadWrite, 0);
 		if(b == nil){
 			vtSetError("cacheLocalData: %R");
 			goto Err;
@@ -109,17 +110,18 @@ fsOpen(char *file, VtSession *z, long ncache, int mode)
 		}
 	}
 
-//fprint(2, "got fs source\n");
+//fprint(2, "%s: got fs source\n", argv0);
 
 	vtRLock(fs->elk);
 	fs->file = fileRoot(fs->source);
+	fs->source->file = fs->file;		/* point back */
 	vtRUnlock(fs->elk);
 	if(fs->file == nil){
 		vtSetError("fileRoot: %R");
 		goto Err;
 	}
 
-//fprint(2, "got file root\n");
+//fprint(2, "%s: got file root\n", argv0);
 
 	if(mode == OReadWrite){
 		fs->metaFlush = periodicAlloc(fsMetaFlush, fs, 1000);
@@ -128,7 +130,7 @@ fsOpen(char *file, VtSession *z, long ncache, int mode)
 	return fs;
 
 Err:
-fprint(2, "fsOpen error\n");
+fprint(2, "%s: fsOpen error\n", argv0);
 	fsClose(fs);
 	return nil;
 }
@@ -149,6 +151,7 @@ fsClose(Fs *fs)
 	cacheFree(fs->cache);
 	if(fs->arch)
 		archFree(fs->arch);
+	vtMemFree(fs->name);
 	vtRUnlock(fs->elk);
 	vtLockFree(fs->elk);
 	memset(fs, ~0, sizeof(Fs));
@@ -183,11 +186,11 @@ superGet(Cache *c, Super* super)
 	Block *b;
 
 	if((b = cacheLocal(c, PartSuper, 0, OReadWrite)) == nil){
-		fprint(2, "superGet: cacheLocal failed: %R");
+		fprint(2, "%s: superGet: cacheLocal failed: %R\n", argv0);
 		return nil;
 	}
 	if(!superUnpack(super, b->data)){
-		fprint(2, "superGet: superUnpack failed: %R");
+		fprint(2, "%s: superGet: superUnpack failed: %R\n", argv0);
 		blockPut(b);
 		return nil;
 	}
@@ -203,7 +206,8 @@ superWrite(Block* b, Super* super, int forceWrite)
 	if(forceWrite){
 		while(!blockWrite(b)){
 			/* BUG: what should really happen here? */
-			fprint(2, "could not write super block; waiting 10 seconds\n");
+			fprint(2, "%s: could not write super block; "
+				"waiting 10 seconds\n", argv0);
 			sleep(10*1000);
 		}
 		while(b->iostate != BioClean && b->iostate != BioDirty){
@@ -424,11 +428,11 @@ bumpEpoch(Fs *fs, int doarchive)
 
 	b = blockCopy(b, RootTag, fs->ehi+1, fs->elo);
 	if(b == nil){
-		fprint(2, "bumpEpoch: blockCopy: %R\n");
+		fprint(2, "%s: bumpEpoch: blockCopy: %R\n", argv0);
 		return 0;
 	}
 
-	if(0) fprint(2, "snapshot root from %d to %d\n", oldaddr, b->addr);
+	if(0) fprint(2, "%s: snapshot root from %d to %d\n", argv0, oldaddr, b->addr);
 	entryPack(&e, b->data, 1);
 	blockDirty(b);
 
@@ -604,7 +608,7 @@ fsSnapshot(Fs *fs, char *srcpath, char *dstpath, int doarchive)
 	return 1;
 
 Err:
-	fprint(2, "fsSnapshot: %R\n");
+	fprint(2, "%s: fsSnapshot: %R\n", argv0);
 	if(src)
 		fileDecRef(src);
 	if(dst)
@@ -964,16 +968,16 @@ fsSnapshotRemove(Fs *fs)
 
 struct Snap
 {
-	Fs *fs;
-	Periodic *tick;
-	VtLock *lk;
-	uint snapMinutes;
-	uint archMinute;
-	uint snapLife;
-	u32int lastSnap;
-	u32int lastArch;
-	u32int lastCleanup;
-	uint ignore;
+	Fs	*fs;
+	Periodic*tick;
+	VtLock	*lk;
+	uint	snapMinutes;
+	uint	archMinute;
+	uint	snapLife;
+	u32int	lastSnap;
+	u32int	lastArch;
+	u32int	lastCleanup;
+	uint	ignore;
 };
 
 static void
@@ -998,7 +1002,7 @@ snapEvent(void *v)
 	if(s->snapMinutes != ~0 && s->snapMinutes != 0
 	&& now%s->snapMinutes==0 && now != s->lastSnap){
 		if(!fsSnapshot(s->fs, nil, nil, 0))
-			fprint(2, "fsSnapshot snap: %R\n");
+			fprint(2, "%s: fsSnapshot snap: %R\n", argv0);
 		s->lastSnap = now;
 	}
 

+ 36 - 21
sys/src/cmd/fossil/source.c

@@ -2,6 +2,7 @@
 #include "dat.h"
 #include "fns.h"
 #include "error.h"
+#include "9.h"
 
 static int	sizeToDepth(uvlong s, int psize, int dsize);
 static u32int 	tagGen(void);
@@ -16,9 +17,10 @@ static int	sourceGrowDepth(Source*, Block*, Entry*, int);
 static Source *
 sourceAlloc(Fs *fs, Block *b, Source *p, u32int offset, int mode, int issnapshot)
 {
-	Source *r;
 	int epb;
 	u32int epoch;
+	char *pname = nil;
+	Source *r;
 	Entry e;
 
 	assert(p==nil || sourceIsLocked(p));
@@ -38,36 +40,44 @@ sourceAlloc(Fs *fs, Block *b, Source *p, u32int offset, int mode, int issnapshot
 	 * get prints.
 	 */
 	if(!entryUnpack(&e, b->data, offset % epb)){
-		fprint(2, "%s: %V: sourceAlloc: entryUnpack failed\n", argv0,
-			b->score);
+		pname = sourceName(p);
+		consPrint("%s: %s %V: sourceAlloc: entryUnpack failed\n",
+			fs->name, pname, b->score);
 		goto Bad;
 	}
 	if(!(e.flags & VtEntryActive)){
-		if(0) fprint(2, "%s: %V: sourceAlloc: not active\n",
-			argv0, e.score);
+		pname = sourceName(p);
+		if(0) consPrint("%s: %s %V: sourceAlloc: not active\n",
+			fs->name, pname, e.score);
 		goto Bad;
 	}
 	if(e.psize < 256 || e.dsize < 256){
-		fprint(2, "%s: %V: sourceAlloc: psize %ud dsize %ud\n",
-			argv0, e.score, e.psize, e.dsize);
+		pname = sourceName(p);
+		consPrint("%s: %s %V: sourceAlloc: psize %ud or dsize %ud < 256\n",
+			fs->name, pname, e.score, e.psize, e.dsize);
 		goto Bad;
 	}
 
 	if(e.depth < sizeToDepth(e.size, e.psize, e.dsize)){
-		fprint(2, "%s: %V: sourceAlloc: depth %ud size %llud psize %ud dsize %ud\n",
-			argv0, e.score, e.depth, e.size, e.psize, e.dsize);
+		pname = sourceName(p);
+		consPrint("%s: %s %V: sourceAlloc: depth %ud size %llud "
+			"psize %ud dsize %ud\n", fs->name, pname,
+			e.score, e.depth, e.size, e.psize, e.dsize);
 		goto Bad;
 	}
 
 	if((e.flags & VtEntryLocal) && e.tag == 0){
-		fprint(2, "%s: %V: sourceAlloc: flags %#ux tag %#ux\n",
-			argv0, e.score, e.flags, e.tag);
+		pname = sourceName(p);
+		consPrint("%s: %s %V: sourceAlloc: flags %#ux tag %#ux\n",
+			fs->name, pname, e.score, e.flags, e.tag);
 		goto Bad;
 	}
 
 	if(e.dsize > fs->blockSize || e.psize > fs->blockSize){
-		fprint(2, "%s: %V: sourceAlloc: psize %ud dsize %ud blocksize %ud\n",
-			argv0, e.score, e.psize, e.dsize, fs->blockSize);
+		pname = sourceName(p);
+		consPrint("%s: %s %V: sourceAlloc: psize %ud or dsize %ud "
+			"> blocksize %ud\n", fs->name, pname, e.score,
+			e.psize, e.dsize, fs->blockSize);
 		goto Bad;
 	}
 
@@ -104,7 +114,7 @@ sourceAlloc(Fs *fs, Block *b, Source *p, u32int offset, int mode, int issnapshot
 		vtUnlock(p->lk);
 	}
 	r->epoch = epoch;
-//	fprint(2, "%s: sourceAlloc: have %V be.%d fse.%d %s\n", argv0, b->score,
+//	consPrint("sourceAlloc: have %V be.%d fse.%d %s\n", b->score,
 //		b->l.epoch, r->fs->ehi, mode == OReadWrite? "rw": "ro");
 	memmove(r->score, b->score, VtScoreSize);
 	r->scoreEpoch = b->l.epoch;
@@ -112,10 +122,11 @@ sourceAlloc(Fs *fs, Block *b, Source *p, u32int offset, int mode, int issnapshot
 	r->epb = epb;
 	r->tag = b->l.tag;
 
-//	fprint(2, "%s: sourceAlloc: %p -> %V %d\n", r, r->score, r->offset);
+//	consPrint("%s: sourceAlloc: %p -> %V %d\n", r, r->score, r->offset);
 
 	return r;
 Bad:
+	free(pname);
 	vtSetError(EBadEntry);
 	return nil;
 }
@@ -131,8 +142,8 @@ sourceRoot(Fs *fs, u32int addr, int mode)
 		return nil;
 
 	if(mode == OReadWrite && b->l.epoch != fs->ehi){
-		fprint(2, "%s: sourceRoot: fs->ehi = %ud, b->l = %L\n",
-			argv0, fs->ehi, &b->l);
+		consPrint("sourceRoot: fs->ehi = %ud, b->l = %L\n",
+			fs->ehi, &b->l);
 		blockPut(b);
 		vtSetError(EBadRoot);
 		return nil;
@@ -170,12 +181,10 @@ sourceOpen(Source *r, ulong offset, int mode, int issnapshot)
 Source *
 sourceCreate(Source *r, int dsize, int dir, u32int offset)
 {
-	int i;
-	Block *b;
+	int i, epb, psize;
 	u32int bn, size;
+	Block *b;
 	Entry e;
-	int epb;
-	int psize;
 	Source *rr;
 
 	assert(sourceIsLocked(r));
@@ -1052,3 +1061,9 @@ tagGen(void)
 	}
 	return tag;
 }
+
+char *
+sourceName(Source *s)
+{
+	return fileName(s->file);
+}

+ 25 - 7
sys/src/cmd/ip/dhcpd/ndb.c

@@ -8,9 +8,31 @@
 #include <ndb.h>
 #include "dat.h"
 
-Ndb *db;
+static Ndb *db;
 char *ndbfile;
 
+/*
+ * open ndbfile as db if not already open.  also check for stale data
+ * and reload as needed.
+ */
+static Ndb *
+opendb(void)
+{
+	static ulong lastcheck;
+
+	/* check no more often than once every minute */
+	if(db == nil) {
+		db = ndbopen(ndbfile);
+		if(db != nil)
+			lastcheck = now;
+	} else if(now >= lastcheck + 60) {
+		if (ndbchanged(db))
+			ndbreopen(db);
+		lastcheck = now;
+	}
+	return db;
+}
+
 Iplifc*
 findlifc(uchar *ip)
 {
@@ -70,9 +92,7 @@ lookupip(uchar *ipaddr, Info *iip, int gate)
 	Ndbtuple *t, *nt;
 	char *attrs[32], **p;
 
-	if(db == 0)
-		db = ndbopen(ndbfile);
-	if(db == 0){
+	if(opendb() == nil){
 		warning(1, "can't open db");
 		return -1;
 	}
@@ -185,9 +205,7 @@ lookup(Bootp *bp, Info *iip, Info *riip)
 	char *hwval, hwbuf[33];
 	uchar ciaddr[IPaddrlen];
 
-	if(db == 0)
-		db = ndbopen(ndbfile);
-	if(db == 0){
+	if(opendb() == nil){
 		warning(1, "can't open db");
 		return -1;
 	}

+ 15 - 23
sys/src/cmd/ip/httpd/init.c

@@ -6,7 +6,9 @@
 void
 usage(void)
 {
-	fprint(2, "usage: httpd [-b inbuf] [-d domain] [-r remoteip] [-w webroot] [-N netdir] [-R reqline] [-L logfd0 logfd1] method version uri [search]\n");
+	fprint(2, "usage: %s [-b inbuf] [-d domain] [-r remoteip] [-w webroot]"
+		" [-N netdir] [-L logfd0 logfd1] [-R reqline]"
+		" method version uri [search]\n", argv0);
 	exits("usage");
 }
 
@@ -20,7 +22,7 @@ static	HSPriv		priv;
 HConnect*
 init(int argc, char **argv)
 {
-	char *s, *vs;
+	char *vs;
 
 	hinit(&connect.hin, 0, Hread);
 	hinit(&connect.hout, 1, Hwrite);
@@ -35,37 +37,27 @@ init(int argc, char **argv)
 	netdir = "/net";
 	ARGBEGIN{
 	case 'b':
-		s = ARGF();
-		if(s != nil)
-			hload(&connect.hin, s);
+		hload(&connect.hin, EARGF(usage()));
 		break;
 	case 'd':
-		hmydomain = ARGF();
+		hmydomain = EARGF(usage());
 		break;
 	case 'r':
-		priv.remotesys = ARGF();
+		priv.remotesys = EARGF(usage());
 		break;
 	case 'w':
-		webroot = ARGF();
-		break;
-	case 'N':
-		netdir = ARGF();
+		webroot = EARGF(usage());
 		break;
 	case 'L':
-		s = ARGF();
-		if(s == nil)
-			usage();
-		logall[0] = strtol(s, nil, 10);
-		s = ARGF();
-		if(s == nil)
-			usage();
-		logall[1] = strtol(s, nil, 10);
+		logall[0] = strtol(EARGF(usage()), nil, 10);
+		logall[1] = strtol(EARGF(usage()), nil, 10);
+		break;
+	case 'N':
+		netdir = EARGF(usage());
 		break;
 	case 'R':
-		s = ARGF();
-		if(s == nil)
-			usage();
-		snprint((char*)connect.header, sizeof(connect.header), "%s", s);
+		snprint((char*)connect.header, sizeof(connect.header), "%s",
+			EARGF(usage()));
 		break;
 	default:
 		usage();

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

@@ -55,6 +55,7 @@ int rcvdmsgs;
 int rint;
 ushort firstseq;
 vlong sum;
+int waittime = 5000;
 
 static char *network, *target;
 
@@ -304,7 +305,7 @@ rcvr(int fd, int msglen, int interval, int nmsg)
 
 	sum = 0;
 	while(lostmsgs+rcvdmsgs < nmsg){
-		alarm((nmsg-lostmsgs-rcvdmsgs)*interval+5000);
+		alarm((nmsg-lostmsgs-rcvdmsgs)*interval+waittime);
 		n = read(fd, buf, sizeof buf);
 		alarm(0);
 		now = nsec();
@@ -523,6 +524,9 @@ main(int argc, char **argv)
 	case 's':
 		msglen = atoi(EARGF(usage()));
 		break;
+	case 'w':
+		waittime = atoi(EARGF(usage()));
+		break;
 	default:
 		usage();
 		break;

+ 2 - 1
sys/src/cmd/jpg/png.c

@@ -196,7 +196,8 @@ show(int fd, char *name, int outc)
 			return "allocimage";
 		}
 		if(loadimage(i, i->r, c->chans[0], c->chanlen) < 0){
-			fprint(2, "png: loadimage %s failed: %r\n", name);
+			fprint(2, "png: loadimage %s of %d bytes failed: %r\n",
+				name, c->chanlen);
 			return "loadimage";
 		}
 		i2 = allocimage(display, c->r, outchan, 0, 0);

+ 1 - 0
sys/src/cmd/jpg/readyuv.c

@@ -37,6 +37,7 @@ looksize(char *file, vlong size, int *pixels, int *lines, int *bits)
 			continue;
 		p = atoll(a[3]);
 		l = atoll(a[5]);
+		l += atoll(a[7]);
 		if (l*p*2 == size){
 			*pixels = p;
 			*lines = l;

+ 9 - 21
sys/src/cmd/lp/lpsend.c

@@ -227,19 +227,16 @@ void
 main(int argc, char *argv[])
 {
 	char *devdir;
-	int i, rv, netfd, bsize;
-	int datafd;
-
+	int i, rv, netfd, bsize, datafd;
 #ifndef plan9
-
 	void (*oldhandler)();
-
 #endif
 
 	/* make connection */
 	if (argc != 2) {
-		fprint(stderr, "usage: %s network!destination!service\n", argv[0]);
-		exits("incorrect number of arguments");
+		fprint(stderr, "usage: %s network!destination!service\n",
+			argv[0]);
+		exits("usage");
 	}
 
 	/* read options line from stdin into lnbuf */
@@ -250,16 +247,16 @@ main(int argc, char *argv[])
 	bsize = prereadfile(datafd);
 
 	/* network connection is opened after data is in to avoid timeout */
-	if ((netfd=dial(argv[1], 0, 0, 0)) < 0) {
-		fprint(stderr, "dialing %s\n", devdir);
-		perror("dial");
+	if ((netfd = dial(argv[1], 0, 0, 0)) < 0) {
+		fprint(stderr, "dialing ");
+		perror(argv[1]);
 		exits("can't dial");
 	}
 
 	/* write out the options we read above */
 	if (write(netfd, lnbuf, i) != i) {
 		error(0, "write error while sending options\n");
-		exits("write error while sending options");
+		exits("write error sending options");
 	}
 
 	/* send the size of the file to be sent */
@@ -268,7 +265,7 @@ main(int argc, char *argv[])
 	if ((rv=write(netfd, lnbuf, i)) != i) {
 		perror("write error while sending size");
 		error(0, "write returned %d\n", rv);
-		exits("write error while sending size");
+		exits("write error sending size");
 	}
 
 	if (seek(datafd, 0L, 0) < 0) {
@@ -278,13 +275,9 @@ main(int argc, char *argv[])
 	/* mirror performance in readfile() in lpdaemon */
 
 #ifdef plan9
-
 	atnotify(alarmhandler, 1);
-
 #else
-
 	oldhandler = signal(SIGALRM, alarmhandler);
-
 #endif
 
 	dbgstate = 1;
@@ -316,16 +309,11 @@ main(int argc, char *argv[])
 	dbgstate = 5;
 
 #ifdef plan9
-
 	atnotify(alarmhandler, 0);
 	/* close down network connections and go away */
 	exits("");
-
 #else
-
 	signal(SIGALRM, oldhandler);
 	exit(0);
-
 #endif
-
 }

+ 1 - 1
sys/src/cmd/upas/common/process.c

@@ -131,7 +131,7 @@ proc_wait(process *pp)
 	for(;;){
 		status = wait();
 		if(status == nil){
-			errstr(err, sizeof(err));
+			rerrstr(err, sizeof(err));
 			if(strstr(err, "interrupt") == 0)
 				break;
 		}

+ 10 - 2
sys/src/cmd/upas/filterkit/deliver.c

@@ -14,7 +14,7 @@ usage(void)
 void
 main(int argc, char **argv)
 {
-	int bytes, fd;
+	int bytes, fd, i;
 	char now[30];
 	char *deliveredto;
 	Addr *a;
@@ -38,9 +38,17 @@ main(int argc, char **argv)
 	l = syslock(argv[2]);
 
 	/* append to mbox */
+	i = 0;
+retry:
 	fd = open(argv[2], OWRITE);
-	if(fd < 0)
+	if(fd < 0){
+		rerrstr(now, sizeof(now));
+		if(strstr(now, "exclusive lock") && i++ < 20){
+			sleep(500);	/* wait for lock to go away */
+			goto retry;
+		}
 		sysfatal("opening mailbox: %r");
+	}
 	seek(fd, 0, 2);
 	strncpy(now, ctime(time(0)), sizeof(now));
 	now[28] = 0;

+ 0 - 1
sys/src/cmd/upas/fs/dat.h

@@ -149,7 +149,6 @@ extern int	debug;
 extern int	fflag;
 extern int	logging;
 extern char	user[Elemlen];
-extern char	stdmbox[Pathlen];
 extern QLock	mbllock;
 extern Mailbox	*mbl;
 extern char	*mntpt;

+ 7 - 2
sys/src/cmd/upas/fs/plan9.c

@@ -164,7 +164,7 @@ purgedeleted(Mailbox *mb)
 static char*
 _readmbox(Mailbox *mb, int doplumb, Mlock *lk)
 {
-	int fd;
+	int fd, n;
 	String *tmp;
 	Dir *d;
 	static char err[128];
@@ -177,10 +177,15 @@ _readmbox(Mailbox *mb, int doplumb, Mlock *lk)
 	/*
 	 *  open the mailbox.  If it doesn't exist, try the temporary one.
 	 */
+	n = 0;
 retry:
 	fd = open(mb->path, OREAD);
 	if(fd < 0){
-		errstr(err, sizeof(err));
+		rerrstr(err, sizeof(err));
+		if(strstr(err, "exclusive lock") != 0 && n++ < 20){
+			sleep(500);	/* wait for lock to go away */
+			goto retry;
+		}
 		if(strstr(err, "exist") != 0){
 			tmp = s_copy(mb->path);
 			s_append(tmp, ".tmp");

+ 8 - 2
sys/src/cmd/upas/send/send.h

@@ -1,5 +1,11 @@
-#define MAXSAME 16
-#define MAXSAMECHAR 1024
+/*
+ * these limits are intended to stay within those imposed by SMTP
+ * and avoid tickling bugs in other mail systems.
+ * they both pertain to attempts to group recipients for the same
+ * destination together in a single copy of a message.
+ */
+#define MAXSAME 32	/* max recipients; was 16 */
+#define MAXSAMECHAR 1024 /* max chars in the list of recipients */
 
 /* status of a destination*/
 typedef enum {

+ 1 - 1
sys/src/cmd/usb/disk/disk.c

@@ -505,7 +505,7 @@ scanstatus(int ctlrno, int id)
 	if (f == nil)
 		sysfatal("can't open %s: %r", buf);
 	if (debug)
-		fprint(2, "\n%s: reading %s\n", argv0, buf);
+		fprint(2, "%s: reading %s\n", argv0, buf);
 	winner = 0;
 	while (!winner && (p = Brdline(f, '\n')) != nil) {
 		p[Blinelen(f)-1] = '\0';

+ 72 - 29
sys/src/cmd/usb/usbd/usbd.c

@@ -9,6 +9,7 @@
 #define STACKSIZE 128*1024
 
 static int dontfork;
+static int usbnum;
 
 Ref	busy;
 
@@ -34,14 +35,43 @@ usage(void)
 	threadexitsall("usage");
 }
 
+/*
+ * based on libthread's threadsetname, but drags in less library code.
+ * actually just sets the arguments displayed.
+ */
+void
+procsetname(char *fmt, ...)
+{
+	int fd;
+	char *cmdname;
+	char buf[32];
+	va_list arg;
+
+	va_start(arg, fmt);
+	cmdname = vsmprint(fmt, arg);
+	va_end(arg);
+	if (cmdname == nil)
+		return;
+	snprint(buf, sizeof buf, "#p/%d/args", getpid());
+	if((fd = open(buf, OWRITE)) >= 0){
+		write(fd, cmdname, strlen(cmdname)+1);
+		close(fd);
+	}
+	free(cmdname);
+}
+
 void
 work(void *a)
 {
 	int port;
+	char name[100];
 	Hub *hub;
 	Enum *arg;
 
 	hub = a;
+	snprint(name, sizeof name, "%H", hub);
+	procsetname(name);
+
 	for(port = 1; port <= hub->nport; port++){
 		if (debug)
 			fprint(2, "enumerate port %H.%d\n", hub, port);
@@ -61,12 +91,48 @@ work(void *a)
 }
 
 void
-threadmain(int argc, char **argv)
+realmain(void *)
 {
 	int i;
 	Hub *h;
-	int usbnum;
 
+	if (!dontfork) {
+		/* don't hold window open */
+		close(0);
+		close(1);
+		open("/dev/null", OREAD);
+		open("/dev/null", OWRITE);
+		if(!debug && !verbose) {
+			close(2);
+			open("/dev/null", OWRITE);
+		}
+	}
+	if(usbnum < 0){
+		/* always fork off usb[1—n] */
+		for(i=1; (h = roothub(i)) != nil; i++) {
+			incref(&busy);
+			proccreate(work, h, STACKSIZE);
+		}
+		usbnum = 0;
+	}
+	/* usb0 might be handled in this proc */
+	if((h = roothub(usbnum)) != nil){
+		incref(&busy);
+		if (dontfork)
+			work(h);
+		else
+			proccreate(work, h, STACKSIZE);
+	}
+	if (debug)
+		fprint(2, "done\n");
+	while (busy.ref)
+		sleep(100);
+	threadexits(nil);
+}
+
+void
+threadmain(int argc, char **argv)
+{
 	usbnum = -1;
 	ARGBEGIN{
 	case 'd':
@@ -93,33 +159,10 @@ threadmain(int argc, char **argv)
 	usbfmtinit();
 	fmtinstall('H', Hfmt);
 
-	if(usbnum < 0){
-		/* always fork off usb[1—n] */
-		for(i=1; (h = roothub(i)) != nil; i++) {
-			incref(&busy);
-			proccreate(work, h, STACKSIZE);
-		}
-		usbnum = 0;
-	}
-	/* usb0 might be handled in this proc */
-	if((h = roothub(usbnum)) != nil){
-		incref(&busy);
-		if (dontfork) {
-			work(h);
-		} else {
-			rfork(RFNOTEG);
-			proccreate(work, h, STACKSIZE);
-			/* don't hold window open */
-			close(0);
-			close(1);
-			if(!debug && !verbose)
-				close(2);
-		}
-	}
-	if (debug)
-		fprint(2, "done\n");
-	while (busy.ref)
-		sleep(100);
+	if (dontfork)
+		realmain(nil);
+	else
+		procrfork(realmain, nil, STACKSIZE, RFNOTEG | RFFDG);
 	threadexits(nil);
 }
 

+ 27 - 8
sys/src/cmd/webfs/cookies.c

@@ -539,10 +539,14 @@ isdomainmatch(char *name, char *pattern)
 	if(strcmp(ipattr(name), "dom")==0 && pattern[0]=='.'){
 		lname = strlen(name);
 		lpattern = strlen(pattern);
+		/* e.g., name: www.google.com && pattern: .google.com */
 		if(lname >= lpattern && cistrcmp(name+lname-lpattern, pattern)==0)
 			return 1;
+		/* e.g., name: google.com && pattern: .google.com */
+		if(lpattern > lname &&
+		    cistrcmp(pattern+lpattern-lname, name) == 0)
+			return 1;
 	}
-
 	return 0;
 }
 
@@ -557,7 +561,7 @@ iscookiematch(Cookie *c, char *dom, char *path, uint now)
 {
 	return isdomainmatch(dom, c->dom)
 		&& strncmp(c->path, path, strlen(c->path))==0
-		&& c->expire >= now;
+		&& (c->expire == 0 || c->expire >= now);
 }
 
 /* 
@@ -577,8 +581,15 @@ cookiesearch(Jar *jar, char *dom, char *path, int issecure)
 	j = newjar();
 	for(i=0; i<jar->nc; i++){
 		if(cookiedebug)
-			fprint(2, "\ttry %s %s %d %s\n", jar->c[i].dom, jar->c[i].path, jar->c[i].secure, jar->c[i].name);
-		if((issecure || !jar->c[i].secure) && iscookiematch(&jar->c[i], dom, path, now)){
+			fprint(2, "\ttry %s %s %d %s\n", jar->c[i].dom,
+				jar->c[i].path, jar->c[i].secure,
+				jar->c[i].name);
+		/*
+		 * fgb says omitting secure checks is necessary to
+		 * get some sites to work, but it seems dubious.
+		 */
+		if((0 || issecure || !jar->c[i].secure) &&
+		    iscookiematch(&jar->c[i], dom, path, now)){
 			if(cookiedebug)
 				fprint(2, "\tmatched\n");
 			addcookie(j, &jar->c[i]);
@@ -589,7 +600,7 @@ cookiesearch(Jar *jar, char *dom, char *path, int issecure)
 		werrstr("no cookies found");
 		return nil;
 	}
-	qsort(j->c, j->nc, sizeof(j->c[0]), (int(*)(const void*, const void*))cookiecmp);
+	qsort(j->c, j->nc, sizeof(j->c[0]), (int(*)(void*, void*))cookiecmp);
 	return j;
 }
 
@@ -599,20 +610,28 @@ cookiesearch(Jar *jar, char *dom, char *path, int issecure)
 static char*
 isbadcookie(Cookie *c, char *dom, char *path)
 {
+	int lcdom, ldom;
+
 	if(strncmp(c->path, path, strlen(c->path)) != 0)
 		return "cookie path is not a prefix of the request path";
 
+	/*
+	 * fgb says omitting this test is necessary to get some sites to work,
+	 * but it seems dubious.
+	 */
 	if(c->explicitdom && c->dom[0] != '.')
 		return "cookie domain doesn't start with dot";
 
-	if(memchr(c->dom+1, '.', strlen(c->dom)-1-1) == nil)
+	lcdom = strlen(c->dom);
+	if(memchr(c->dom+1, '.', lcdom-1-1) == nil)
 		return "cookie domain doesn't have embedded dots";
 
 	if(!isdomainmatch(dom, c->dom))
 		return "request host does not match cookie domain";
 
-	if(strcmp(ipattr(dom), "dom")==0
-	&& memchr(dom, '.', strlen(dom)-strlen(c->dom)) != nil)
+	ldom = strlen(dom);
+	if(strcmp(ipattr(dom), "dom")==0 && lcdom > ldom &&
+	    memchr(dom, '.', lcdom - ldom) != nil)
 		return "request host contains dots before cookie domain";
 
 	return 0;

+ 10 - 8
sys/src/cmd/webfs/io.c

@@ -62,16 +62,18 @@ _iotlsdial(va_list *arg)
 		return fd;
 
 	memset(&conn, 0, sizeof conn);
+	/* does no good, so far anyway */
+	// conn.chain = readcertchain("/sys/lib/ssl/vsignss.pem");
+
 	tfd = tlsClient(fd, &conn);
-	if(tfd < 0){
-		print("tls %r\n");
-		close(fd);
-		return -1;
-	}
-	/* BUG: check cert here? */
-	if(conn.cert)
-		free(conn.cert);
 	close(fd);
+	if(tfd < 0)
+		fprint(2, "%s: tlsClient: %r\n", argv0);
+	else {
+		/* BUG: check cert here? */
+		if(conn.cert)
+			free(conn.cert);
+	}
 	return tfd;
 }
 

+ 1 - 1
sys/src/libc/port/malloc.c

@@ -21,7 +21,7 @@ Private sbrkmempriv;
 
 static Pool sbrkmem = {
 	.name=		"sbrkmem",
-	.maxsize=		2UL*1024*1024*1024,
+	.maxsize=	(3840UL-1)*1024*1024,	/* up to ~0xf0000000 */
 	.minarena=	4*1024,
 	.quantum=	32,
 	.alloc=		sbrkalloc,

+ 1 - 0
sys/src/libc/power/tas.s

@@ -7,6 +7,7 @@ tas1:
 	LWAR	(R4), R3
 	CMP	R3, $0
 	BNE	tas0
+	DCBT	(R4)				/* fix 405 errata cpu_210 */
 	STWCCC	R5, (R4)
 	BNE	tas1
 tas0:

+ 1 - 1
sys/src/libmach/8db.c

@@ -1210,7 +1210,7 @@ static Optable optable[256+1] =
 [0xf0]	PRE,0,		"LOCK",
 [0xf2]	OPRE,0,		"REPNE",
 [0xf3]	OPRE,0,		"REP",
-[0xf4]	0,0,		"HALT",
+[0xf4]	0,0,		"HLT",
 [0xf5]	0,0,		"CMC",
 [0xf6]	RMOPB,0,	optabF6,
 [0xf7]	RMOP,0,		optabF7,

+ 2 - 2
sys/src/libthread/xincpower.s

@@ -2,9 +2,9 @@ TEXT	_xinc(SB),$0	/* void _xinc(long *); */
 
 	MOVW	R3, R4
 xincloop:
-	DCBF	(R4)	/* fix for 603x bug */
 	LWAR	(R4), R3
 	ADD		$1, R3
+	DCBT	(R4)				/* fix 405 errata cpu_210 */
 	STWCCC	R3, (R4)
 	BNE		xincloop
 	RETURN
@@ -13,9 +13,9 @@ TEXT	_xdec(SB),$0	/* long _xdec(long *); */
 
 	MOVW	R3, R4
 xdecloop:
-	DCBF	(R4)	/* fix for 603x bug */
 	LWAR	(R4), R3
 	ADD		$-1, R3
+	DCBT	(R4)				/* fix 405 errata cpu_210 */
 	STWCCC	R3, (R4)
 	BNE		xdecloop
 	RETURN