Browse Source

Plan 9 from Bell Labs 2003-09-18

David du Colombier 20 years ago
parent
commit
3e4111cad4
100 changed files with 1763 additions and 527 deletions
  1. 71 71
      dist/replica/plan9.db
  2. 72 0
      dist/replica/plan9.log
  3. 6 2
      rc/bin/a:
  4. 1 1
      sys/doc/fossil.ms
  5. 1 1
      sys/doc/rc.ms
  6. 15 8
      sys/doc/release4.ms
  7. 3 0
      sys/games/lib/fortunes
  8. 2 2
      sys/include/libsec.h
  9. 19 4
      sys/lib/dist/pc/inst/bootsetup
  10. 26 0
      sys/lib/dist/pc/inst/configfs
  11. 19 11
      sys/lib/dist/pc/inst/defs
  12. 7 2
      sys/lib/dist/pc/inst/download
  13. 91 0
      sys/lib/dist/pc/inst/fmtfossil
  14. 173 0
      sys/lib/dist/pc/inst/fmtventi
  15. 7 0
      sys/lib/dist/pc/inst/halt
  16. 16 0
      sys/lib/dist/pc/inst/isfossil
  17. 13 0
      sys/lib/dist/pc/inst/isventi
  18. 13 0
      sys/lib/dist/pc/inst/isventiarenas
  19. 13 0
      sys/lib/dist/pc/inst/isventiisect
  20. 4 0
      sys/lib/dist/pc/inst/main
  21. 148 0
      sys/lib/dist/pc/inst/mountfossil
  22. 8 88
      sys/lib/dist/pc/inst/mountfs
  23. 96 0
      sys/lib/dist/pc/inst/mountkfs
  24. 10 2
      sys/lib/dist/pc/inst/partdisk
  25. 31 4
      sys/lib/dist/pc/inst/prepdisk
  26. 9 8
      sys/lib/dist/pc/mkfile
  27. 20 5
      sys/lib/dist/pc/proto
  28. 1 1
      sys/lib/dist/pc/sub/bunzip2
  29. 1 1
      sys/lib/dist/pc/sub/ramfs
  30. 21 5
      sys/lib/dist/pc/sub/termrc
  31. 2 0
      sys/lib/lp/bin/lpscratch
  32. 2 1
      sys/lib/mimetype
  33. 0 34
      sys/lib/sysconfig/fl/boot
  34. 0 7
      sys/lib/sysconfig/fl/flproto
  35. 0 8
      sys/lib/sysconfig/fl/venti.conf
  36. 3 3
      sys/man/1/cb
  37. 7 1
      sys/man/1/seq
  38. 1 5
      sys/man/2/prime
  39. 3 3
      sys/man/3/usb
  40. 24 1
      sys/man/5/flush
  41. 85 3
      sys/man/8/boot
  42. 1 1
      sys/man/8/fossilcons
  43. 8 0
      sys/man/8/ipserv
  44. 29 12
      sys/man/8/ping
  45. 8 0
      sys/man/8/plan9.ini
  46. 11 1
      sys/man/8/pop3
  47. 9 0
      sys/man/8/prep
  48. 2 4
      sys/man/8/ventiaux
  49. 175 17
      sys/src/9/boot/local.c
  50. 1 1
      sys/src/9/ip/ip.h
  51. 65 80
      sys/src/9/ip/ipifc.c
  52. 2 0
      sys/src/9/mkfile
  53. 14 5
      sys/src/9/pc/devusb.c
  54. 6 0
      sys/src/9/pc/devvga.c
  55. 2 0
      sys/src/9/pc/etherelnk3.c
  56. 2 0
      sys/src/9/pc/usb.h
  57. 1 1
      sys/src/9/pc/usbuhci.c
  58. 2 0
      sys/src/9/port/devsrv.c
  59. 3 1
      sys/src/9/port/master
  60. 10 0
      sys/src/9/port/master.local
  61. 8 2
      sys/src/9/port/mkfile
  62. 7 0
      sys/src/9/port/qio.c
  63. 3 3
      sys/src/9/port/qlock.c
  64. 1 1
      sys/src/boot/pc/conf.c
  65. 3 0
      sys/src/boot/pc/console.c
  66. 4 0
      sys/src/boot/pc/l.s
  67. 5 2
      sys/src/boot/pc/mkfile
  68. 4 8
      sys/src/cmd/auth/keyfs.c
  69. 1 0
      sys/src/cmd/aux/mouse.c
  70. 11 8
      sys/src/cmd/aux/zerotrunc.c
  71. 13 12
      sys/src/cmd/cc/pickle.c
  72. 3 2
      sys/src/cmd/dict/mkindex.c
  73. 70 2
      sys/src/cmd/disk/mbr.c
  74. 12 1
      sys/src/cmd/fossil/9p.c
  75. 7 3
      sys/src/cmd/fossil/9proc.c
  76. 21 0
      sys/src/cmd/fossil/Ccmd.c
  77. 14 4
      sys/src/cmd/fossil/cache.c
  78. 5 5
      sys/src/cmd/fossil/disk.c
  79. 1 3
      sys/src/cmd/ip/dhcpd/ndb.c
  80. 29 9
      sys/src/cmd/ip/ppp/ppp.c
  81. 3 3
      sys/src/cmd/ip/tftpd.c
  82. 1 1
      sys/src/cmd/lex/parser.y
  83. 2 2
      sys/src/cmd/lex/sub1.c
  84. 2 0
      sys/src/cmd/ndb/dn.c
  85. 2 0
      sys/src/cmd/ndb/dns.c
  86. 1 0
      sys/src/cmd/ndb/dns.h
  87. 1 1
      sys/src/cmd/netstat.c
  88. 2 0
      sys/src/cmd/plumb/match.c
  89. 5 2
      sys/src/cmd/sam/mesg.c
  90. 7 7
      sys/src/cmd/seq.c
  91. 2 1
      sys/src/cmd/tapefs/tapfs.c
  92. 3 3
      sys/src/cmd/upas/filterkit/deliver.c
  93. 38 6
      sys/src/cmd/upas/fs/pop3.c
  94. 39 7
      sys/src/cmd/upas/ml/ml.c
  95. 22 7
      sys/src/cmd/upas/pop3/pop3.c
  96. 2 2
      sys/src/cmd/venti/arenas.c
  97. 1 1
      sys/src/cmd/venti/config.c
  98. 1 1
      sys/src/cmd/venti/findscore.c
  99. 7 3
      sys/src/cmd/venti/sortientry.c
  100. 5 10
      sys/src/cmd/venti/utils.c

+ 71 - 71
dist/replica/plan9.db

@@ -3348,7 +3348,7 @@ sys/include/httpd.h - 664 sys sys 1014929064 5726
 sys/include/ip.h - 664 sys sys 1050702405 2908
 sys/include/keyboard.h - 664 sys sys 1014929064 799
 sys/include/libc.h - 664 sys sys 1049426002 18829
-sys/include/libsec.h - 664 sys sys 1048616895 8914
+sys/include/libsec.h - 664 sys sys 1063853592 8965
 sys/include/mach.h - 664 sys sys 1032058231 8101
 sys/include/memdraw.h - 664 sys sys 1039752978 5616
 sys/include/memlayer.h - 664 sys sys 1051031022 1851
@@ -4501,7 +4501,7 @@ sys/man/1/bundle - 664 sys sys 944959672 986
 sys/man/1/cal - 664 sys sys 944959673 849
 sys/man/1/calendar - 664 sys sys 1032058542 1144
 sys/man/1/cat - 664 sys sys 1022048090 1335
-sys/man/1/cb - 664 sys sys 1063025841 890
+sys/man/1/cb - 664 sys sys 1063855627 896
 sys/man/1/chgrp - 664 sys sys 944959673 710
 sys/man/1/chmod - 664 sys sys 944959673 1276
 sys/man/1/cleanname - 664 sys sys 944959674 580
@@ -4591,7 +4591,7 @@ sys/man/1/rwd - 664 sys sys 1042469992 2958
 sys/man/1/sam - 664 sys sys 984709628 18107
 sys/man/1/secstore - 664 sys sys 1041890056 3434
 sys/man/1/sed - 664 sys sys 944959674 6884
-sys/man/1/seq - 664 sys sys 944959674 1050
+sys/man/1/seq - 664 sys sys 1063855680 1131
 sys/man/1/size - 664 sys sys 944959674 393
 sys/man/1/sleep - 664 sys sys 944959673 389
 sys/man/1/sort - 664 sys sys 944959675 4706
@@ -4732,7 +4732,7 @@ sys/man/2/pipe - 664 sys sys 950892864 1587
 sys/man/2/plumb - 664 sys sys 1015091524 4816
 sys/man/2/pool - 664 sys sys 1017423720 8134
 sys/man/2/postnote - 664 sys sys 944959695 790
-sys/man/2/prime - 664 sys sys 1017251165 2018
+sys/man/2/prime - 664 sys sys 1063855709 1962
 sys/man/2/print - 664 sys sys 1046620831 8889
 sys/man/2/privalloc - 664 sys sys 984709633 651
 sys/man/2/proto - 664 sys sys 969499889 2948
@@ -4809,7 +4809,7 @@ sys/man/3/srv - 664 sys sys 958419690 1470
 sys/man/3/ssl - 664 sys sys 1018386776 3413
 sys/man/3/tls - 664 sys sys 1045501496 7018
 sys/man/3/uart - 664 sys sys 1017679309 1398
-sys/man/3/usb - 664 sys sys 1056364534 6670
+sys/man/3/usb - 664 sys sys 1063855746 6727
 sys/man/3/vga - 664 sys sys 1020356225 4827
 sys/man/4 - 20000000775 sys sys 1018581459 0
 sys/man/4/0intro - 664 sys sys 944959699 472
@@ -4863,7 +4863,7 @@ sys/man/5/INDEX.html - 664 sys sys 1019918564 1409
 sys/man/5/attach - 664 sys sys 1017337812 2857
 sys/man/5/clunk - 664 sys sys 1015024830 701
 sys/man/5/error - 664 sys sys 1015024830 505
-sys/man/5/flush - 664 sys sys 1015024830 1688
+sys/man/5/flush - 664 sys sys 1063855755 2309
 sys/man/5/open - 664 sys sys 1015024830 4739
 sys/man/5/read - 664 sys sys 1015024830 2358
 sys/man/5/remove - 664 sys sys 1046704639 1078
@@ -4918,20 +4918,20 @@ sys/man/8/aan - 664 sys sys 1045501064 1670
 sys/man/8/aliasmail - 664 sys sys 1055701148 1353
 sys/man/8/apm - 664 sys sys 1017679308 1811
 sys/man/8/auth - 664 sys sys 1035838620 4062
-sys/man/8/boot - 664 sys sys 1040698789 6482
+sys/man/8/boot - 664 sys sys 1063855776 8354
 sys/man/8/booting - 664 sys sys 1015024984 4136
 sys/man/8/checkarenas - 664 sys sys 1019866709 669
 sys/man/8/cpurc - 664 sys sys 971455510 1275
 sys/man/8/cron - 664 sys sys 944959679 1750
 sys/man/8/dhcpd - 664 sys sys 1032654987 5237
 sys/man/8/drawterm - 664 sys sys 958419689 2458
-sys/man/8/fossilcons - 664 sys sys 1055707854 14700
+sys/man/8/fossilcons - 664 sys sys 1063855784 14700
 sys/man/8/fs - 664 sys sys 1055701170 15029
 sys/man/8/fsconfig - 664 sys sys 1045501600 8142
 sys/man/8/httpd - 664 sys sys 1037690024 4516
 sys/man/8/init - 664 sys sys 944959679 1430
 sys/man/8/ipconfig - 664 sys sys 1060189415 5050
-sys/man/8/ipserv - 664 sys sys 1026847122 4190
+sys/man/8/ipserv - 664 sys sys 1063855796 4337
 sys/man/8/kfscmd - 664 sys sys 1022010519 4492
 sys/man/8/listen - 664 sys sys 1045501609 3740
 sys/man/8/lp - 664 sys sys 954614702 2491
@@ -4946,11 +4946,11 @@ sys/man/8/newuser - 664 sys sys 954305551 2343
 sys/man/8/nfsserver - 664 sys sys 1017251291 3397
 sys/man/8/pcmcia - 664 sys sys 944959679 408
 sys/man/8/pem - 664 sys sys 1060263669 1189
-sys/man/8/ping - 664 sys sys 1028233565 2789
-sys/man/8/plan9.ini - 664 sys sys 1053576234 20536
-sys/man/8/pop3 - 664 sys sys 1058012143 2444
+sys/man/8/ping - 664 sys sys 1063855805 3309
+sys/man/8/plan9.ini - 664 sys sys 1063855903 20744
+sys/man/8/pop3 - 664 sys sys 1063854676 2720
 sys/man/8/ppp - 664 sys sys 1050361032 4424
-sys/man/8/prep - 664 sys sys 1055692961 13573
+sys/man/8/prep - 664 sys sys 1063855909 13738
 sys/man/8/qer - 664 sys sys 960837925 4785
 sys/man/8/reboot - 664 sys sys 969499895 414
 sys/man/8/replica - 664 sys sys 1021579979 6239
@@ -6239,8 +6239,8 @@ sys/src/boot/pc/bootld.c - 664 sys sys 1015007948 1801
 sys/src/boot/pc/bootp.c - 664 sys sys 1015007948 9417
 sys/src/boot/pc/cga.c - 664 sys sys 1015007948 1362
 sys/src/boot/pc/clock.c - 664 sys sys 1015007948 5648
-sys/src/boot/pc/conf.c - 664 sys sys 1032215915 10126
-sys/src/boot/pc/console.c - 664 sys sys 1021579983 3420
+sys/src/boot/pc/conf.c - 664 sys sys 1063855536 10128
+sys/src/boot/pc/console.c - 664 sys sys 1063855537 3459
 sys/src/boot/pc/dat.h - 664 sys sys 1056073257 3432
 sys/src/boot/pc/devfloppy.c - 664 sys sys 1032215913 15505
 sys/src/boot/pc/devfloppy.h - 664 sys sys 1032409559 4081
@@ -6278,13 +6278,13 @@ sys/src/boot/pc/ip.h - 664 sys sys 1015007952 2434
 sys/src/boot/pc/kbd.c - 664 sys sys 1015007952 10188
 sys/src/boot/pc/kfs.h - 664 sys sys 1032215924 861
 sys/src/boot/pc/kfsboot.c - 664 sys sys 1032215914 4788
-sys/src/boot/pc/l.s - 664 sys sys 1056073258 12963
+sys/src/boot/pc/l.s - 664 sys sys 1063855535 13012
 sys/src/boot/pc/lib.h - 664 sys sys 1015007952 3485
 sys/src/boot/pc/load.c - 664 sys sys 1056087197 7987
 sys/src/boot/pc/mbr.s - 664 sys sys 1015007953 6234
 sys/src/boot/pc/mem.h - 664 sys sys 1015007953 3407
 sys/src/boot/pc/memory.c - 664 sys sys 1019533021 10272
-sys/src/boot/pc/mkfile - 664 sys sys 1056073256 2926
+sys/src/boot/pc/mkfile - 664 sys sys 1063855535 2971
 sys/src/boot/pc/noether.c - 664 sys sys 1018553453 300
 sys/src/boot/pc/part.c - 664 sys sys 1032215918 7505
 sys/src/boot/pc/pbs.s - 664 sys sys 1017854325 8279
@@ -6685,7 +6685,7 @@ sys/src/cmd/auth/factotum/util.c - 664 sys sys 1048614988 17031
 sys/src/cmd/auth/factotum/wep.c - 664 sys sys 1048614986 2205
 sys/src/cmd/auth/guard.srv.c - 664 sys sys 1032497638 2334
 sys/src/cmd/auth/iam.c - 664 sys sys 1015008430 841
-sys/src/cmd/auth/keyfs.c - 664 sys sys 1055797577 17594
+sys/src/cmd/auth/keyfs.c - 664 sys sys 1063855447 17524
 sys/src/cmd/auth/lib - 20000000775 sys sys 1015008430 0
 sys/src/cmd/auth/lib/error.c - 664 sys sys 1015008430 301
 sys/src/cmd/auth/lib/fs.c - 664 sys sys 1015008430 228
@@ -6783,7 +6783,7 @@ sys/src/cmd/aux/mnihongo/README - 664 sys sys 944960789 475
 sys/src/cmd/aux/mnihongo/mkfile - 664 sys sys 944960789 95
 sys/src/cmd/aux/mnihongo/mnihongo.c - 664 sys sys 946759402 6406
 sys/src/cmd/aux/mnihongo/tmac.nihongo - 664 sys sys 944960789 22
-sys/src/cmd/aux/mouse.c - 664 sys sys 1014925101 7023
+sys/src/cmd/aux/mouse.c - 664 sys sys 1063855425 7049
 sys/src/cmd/aux/ms2.c - 664 sys sys 1015008685 3129
 sys/src/cmd/aux/mswordstrings.c - 664 sys sys 952201344 5767
 sys/src/cmd/aux/na - 20000000775 sys sys 955036627 0
@@ -6866,7 +6866,7 @@ sys/src/cmd/aux/vga/vision968.c - 664 sys sys 1014925014 3959
 sys/src/cmd/aux/vga/vmware.c - 664 sys sys 1020313485 4907
 sys/src/cmd/aux/vga/w30c516.c - 664 sys sys 1014925014 3158
 sys/src/cmd/aux/write.c - 664 sys sys 944960778 471
-sys/src/cmd/aux/zerotrunc.c - 664 sys sys 1056634403 300
+sys/src/cmd/aux/zerotrunc.c - 664 sys sys 1063855383 318
 sys/src/cmd/awd.c - 664 sys sys 944961364 567
 sys/src/cmd/awk - 20000000775 sys sys 944964677 0
 sys/src/cmd/awk/awk.h - 664 sys sys 944960803 4624
@@ -6958,7 +6958,7 @@ sys/src/cmd/cc/lexbody - 664 sys sys 1014925177 8726
 sys/src/cmd/cc/mac.c - 664 sys sys 944960808 36
 sys/src/cmd/cc/macbody - 664 sys sys 1063639694 11108
 sys/src/cmd/cc/mkfile - 664 sys sys 984718516 564
-sys/src/cmd/cc/pickle.c - 664 sys sys 984718511 4746
+sys/src/cmd/cc/pickle.c - 664 sys sys 1063855374 4829
 sys/src/cmd/cc/sub.c - 664 sys sys 1018556165 30856
 sys/src/cmd/cdfs - 20000000775 sys sys 959922196 0
 sys/src/cmd/cdfs/buf.c - 664 sys sys 964456822 1848
@@ -7056,8 +7056,7 @@ sys/src/cmd/dict/getneeds - 775 sys sys 944960880 205
 sys/src/cmd/dict/jis208.c - 664 sys sys 944960882 60007
 sys/src/cmd/dict/kuten.h - 664 sys sys 944960882 3073
 sys/src/cmd/dict/mkfile - 664 sys sys 1063656964 385
-sys/src/cmd/dict/mkindex - 775 sys sys 944960881 147100
-sys/src/cmd/dict/mkindex.c - 664 sys sys 944960880 1841
+sys/src/cmd/dict/mkindex.c - 664 sys sys 1063855359 1871
 sys/src/cmd/dict/movie.c - 664 sys sys 944960880 5361
 sys/src/cmd/dict/oed.c - 664 sys sys 1014925320 35942
 sys/src/cmd/dict/pcollins.c - 664 sys sys 944960880 4506
@@ -7132,7 +7131,7 @@ sys/src/cmd/disk/kfs/print.c - 664 sys sys 944960882 3573
 sys/src/cmd/disk/kfs/sub.c - 664 sys sys 1022008488 10804
 sys/src/cmd/disk/kfs/uid.c - 664 sys sys 1022008489 6719
 sys/src/cmd/disk/kfscmd.c - 664 sys sys 1015009135 1109
-sys/src/cmd/disk/mbr.c - 664 sys sys 1032638937 3056
+sys/src/cmd/disk/mbr.c - 664 sys sys 1063855285 4325
 sys/src/cmd/disk/mkext.c - 664 sys sys 1015009135 5427
 sys/src/cmd/disk/mkfile - 664 sys sys 1022385851 500
 sys/src/cmd/disk/mkfs.c - 664 sys sys 1032059493 14298
@@ -7259,24 +7258,24 @@ sys/src/cmd/fossil/9excl.c - 664 sys sys 1042005502 1887
 sys/src/cmd/fossil/9fid.c - 664 sys sys 1045600016 5521
 sys/src/cmd/fossil/9fsys.c - 664 sys sys 1061530721 29881
 sys/src/cmd/fossil/9lstn.c - 664 sys sys 1042005503 2865
-sys/src/cmd/fossil/9p.c - 664 sys sys 1061530720 21414
+sys/src/cmd/fossil/9p.c - 664 sys sys 1063855256 21693
 sys/src/cmd/fossil/9ping.c - 664 sys sys 1042005503 1563
-sys/src/cmd/fossil/9proc.c - 664 sys sys 1062009435 15239
+sys/src/cmd/fossil/9proc.c - 664 sys sys 1063855223 15345
 sys/src/cmd/fossil/9srv.c - 664 sys sys 1055703734 3589
 sys/src/cmd/fossil/9user.c - 664 sys sys 1061530722 17239
 sys/src/cmd/fossil/Ccli.c - 664 sys sys 1042005504 1624
-sys/src/cmd/fossil/Ccmd.c - 664 sys sys 1061530723 7244
+sys/src/cmd/fossil/Ccmd.c - 664 sys sys 1063855214 7533
 sys/src/cmd/fossil/Ccons.c - 664 sys sys 1055703737 6620
 sys/src/cmd/fossil/Clog.c - 664 sys sys 1042005505 591
 sys/src/cmd/fossil/archive.c - 664 sys sys 1061530723 9109
 sys/src/cmd/fossil/build - 664 sys sys 1042005505 449
 sys/src/cmd/fossil/buildsh - 775 sys sys 1042005505 561
 sys/src/cmd/fossil/bwatch.c - 664 sys sys 1042005505 6754
-sys/src/cmd/fossil/cache.c - 664 sys sys 1061530724 42819
+sys/src/cmd/fossil/cache.c - 664 sys sys 1063855213 43214
 sys/src/cmd/fossil/conf.rc - 775 sys sys 1055703747 1407
 sys/src/cmd/fossil/dat.h - 664 sys sys 1061530727 7851
 sys/src/cmd/fossil/deadlock - 775 sys sys 1042005506 413
-sys/src/cmd/fossil/disk.c - 664 sys sys 1061530724 5805
+sys/src/cmd/fossil/disk.c - 664 sys sys 1063855195 5815
 sys/src/cmd/fossil/dump.c - 664 sys sys 1042005506 1340
 sys/src/cmd/fossil/epoch.c - 664 sys sys 1045600021 997
 sys/src/cmd/fossil/error.c - 664 sys sys 1042005507 1367
@@ -9132,7 +9131,7 @@ sys/src/cmd/ip/dhcpd/db.c - 664 sys sys 1032655001 7484
 sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1050714684 32770
 sys/src/cmd/ip/dhcpd/dhcpleases.c - 664 sys sys 1032655001 779
 sys/src/cmd/ip/dhcpd/mkfile - 664 sys sys 1050714681 423
-sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1032611012 6058
+sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1063855141 6025
 sys/src/cmd/ip/dhcpd/ping.c - 664 sys sys 956275654 1881
 sys/src/cmd/ip/dhcpd/testlook.c - 664 sys sys 950389140 4640
 sys/src/cmd/ip/dhcpd/testlookup.c - 664 sys sys 950389140 3195
@@ -9200,7 +9199,7 @@ sys/src/cmd/ip/ppp/dotest - 775 sys sys 944961006 152
 sys/src/cmd/ip/ppp/ipaux.c - 664 sys sys 1015090266 2326
 sys/src/cmd/ip/ppp/mkfile - 664 sys sys 1032059844 378
 sys/src/cmd/ip/ppp/mppc.c - 664 sys sys 1015090267 16624
-sys/src/cmd/ip/ppp/ppp.c - 664 sys sys 1055699160 59236
+sys/src/cmd/ip/ppp/ppp.c - 664 sys sys 1063855083 59501
 sys/src/cmd/ip/ppp/ppp.h - 664 sys sys 1050360942 8225
 sys/src/cmd/ip/ppp/testppp.c - 664 sys sys 1045505281 3011
 sys/src/cmd/ip/ppp/thw.c - 664 sys sys 1015090268 5962
@@ -9247,7 +9246,7 @@ sys/src/cmd/ip/snoopy/udp.c - 664 sys sys 1055699195 1718
 sys/src/cmd/ip/telnet.c - 664 sys sys 1015013113 8547
 sys/src/cmd/ip/telnet.h - 664 sys sys 1015090250 5902
 sys/src/cmd/ip/telnetd.c - 664 sys sys 1032060109 11731
-sys/src/cmd/ip/tftpd.c - 664 sys sys 1015013113 7136
+sys/src/cmd/ip/tftpd.c - 664 sys sys 1063855054 7166
 sys/src/cmd/ip/traceroute.c - 664 sys sys 1032060124 9370
 sys/src/cmd/ip/udpecho.c - 664 sys sys 1050714674 855
 sys/src/cmd/join.c - 664 sys sys 944961364 7488
@@ -9334,8 +9333,8 @@ sys/src/cmd/lex/ldefs.h - 664 sys sys 944961017 4053
 sys/src/cmd/lex/lmain.c - 664 sys sys 1032060382 6031
 sys/src/cmd/lex/mkfile - 664 sys sys 1032060382 328
 sys/src/cmd/lex/ncform - 664 sys sys 944961017 4060
-sys/src/cmd/lex/parser.y - 664 sys sys 944961016 14195
-sys/src/cmd/lex/sub1.c - 664 sys sys 1014926025 9778
+sys/src/cmd/lex/parser.y - 664 sys sys 1063855045 14194
+sys/src/cmd/lex/sub1.c - 664 sys sys 1063855044 9784
 sys/src/cmd/lex/sub2.c - 664 sys sys 944961016 17125
 sys/src/cmd/lnfs.c - 664 sys sys 1033565778 13330
 sys/src/cmd/look.c - 664 sys sys 944961619 5994
@@ -9450,12 +9449,12 @@ sys/src/cmd/ndb/cs.c - 664 sys sys 1060173544 32903
 sys/src/cmd/ndb/csgetval.c - 664 sys sys 957402051 1051
 sys/src/cmd/ndb/csquery.c - 664 sys sys 1014926159 1062
 sys/src/cmd/ndb/dblookup.c - 664 sys sys 1060612175 17896
-sys/src/cmd/ndb/dn.c - 664 sys sys 1060651816 26571
+sys/src/cmd/ndb/dn.c - 664 sys sys 1063855019 26727
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1055701929 2126
 sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1055701929 3062
 sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1055701926 15331
-sys/src/cmd/ndb/dns.c - 664 sys sys 1055701923 15221
-sys/src/cmd/ndb/dns.h - 664 sys sys 1060612174 8957
+sys/src/cmd/ndb/dns.c - 664 sys sys 1063855017 15261
+sys/src/cmd/ndb/dns.h - 664 sys sys 1063855018 8983
 sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1060663185 8430
 sys/src/cmd/ndb/dnserver.c - 664 sys sys 1021579994 3687
 sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1014926160 2108
@@ -9468,7 +9467,7 @@ sys/src/cmd/ndb/mkhash.c - 664 sys sys 1014926160 2899
 sys/src/cmd/ndb/mkhosts.c - 664 sys sys 957402054 4294
 sys/src/cmd/ndb/query.c - 664 sys sys 957402054 1133
 sys/src/cmd/ndb/time.c - 664 sys sys 957402055 321
-sys/src/cmd/netstat.c - 664 sys sys 1038237140 3796
+sys/src/cmd/netstat.c - 664 sys sys 1063854991 3794
 sys/src/cmd/news.c - 664 sys sys 1014926614 3778
 sys/src/cmd/nfs.c - 664 sys sys 1050068720 31096
 sys/src/cmd/nm.c - 664 sys sys 1014926696 4908
@@ -9560,7 +9559,7 @@ sys/src/cmd/plot/plot.c - 664 sys sys 944961624 12212
 sys/src/cmd/plot/plot.h - 664 sys sys 944961624 1002
 sys/src/cmd/plumb - 20000000775 sys sys 952201377 0
 sys/src/cmd/plumb/fsys.c - 664 sys sys 1014926837 18491
-sys/src/cmd/plumb/match.c - 664 sys sys 1014926837 8153
+sys/src/cmd/plumb/match.c - 664 sys sys 1063854983 8191
 sys/src/cmd/plumb/mkfile - 664 sys sys 1014926837 295
 sys/src/cmd/plumb/plumb.c - 664 sys sys 944961468 2075
 sys/src/cmd/plumb/plumber.c - 664 sys sys 1014926837 2140
@@ -9946,7 +9945,7 @@ sys/src/cmd/sam/errors.h - 664 sys sys 944961628 695
 sys/src/cmd/sam/file.c - 664 sys sys 1045505553 11030
 sys/src/cmd/sam/io.c - 664 sys sys 1017166329 4414
 sys/src/cmd/sam/list.c - 664 sys sys 944961628 858
-sys/src/cmd/sam/mesg.c - 664 sys sys 984788182 14004
+sys/src/cmd/sam/mesg.c - 664 sys sys 1063854937 14046
 sys/src/cmd/sam/mesg.h - 664 sys sys 1014926938 3773
 sys/src/cmd/sam/mkfile - 664 sys sys 944961628 498
 sys/src/cmd/sam/moveto.c - 664 sys sys 944961628 2698
@@ -10005,7 +10004,7 @@ sys/src/cmd/scuzz/scsireq.h - 664 sys sys 1032060571 5904
 sys/src/cmd/scuzz/scuzz.c - 664 sys sys 1014926325 37608
 sys/src/cmd/scuzz/sense.c - 664 sys sys 969510790 3901
 sys/src/cmd/sed.c - 664 sys sys 1024754756 27001
-sys/src/cmd/seq.c - 664 sys sys 944961350 1482
+sys/src/cmd/seq.c - 664 sys sys 1063854922 1484
 sys/src/cmd/sh.C - 664 sys sys 1055701754 10303
 sys/src/cmd/sha1sum.c - 664 sys sys 1014926229 1017
 sys/src/cmd/size.c - 664 sys sys 944961619 717
@@ -10117,7 +10116,7 @@ sys/src/cmd/tapefs/cpiofs.c - 664 sys sys 1014926384 2493
 sys/src/cmd/tapefs/fs.c - 664 sys sys 1032060630 9777
 sys/src/cmd/tapefs/mkfile - 664 sys sys 1032060649 258
 sys/src/cmd/tapefs/tapefs.h - 664 sys sys 1014926384 1609
-sys/src/cmd/tapefs/tapfs.c - 664 sys sys 947802070 1896
+sys/src/cmd/tapefs/tapfs.c - 664 sys sys 1063854819 1938
 sys/src/cmd/tapefs/tarfs.c - 664 sys sys 1026672564 2597
 sys/src/cmd/tapefs/tpfs.c - 664 sys sys 953243008 1966
 sys/src/cmd/tapefs/util.c - 664 sys sys 1014926385 2653
@@ -10485,7 +10484,7 @@ sys/src/cmd/upas/common/process.c - 664 sys sys 1015009624 2984
 sys/src/cmd/upas/common/sys.h - 664 sys sys 1055699577 2223
 sys/src/cmd/upas/filterkit - 20000000775 sys sys 1018549521 0
 sys/src/cmd/upas/filterkit/dat.h - 664 sys sys 1018549520 107
-sys/src/cmd/upas/filterkit/deliver.c - 664 sys sys 1055702834 1978
+sys/src/cmd/upas/filterkit/deliver.c - 664 sys sys 1063854806 1951
 sys/src/cmd/upas/filterkit/list.c - 664 sys sys 1020313488 4751
 sys/src/cmd/upas/filterkit/mkfile - 664 sys sys 1048645255 264
 sys/src/cmd/upas/filterkit/pipefrom.sample - 775 sys sys 1041184939 380
@@ -10500,7 +10499,7 @@ sys/src/cmd/upas/fs/imap4.c - 664 sys sys 1061779754 18103
 sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1047490342 28282
 sys/src/cmd/upas/fs/mkfile - 664 sys sys 1047490336 321
 sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1047490343 7464
-sys/src/cmd/upas/fs/pop3.c - 664 sys sys 1056155538 11716
+sys/src/cmd/upas/fs/pop3.c - 664 sys sys 1063854740 12408
 sys/src/cmd/upas/fs/readdir.c - 664 sys sys 944961331 203
 sys/src/cmd/upas/fs/strtotm.c - 664 sys sys 1041137528 1904
 sys/src/cmd/upas/fs/tester.c - 664 sys sys 985037420 1418
@@ -10525,7 +10524,7 @@ sys/src/cmd/upas/ml - 20000000775 sys sys 1015096763 0
 sys/src/cmd/upas/ml/common.c - 664 sys sys 1046643067 3371
 sys/src/cmd/upas/ml/dat.h - 664 sys sys 1015096762 517
 sys/src/cmd/upas/ml/mkfile - 664 sys sys 1031707313 549
-sys/src/cmd/upas/ml/ml.c - 664 sys sys 1031707314 2703
+sys/src/cmd/upas/ml/ml.c - 664 sys sys 1063854713 3462
 sys/src/cmd/upas/ml/mlmgr.c - 664 sys sys 1045505888 2332
 sys/src/cmd/upas/ml/mlowner.c - 664 sys sys 1015096763 1142
 sys/src/cmd/upas/ned - 20000000775 sys sys 1015013194 0
@@ -10533,7 +10532,7 @@ sys/src/cmd/upas/ned/mkfile - 664 sys sys 1060041738 233
 sys/src/cmd/upas/ned/nedmail.c - 664 sys sys 1062073146 42984
 sys/src/cmd/upas/pop3 - 20000000775 sys sys 1015009816 0
 sys/src/cmd/upas/pop3/mkfile - 664 sys sys 1031707311 214
-sys/src/cmd/upas/pop3/pop3.c - 664 sys sys 1021579996 14144
+sys/src/cmd/upas/pop3/pop3.c - 664 sys sys 1063854524 14283
 sys/src/cmd/upas/q - 20000000775 sys sys 988250019 0
 sys/src/cmd/upas/q/mkfile - 664 sys sys 1031707299 290
 sys/src/cmd/upas/q/qer.c - 664 sys sys 1014926528 3179
@@ -10655,7 +10654,7 @@ sys/src/cmd/vc/txt.c - 664 sys sys 944961341 22617
 sys/src/cmd/vc/v.out.h - 664 sys sys 944961341 2618
 sys/src/cmd/venti - 20000000775 sys sys 947360466 0
 sys/src/cmd/venti/arena.c - 664 sys sys 1045503653 13221
-sys/src/cmd/venti/arenas.c - 664 sys sys 1036389635 7701
+sys/src/cmd/venti/arenas.c - 664 sys sys 1063854192 7701
 sys/src/cmd/venti/backup.example - 775 sys sys 1045503662 521
 sys/src/cmd/venti/buildbuck.c - 664 sys sys 1019678877 2282
 sys/src/cmd/venti/buildindex.c - 664 sys sys 1055707428 3174
@@ -10664,7 +10663,7 @@ sys/src/cmd/venti/checkindex.c - 664 sys sys 1055707429 4115
 sys/src/cmd/venti/clump.c - 664 sys sys 1019678877 4148
 sys/src/cmd/venti/clumpstats.c - 664 sys sys 1055707430 2239
 sys/src/cmd/venti/conf.rc - 775 sys sys 1055707446 1416
-sys/src/cmd/venti/config.c - 664 sys sys 1055707438 4957
+sys/src/cmd/venti/config.c - 664 sys sys 1063854193 4956
 sys/src/cmd/venti/conv.c - 664 sys sys 1019678878 8202
 sys/src/cmd/venti/copy.c - 664 sys sys 1055707434 3517
 sys/src/cmd/venti/dat.h - 664 sys sys 1055707422 15323
@@ -10672,7 +10671,7 @@ sys/src/cmd/venti/dcache.c - 664 sys sys 1019678878 7374
 sys/src/cmd/venti/dump.c - 664 sys sys 1043176101 1565
 sys/src/cmd/venti/dumparena.c - 664 sys sys 1019678878 6381
 sys/src/cmd/venti/dumpvacroots - 775 sys sys 1044904736 467
-sys/src/cmd/venti/findscore.c - 664 sys sys 1055707431 2597
+sys/src/cmd/venti/findscore.c - 664 sys sys 1063854190 2597
 sys/src/cmd/venti/fmtarenas.c - 664 sys sys 1055707424 2177
 sys/src/cmd/venti/fmtindex.c - 664 sys sys 1055707425 2534
 sys/src/cmd/venti/fmtisect.c - 664 sys sys 1021579998 1290
@@ -10693,7 +10692,7 @@ sys/src/cmd/venti/printarena.c - 664 sys sys 1043805294 2557
 sys/src/cmd/venti/rdarena.c - 664 sys sys 1055707432 1621
 sys/src/cmd/venti/read.c - 664 sys sys 1055707434 1723
 sys/src/cmd/venti/score.c - 664 sys sys 1045503655 588
-sys/src/cmd/venti/sortientry.c - 664 sys sys 1019678880 7356
+sys/src/cmd/venti/sortientry.c - 664 sys sys 1063854195 7447
 sys/src/cmd/venti/stats.c - 664 sys sys 1019678880 2099
 sys/src/cmd/venti/stdinc.h - 664 sys sys 1019678880 139
 sys/src/cmd/venti/sync.c - 664 sys sys 1036470213 674
@@ -10702,10 +10701,10 @@ sys/src/cmd/venti/syncindex.c - 664 sys sys 1055707433 983
 sys/src/cmd/venti/syncindex0.c - 664 sys sys 1036470283 3044
 sys/src/cmd/venti/unittoull.c - 664 sys sys 1019678881 398
 sys/src/cmd/venti/unwhack.c - 664 sys sys 1019678881 3191
-sys/src/cmd/venti/utils.c - 664 sys sys 1055707445 4602
-sys/src/cmd/venti/venti.c - 664 sys sys 1055707423 4509
+sys/src/cmd/venti/utils.c - 664 sys sys 1063854196 4526
+sys/src/cmd/venti/venti.c - 664 sys sys 1063854189 4625
 sys/src/cmd/venti/venti.conf - 664 sys sys 1019867537 397
-sys/src/cmd/venti/ventifs.c - 664 sys sys 1044475553 6160
+sys/src/cmd/venti/ventifs.c - 664 sys sys 1063854129 6157
 sys/src/cmd/venti/verifyarena.c - 664 sys sys 1019678881 2705
 sys/src/cmd/venti/whack.c - 664 sys sys 1019678881 6375
 sys/src/cmd/venti/whack.h - 664 sys sys 1019678881 966
@@ -10824,7 +10823,7 @@ sys/src/fs/choline/dat.h - 664 sys sys 1037805081 528
 sys/src/fs/choline/fns.h - 664 sys sys 1037805081 1968
 sys/src/fs/choline/io.h - 664 sys sys 1037805081 6576
 sys/src/fs/choline/mem.h - 664 sys sys 1015110108 2865
-sys/src/fs/choline/mkfile - 664 sys sys 1045536422 1673
+sys/src/fs/choline/mkfile - 664 sys sys 1063854076 1665
 sys/src/fs/dev - 20000000775 sys sys 1015109978 0
 sys/src/fs/dev/cw.c - 664 sys sys 1047663897 42252
 sys/src/fs/dev/fworm.c - 664 sys sys 1015109971 1737
@@ -10839,7 +10838,7 @@ sys/src/fs/emelie/dat.h - 664 sys sys 1037805101 502
 sys/src/fs/emelie/fns.h - 664 sys sys 1037805101 1968
 sys/src/fs/emelie/io.h - 664 sys sys 1037805101 6576
 sys/src/fs/emelie/mem.h - 664 sys sys 1015110098 2865
-sys/src/fs/emelie/mkfile - 664 sys sys 1045536445 1693
+sys/src/fs/emelie/mkfile - 664 sys sys 1063854083 1685
 sys/src/fs/ip - 20000000775 sys sys 1015109990 0
 sys/src/fs/ip/arp.c - 664 sys sys 1015109981 8696
 sys/src/fs/ip/icmp.c - 664 sys sys 1015109981 991
@@ -10922,7 +10921,7 @@ sys/src/fs/roro/dat.h - 664 sys sys 1037805167 502
 sys/src/fs/roro/fns.h - 664 sys sys 1037805167 1968
 sys/src/fs/roro/io.h - 664 sys sys 1037805168 6576
 sys/src/fs/roro/mem.h - 664 sys sys 1015110092 2865
-sys/src/fs/roro/mkfile - 664 sys sys 1045536462 1647
+sys/src/fs/roro/mkfile - 664 sys sys 1063854090 1639
 sys/src/fs/sony - 20000000775 sys sys 1015110104 0
 sys/src/fs/sony/9sonyfs.c - 664 sys sys 1041361261 2962
 sys/src/fs/sony/dat.h - 664 sys sys 1037805175 490
@@ -10981,10 +10980,11 @@ sys/src/libauth/auth_proxy.c - 664 sys sys 1053106349 3606
 sys/src/libauth/auth_respond.c - 664 sys sys 1044828825 1420
 sys/src/libauth/auth_rpc.c - 664 sys sys 1048645351 2064
 sys/src/libauth/auth_userpasswd.c - 664 sys sys 1014929317 1097
+sys/src/libauth/auth_wep.c - 664 sys sys 1063854011 830
 sys/src/libauth/authlocal.h - 664 sys sys 1014929317 87
 sys/src/libauth/httpauth.c - 664 sys sys 1017166331 1059
 sys/src/libauth/login.c - 664 sys sys 1014929318 264
-sys/src/libauth/mkfile - 664 sys sys 1035389776 441
+sys/src/libauth/mkfile - 664 sys sys 1063854014 455
 sys/src/libauth/newns.c - 664 sys sys 1057795439 6286
 sys/src/libauth/noworld.c - 664 sys sys 1014929318 779
 sys/src/libauthsrv - 20000000775 sys sys 1015091654 0
@@ -11587,7 +11587,7 @@ sys/src/libip/ip.h - 664 sys sys 944961727 1438
 sys/src/libip/ipaux.c - 664 sys sys 985038059 1515
 sys/src/libip/mkfile - 664 sys sys 1035389779 307
 sys/src/libip/myetheraddr.c - 664 sys sys 944961726 622
-sys/src/libip/myipaddr.c - 664 sys sys 1016901402 382
+sys/src/libip/myipaddr.c - 664 sys sys 1063853830 942
 sys/src/libip/parseether.c - 664 sys sys 944961726 318
 sys/src/libip/parseip.c - 664 sys sys 950104689 2130
 sys/src/libip/ptclbsum.c - 664 sys sys 1014927943 1158
@@ -11725,7 +11725,7 @@ sys/src/libmp/port/mpaux.c - 664 sys sys 1055700209 2650
 sys/src/libmp/port/mpcmp.c - 664 sys sys 1055700210 465
 sys/src/libmp/port/mpdigdiv.c - 664 sys sys 950104711 732
 sys/src/libmp/port/mpdiv.c - 664 sys sys 964540764 2423
-sys/src/libmp/port/mpeuclid.c - 664 sys sys 1014930533 1226
+sys/src/libmp/port/mpeuclid.c - 664 sys sys 1063853795 1293
 sys/src/libmp/port/mpexp.c - 664 sys sys 1055700261 1269
 sys/src/libmp/port/mpextendedgcd.c - 664 sys sys 1014930533 1613
 sys/src/libmp/port/mpfmt.c - 664 sys sys 1045502186 2729
@@ -11771,7 +11771,7 @@ sys/src/libndb/ndbfree.c - 664 sys sys 944961749 233
 sys/src/libndb/ndbgetval.c - 664 sys sys 944961749 811
 sys/src/libndb/ndbhash.c - 664 sys sys 1021580003 4848
 sys/src/libndb/ndbhf.h - 664 sys sys 1015013485 746
-sys/src/libndb/ndbipinfo.c - 664 sys sys 1024156985 6422
+sys/src/libndb/ndbipinfo.c - 664 sys sys 1063853776 6483
 sys/src/libndb/ndblookval.c - 664 sys sys 944961750 655
 sys/src/libndb/ndbopen.c - 664 sys sys 1032061385 2703
 sys/src/libndb/ndbparse.c - 664 sys sys 950315731 1134
@@ -11823,13 +11823,13 @@ sys/src/libsec/port/des3ECB.c - 664 sys sys 988225292 917
 sys/src/libsec/port/desCBC.c - 664 sys sys 984710519 1079
 sys/src/libsec/port/desECB.c - 664 sys sys 984710519 861
 sys/src/libsec/port/desmodes.c - 664 sys sys 1015013579 647
-sys/src/libsec/port/dsaalloc.c - 664 sys sys 1027629126 864
-sys/src/libsec/port/dsagen.c - 664 sys sys 1027629125 1237
+sys/src/libsec/port/dsaalloc.c - 664 sys sys 1063853600 900
+sys/src/libsec/port/dsagen.c - 664 sys sys 1063853599 1139
 sys/src/libsec/port/dsaprimes.c - 664 sys sys 984710520 1881
 sys/src/libsec/port/dsaprivtopub.c - 664 sys sys 1027629126 279
-sys/src/libsec/port/dsasign.c - 664 sys sys 1027629126 934
-sys/src/libsec/port/dsaverify.c - 664 sys sys 1027629126 909
-sys/src/libsec/port/egalloc.c - 664 sys sys 984710520 778
+sys/src/libsec/port/dsasign.c - 664 sys sys 1063853600 969
+sys/src/libsec/port/dsaverify.c - 664 sys sys 1063853601 925
+sys/src/libsec/port/egalloc.c - 664 sys sys 1063853598 811
 sys/src/libsec/port/egdecrypt.c - 664 sys sys 984710520 564
 sys/src/libsec/port/egencrypt.c - 664 sys sys 1015013579 806
 sys/src/libsec/port/eggen.c - 664 sys sys 1027629125 413
@@ -11850,7 +11850,7 @@ sys/src/libsec/port/md5.c - 664 sys sys 985124885 3298
 sys/src/libsec/port/md5block.c - 664 sys sys 985124885 5015
 sys/src/libsec/port/md5pickle.c - 664 sys sys 988225292 657
 sys/src/libsec/port/mkfile - 664 sys sys 1044931345 879
-sys/src/libsec/port/nfastrand.c - 664 sys sys 1035832901 327
+sys/src/libsec/port/nfastrand.c - 664 sys sys 1063853595 354
 sys/src/libsec/port/primetest.c - 664 sys sys 984710523 2486
 sys/src/libsec/port/prng.c - 664 sys sys 984710523 187
 sys/src/libsec/port/probably_prime.c - 664 sys sys 984710523 1567
@@ -11861,7 +11861,7 @@ sys/src/libsec/port/rsaalloc.c - 664 sys sys 984710524 657
 sys/src/libsec/port/rsadecrypt.c - 664 sys sys 984710524 749
 sys/src/libsec/port/rsaencrypt.c - 664 sys sys 984710524 192
 sys/src/libsec/port/rsafill.c - 664 sys sys 1045502171 1104
-sys/src/libsec/port/rsagen.c - 664 sys sys 984710524 1451
+sys/src/libsec/port/rsagen.c - 664 sys sys 1063853596 1164
 sys/src/libsec/port/rsaprivtopub.c - 664 sys sys 984710525 237
 sys/src/libsec/port/rsatest.c - 664 sys sys 984710525 1095
 sys/src/libsec/port/sha1.c - 664 sys sys 985124885 2279
@@ -11871,7 +11871,7 @@ sys/src/libsec/port/smallprimes.c - 664 sys sys 984710525 6851
 sys/src/libsec/port/smallprimetest.c - 664 sys sys 984710525 70640
 sys/src/libsec/port/thumb.c - 664 sys sys 1019832052 1891
 sys/src/libsec/port/tlshand.c - 664 sys sys 1048777088 53926
-sys/src/libsec/port/x509.c - 664 sys sys 1047404307 50237
+sys/src/libsec/port/x509.c - 664 sys sys 1063853597 50342
 sys/src/libsec/power - 20000000775 sys sys 984710502 0
 sys/src/libsec/power/mkfile - 664 sys sys 1032061453 139
 sys/src/libstdio - 20000000775 sys sys 984710098 0
@@ -11986,7 +11986,7 @@ sys/src/libthread/xincmips.s - 664 sys sys 1014928160 674
 sys/src/libthread/xincport.h - 664 sys sys 1014928161 211
 sys/src/libthread/xincpower.s - 664 sys sys 1048645448 342
 sys/src/libventi - 20000000775 sys sys 947360466 0
-sys/src/libventi/client.c - 664 sys sys 1045502093 5265
+sys/src/libventi/client.c - 664 sys sys 1063853747 5360
 sys/src/libventi/debug.c - 664 sys sys 1045502093 1258
 sys/src/libventi/errfmt.c - 664 sys sys 1019678691 133
 sys/src/libventi/fatal.c - 664 sys sys 1045502093 227
@@ -11999,10 +11999,10 @@ sys/src/libventi/plan9-io.c - 664 sys sys 1045502095 1754
 sys/src/libventi/plan9-sha1.c - 664 sys sys 1045502095 1058
 sys/src/libventi/plan9-thread.c - 664 sys sys 1045502074 6699
 sys/src/libventi/readfully.c - 664 sys sys 1045502095 237
-sys/src/libventi/rpc.c - 664 sys sys 1045502096 7237
+sys/src/libventi/rpc.c - 664 sys sys 1063853748 7319
 sys/src/libventi/scorefmt.c - 664 sys sys 1045502096 255
 sys/src/libventi/server.c - 664 sys sys 1045502096 4507
-sys/src/libventi/session.h - 664 sys sys 1036470162 913
+sys/src/libventi/session.h - 664 sys sys 1063853749 936
 sys/src/libventi/strdup.c - 664 sys sys 1045502096 203
 sys/src/libventi/venti.txt - 664 sys sys 1045502097 4347
 sys/src/libventi/zero.c - 664 sys sys 1045502097 1509

+ 72 - 0
dist/replica/plan9.log

@@ -13186,3 +13186,75 @@
 1063660630 0 c 386/bin/dict - 775 sys sys 1063660145 185628
 1063660630 1 a lib/dict/README.pgw - 664 sys sys 1063660179 147
 1063660630 2 c sys/src/cmd/dict/dict.c - 664 sys sys 1063660142 12040
+1063854113 0 c sys/include/libsec.h - 664 sys sys 1063853592 8965
+1063854113 1 c sys/src/cmd/venti/ventifs.c - 664 sys sys 1063854129 6157
+1063854113 2 c sys/src/fs/choline/mkfile - 664 sys sys 1063854076 1665
+1063854113 3 c sys/src/fs/emelie/mkfile - 664 sys sys 1063854083 1685
+1063854113 4 c sys/src/fs/roro/mkfile - 664 sys sys 1063854090 1639
+1063854113 5 a sys/src/libauth/auth_wep.c - 664 sys sys 1063854011 830
+1063854113 6 c sys/src/libauth/mkfile - 664 sys sys 1063854014 455
+1063854113 7 c sys/src/libip/myipaddr.c - 664 sys sys 1063853830 942
+1063854113 8 c sys/src/libmp/port/mpeuclid.c - 664 sys sys 1063853795 1293
+1063854113 9 c sys/src/libndb/ndbipinfo.c - 664 sys sys 1063853776 6483
+1063854113 10 c sys/src/libsec/port/dsaalloc.c - 664 sys sys 1063853600 900
+1063854113 11 c sys/src/libsec/port/dsagen.c - 664 sys sys 1063853599 1139
+1063854113 12 c sys/src/libsec/port/dsasign.c - 664 sys sys 1063853600 969
+1063854113 13 c sys/src/libsec/port/dsaverify.c - 664 sys sys 1063853601 925
+1063854113 14 c sys/src/libsec/port/egalloc.c - 664 sys sys 1063853598 811
+1063854113 15 c sys/src/libsec/port/nfastrand.c - 664 sys sys 1063853595 354
+1063854113 16 c sys/src/libsec/port/rsagen.c - 664 sys sys 1063853596 1164
+1063854113 17 c sys/src/libsec/port/x509.c - 664 sys sys 1063853597 50342
+1063854113 18 c sys/src/libventi/client.c - 664 sys sys 1063853747 5360
+1063854113 19 c sys/src/libventi/rpc.c - 664 sys sys 1063853748 7319
+1063854113 20 c sys/src/libventi/session.h - 664 sys sys 1063853749 936
+1063855914 0 c sys/man/1/seq - 664 sys sys 1063855680 1131
+1063855914 1 c sys/man/1/cb - 664 sys sys 1063855627 896
+1063855914 2 c sys/man/2/prime - 664 sys sys 1063855709 1962
+1063855914 3 c sys/man/3/usb - 664 sys sys 1063855746 6727
+1063855914 4 c sys/man/5/flush - 664 sys sys 1063855755 2309
+1063855914 5 c sys/man/8/boot - 664 sys sys 1063855776 8354
+1063855914 6 c sys/man/8/fossilcons - 664 sys sys 1063855784 14700
+1063855914 7 c sys/man/8/ipserv - 664 sys sys 1063855796 4337
+1063855914 8 c sys/man/8/ping - 664 sys sys 1063855805 3309
+1063855914 9 c sys/man/8/plan9.ini - 664 sys sys 1063855903 20744
+1063855914 10 c sys/man/8/pop3 - 664 sys sys 1063854676 2720
+1063855914 11 c sys/man/8/prep - 664 sys sys 1063855909 13738
+1063855914 12 c sys/src/boot/pc/conf.c - 664 sys sys 1063855536 10128
+1063855914 13 c sys/src/boot/pc/console.c - 664 sys sys 1063855537 3459
+1063855914 14 c sys/src/boot/pc/l.s - 664 sys sys 1063855535 13012
+1063855914 15 c sys/src/boot/pc/mkfile - 664 sys sys 1063855535 2971
+1063855914 16 c sys/src/cmd/auth/keyfs.c - 664 sys sys 1063855447 17524
+1063855914 17 c sys/src/cmd/aux/mouse.c - 664 sys sys 1063855425 7049
+1063855914 18 c sys/src/cmd/aux/zerotrunc.c - 664 sys sys 1063855383 318
+1063855914 19 c sys/src/cmd/cc/pickle.c - 664 sys sys 1063855374 4829
+1063855914 20 c sys/src/cmd/dict/mkindex.c - 664 sys sys 1063855359 1871
+1063855914 21 c sys/src/cmd/disk/mbr.c - 664 sys sys 1063855285 4325
+1063855914 22 c sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1063855141 6025
+1063855914 23 c sys/src/cmd/ip/ppp/ppp.c - 664 sys sys 1063855083 59501
+1063855914 24 c sys/src/cmd/ip/tftpd.c - 664 sys sys 1063855054 7166
+1063855914 25 c sys/src/cmd/lex/parser.y - 664 sys sys 1063855045 14194
+1063855914 26 c sys/src/cmd/lex/sub1.c - 664 sys sys 1063855044 9784
+1063855914 27 c sys/src/cmd/ndb/dn.c - 664 sys sys 1063855019 26727
+1063855914 28 c sys/src/cmd/ndb/dns.c - 664 sys sys 1063855017 15261
+1063855914 29 c sys/src/cmd/ndb/dns.h - 664 sys sys 1063855018 8983
+1063855914 30 c sys/src/cmd/netstat.c - 664 sys sys 1063854991 3794
+1063855914 31 c sys/src/cmd/seq.c - 664 sys sys 1063854922 1484
+1063855914 32 c sys/src/cmd/tapefs/tapfs.c - 664 sys sys 1063854819 1938
+1063855914 33 c sys/src/cmd/upas/filterkit/deliver.c - 664 sys sys 1063854806 1951
+1063855914 34 c sys/src/cmd/upas/fs/pop3.c - 664 sys sys 1063854740 12408
+1063855914 35 c sys/src/cmd/upas/ml/ml.c - 664 sys sys 1063854713 3462
+1063855914 36 c sys/src/cmd/upas/pop3/pop3.c - 664 sys sys 1063854524 14283
+1063855914 37 c sys/src/cmd/venti/arenas.c - 664 sys sys 1063854192 7701
+1063855914 38 c sys/src/cmd/venti/config.c - 664 sys sys 1063854193 4956
+1063855914 39 c sys/src/cmd/venti/findscore.c - 664 sys sys 1063854190 2597
+1063855914 40 c sys/src/cmd/venti/sortientry.c - 664 sys sys 1063854195 7447
+1063855914 41 c sys/src/cmd/venti/utils.c - 664 sys sys 1063854196 4526
+1063855914 42 c sys/src/cmd/venti/venti.c - 664 sys sys 1063854189 4625
+1063855914 43 c sys/src/cmd/fossil/9p.c - 664 sys sys 1063855256 21693
+1063855914 44 c sys/src/cmd/fossil/9proc.c - 664 sys sys 1063855223 15345
+1063855914 45 c sys/src/cmd/fossil/Ccmd.c - 664 sys sys 1063855214 7533
+1063855914 46 c sys/src/cmd/fossil/cache.c - 664 sys sys 1063855213 43214
+1063855914 47 c sys/src/cmd/fossil/disk.c - 664 sys sys 1063855195 5815
+1063855914 48 c sys/src/cmd/plumb/match.c - 664 sys sys 1063854983 8191
+1063855914 49 c sys/src/cmd/sam/mesg.c - 664 sys sys 1063854937 14046
+1063855914 50 d sys/src/cmd/dict/mkindex - 775 sys sys 944960881 0

+ 6 - 2
rc/bin/a:

@@ -1,7 +1,11 @@
 #!/bin/rc
+rfork e
+flop=/dev/fd0disk
+if(! test -r $flop)
+	flop='#f'/fd0disk
 if(! test -f /srv/dos)
 	dossrv >/dev/null </dev/null >[2]/dev/null
 unmount /n/a:>[2]/dev/null
-mount -c /srv/dos /n/a: /dev/fd0disk
+mount -c /srv/dos /n/a: $flop
 unmount /n/a >[2]/dev/null
-mount -c /srv/dos /n/a /dev/fd0disk
+mount -c /srv/dos /n/a $flop

+ 1 - 1
sys/doc/fossil.ms

@@ -235,7 +235,7 @@ is made up of the following bit fields.
 0x20	VtEntryLocal	\fRreserved (q.v.)\fP
 .P2
 .LP
-The depth of the described tree is stored in the 5 bits indicated:
+The depth of the described tree is stored in the 3 bits indicated:
 a tree with a topmost node of type
 .CW VtPointerType3
 has depth 4.

+ 1 - 1
sys/doc/rc.ms

@@ -794,7 +794,7 @@ fn g {gre -e $1 *.[hycl]}
 builtin cd
 /bin/who
 .P2
-.TP "~ \fIsubject pattern ...
+.TP "~ \fIsubject pattern ...\f(CW
 The
 .I subject
 is matched against each

+ 15 - 8
sys/doc/release4.ms

@@ -4,11 +4,13 @@ Plan 9 From Bell Labs
 Fourth Release Notes
 .br
 April, 2002
+.br
+updated June, 2003
 .LP
 .sp -.4i
 .nf
 .ce 1000
-Copyright © 2002 Lucent Technologies Inc.
+Copyright © 2002-2003 Lucent Technologies Inc.
 All Rights Reserved
 .sp .2i
 .fi
@@ -40,8 +42,12 @@ and many of the other file servers such as
 and
 .I u9fs (4)
 work just fine with long names.
-It's only the standard disk-resident file servers
-that don't, and as soon we have versions that do, we'll release them.
+It's only the old disk-resident file servers
+that don't.
+The new file server
+.I fossil (4)
+handles supports long names and many other features.
+The older servers are now deprecated.
 .LP
 The following is a partial list of the major changes throughout the system.
 .de Xx
@@ -83,16 +89,17 @@ We are phasing out the IL protocol since it doesn't handle long-distance connect
 well (and long-distance networks don't handle it well, either).
 IL is still used by
 .I fs (4)
-(in time, that too will change)
 but TCP has become the standard protocol for all other services.
 .Xx
 The software for the new network-resident secure block store,
 .I venti (8),
 is included with this distribution.
-We are in the process of reworking
-.I fs (4)
-to use Venti rather than a WORM as its permanent block repository/backup medium,
-but that code is only in the design stage and is not included in this release.
+The new
+file server
+.I fossil (4)
+uses Venti rather than a WORM as its permanent block repository/backup medium.
+It is still being developed, but is mature enough that a handful of users
+throughout the world are using it as their primary file server.
 .Xx
 The need to handle longer file names triggered a rethinking of the way the
 system handles strings in general.

+ 3 - 0
sys/games/lib/fortunes

@@ -3977,3 +3977,6 @@ info: Terminal type `dumb' is not smart enough to run Info.
  k=k; /* To suppress warning */
 debug1: Miscellaneous failure
 That doesn't make sense to me.  But then, you are very small.  Perhaps you're right.
+A company is only as good as its least imaginative manager.
+Thank you for ordering from MEDCO SUPPLY COMPANY, INC., where 100% satisfaction is gu
+(mozilla-bin:3115): Gtk-WARNING **: A floating object was finalized. This means that someone called g_object_unref() on an object that had only a floating reference; the initial floating reference is not owned by anyone and must be removed with gtk_object_sink() after a normal reference is obtained with g_object_ref(). - exit message from Mozilla

+ 2 - 2
sys/include/libsec.h

@@ -261,7 +261,7 @@ struct EGsig
 };
 
 EGpriv*		eggen(int nlen, int rounds);
-mpint*		egencrypt(EGpub *k, mpint *in, mpint *out);
+mpint*		egencrypt(EGpub *k, mpint *in, mpint *out);	// deprecated
 mpint*		egdecrypt(EGpriv *k, mpint *in, mpint *out);
 EGsig*		egsign(EGpriv *k, mpint *m);
 int		egverify(EGpub *k, EGsig *sig, mpint *m);
@@ -302,7 +302,7 @@ struct DSAsig
 	mpint	*r, *s;
 };
 
-DSApriv*	dsagen(DSApub *opub);
+DSApriv*	dsagen(DSApub *opub);	// opub not checked for consistency!
 DSAsig*		dsasign(DSApriv *k, mpint *m);
 int		dsaverify(DSApub *k, DSAsig *sig, mpint *m);
 DSApub*		dsapuballoc(void);

+ 19 - 4
sys/lib/dist/pc/inst/bootsetup

@@ -13,6 +13,7 @@ case go
 	fat=$fat(1)
 	disk=`{echo $fat | sed 's:/dev/::;s:/9fat::'}
 	bootfs=`{echo $fs | sed 's:/dev/(sd..)/(.*):\1!\2:'}
+	bootfat=`{echo $fs | sed 's:/dev/(sd..)/(.*):\1!9fat:'}
 	if(! test -f /dev/$disk/9fat) {
 		echo 'You have no 9fat partition.  Can''t setup booting.'
 		exit
@@ -20,9 +21,16 @@ case go
 
 	if(! test -f /tmp/plan9.ini) {
 		{
-			echo bootfile'='$bootfs!/386/9pcdisk
 			sfs=`{echo $fs | sed 's;/dev;#S;'}
-			echo 'bootdisk=local!'^$sfs
+			if(~ $fstype fossil fossil+venti){
+				echo bootfile'='$bootfat!9pcf
+				echo 'bootargs=local!'^$sfs
+				echo 'bootdisk=local!'^$sfs
+			}
+			if not {
+				echo bootfile'='$bootfs!/386/9pcdisk
+				echo 'bootdisk=local!'^$sfs
+			}
 			grep -v '(^\[)|menuitem|adisk|bootfile|bootdisk|bootargs|nobootprompt|mouseport|vgasize|monitor|cdboot' /tmp/plan9.orig
 			echo 'mouseport='^$mouseport
 			echo 'monitor='^$monitor
@@ -45,14 +53,20 @@ case go
 		disk/format -r 2 -d -b /386/pbs \
 			/dev/$disk/9fat /n/kfs/386/9load
 		# silently install pbslba if the partition is way into the disk.
-		# it''s our only hope.
+		# it''s our only hope.  only need this for >8.5GB into the disk.
+		# but...
+		# there are so few non-LBA bioses out
+		# there anymore that we'll do this even if we're only 2GB into
+		# the disk.  it's just not worth the headaches of dealing with
+		# crappy bioses that don't address the whole 8.5GB properly
+
 		9fatoffset=`{grep '^part 9fat ' /dev/$disk/ctl | awk '{print $4}'}
 		if(! ~ $#9fatoffset 1) {
 			echo 'could not find plan 9 partition.'
 			echo 'cannot happen'
 			exit bad
 		}
-		if(test $9fatoffset -gt 16434176)	# 1024*63*255 (8.5GB) - 8MB slop
+		if(test $9fatoffset -gt 2097152)	# 2GB
 			disk/format -b /386/pbslba /dev/$disk/9fat
 
 		mount -c /srv/dos /n/9fat /dev/$disk/9fat
@@ -60,6 +74,7 @@ case go
 
 	if(! test -f /n/9fat/4e){
 		logprog cp /n/kfs/386/9load /n/9fat/9load
+		logprog cp /n/kfs/386/9pcf /n/9fat/9pcf
 		if(test -f /n/9fat/plan9.ini && ! test -f /n/9fat/plan9-3e.ini)
 			logprog mv /n/9fat/plan9.ini /n/9fat/plan9-3e.ini
 		if(test -f /n/9fat/9pcdisk && ! test -f /n/9fat/9pc3e)

+ 26 - 0
sys/lib/dist/pc/inst/configfs

@@ -0,0 +1,26 @@
+#!/bin/rc
+
+# desc: choose the type of file system to install
+
+switch($1){
+case checkdone
+	if(! ~ $fstype kfs fossil){
+		configfs=ready
+		export configfs
+	}
+
+case go
+	echo 'You can install the following types of file systems:'
+	echo
+	echo '	fossil			an archival (dump) file server'
+	echo '	kfs				the old Plan 9 on-disk file server'
+	echo
+	echo 'If you choose to install fossil, you can add Venti later,'
+	echo 'assuming you leave enough disk space for it.'
+	echo 
+	prompt -d fossil 'File system' fossil kfs
+	fstype=$rd
+	export fstype
+}
+
+

+ 19 - 11
sys/lib/dist/pc/inst/defs

@@ -77,17 +77,25 @@ fn prompt {
 		ifs='' {rd=`{read}}
 		if(~ $#rd 0)
 			exit notdone
-		rd=`{echo $rd}
-		if(~ $#rd 0 || ~ $rd '')
-			rd=$def
-
-		switch($#opts){
-		case 0
-			if(! ~ $rd '')
-				okay=yes
-		case *
-			if(~ $rd $opts)
-				okay=yes
+		if(~ $rd !*){
+			ifs='' {rd=`{echo $rd | sed 's/!//'}}
+			echo $rd
+			rc -c $rd
+			echo !$status
+		}
+		if not{
+			rd=`{echo $rd}
+			if(~ $#rd 0 || ~ $rd '')
+				rd=$def
+	
+			switch($#opts){
+			case 0
+				if(! ~ $rd '')
+					okay=yes
+			case *
+				if(~ $rd $opts)
+					okay=yes
+			}
 		}
 	}
 	echo -n $rd >/env/rd	# just in case

+ 7 - 2
sys/lib/dist/pc/inst/download

@@ -5,7 +5,9 @@
 
 switch($1) {
 case checkready
-	devs=(`{cat /net/ipifc/*/status >[2]/dev/null | sed 's/ .*//'})
+	devs=(`{cat /net/ipifc/*/status >[2]/dev/null |
+		grep -v '127\.0\.0\.1' |
+		sed 's/ .*//'})
 	if(~ $#devs 0) {
 		download=notdone
 		export download
@@ -26,12 +28,15 @@ case go
 		logprog mount -a /srv/dns /net
 	}
 
-	kname=`{kfsname $fs}
 	# BUG make restartable
 	echo 'Downloading distribution package...'
 	if(! hget -vo /n/kfs/dist/_plan9.iso.bz2 $installurl/plan9.iso.bz2 |[2] bargraph -w 145,129,445,168 'downloading '^plan9.iso.bz2)
 		exit
 	mv /n/kfs/dist/_plan9.iso.bz2 /n/kfs/dist/plan9.iso.bz2
+	if(~ $fstype fossil){
+		echo fsys main sync >>/srv/fscons
+	}
+	kname=`{kfsname $fs}
 	disk/kfscmd -n$kname sync
 
 	echo 'The distribution is downloaded.'

+ 91 - 0
sys/lib/dist/pc/inst/fmtfossil

@@ -0,0 +1,91 @@
+#!/bin/rc
+
+# desc: initialize disks for a fossil server
+# prereq: configfs
+
+switch($1){
+case checkready checkdone
+	if(! ~ $fstype fossil+venti fossil){
+		fmtfossil=notdone
+		export fmtfossil
+		exit
+	}
+	ff=`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null}
+	if(~ $#ff 0){
+		fmtfossil=notdone
+		export fmtfossil
+		exit
+	}
+	gg=()
+	for(f in $ff)
+		if(isfossil $f)
+			gg=($gg $f)
+	if(~ $#gg 0){
+		fmtfossil=ready
+		export fmtfossil
+		exit
+	}
+	fmtfossil=done
+	export fmtfossil
+	exit
+
+case go
+	ff=`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null}
+	if(~ $#ff 0){
+		echo 'You need to create a partition or partitions to hold the Fossil write cache.'
+		echo 'The partition name must begin with "fossil".'
+		echo
+		fmtfossil=notdone
+		export fmtfossil
+		exit
+	}
+	default=()
+	if(~ $#ff 1){
+		default=(-d $ff)
+	}
+	echo You have the following fossil partitions.
+	echo
+	prompt $default 'Fossil partition to format' $ff
+	f=$rd
+
+	do=yes
+	if(isfossil $f){
+		echo $f appears to already be formatted as Fossil file system.
+		echo Do you really want to reformat it?
+		echo
+		prompt -d no 'Reformat '$f yes no
+		do=$rd
+	}
+	if(~ $do yes){
+		fossil/flfmt -y $f
+		n=`{cat /dev/swap | sed 's/^[0-9]+\/([0-9]+) .*/\1/'}
+		if(test $n -gt 32768)
+			m=3000	# if have at least 128 user MB, use 24MB for fossil
+		if not if(test $n -gt 16384)
+			m=1500	# 64 user MB => 12MB for fossil
+		if not if(test $n -gt 8192)
+			m=750	# 32 user MB => 6MB for fossil
+		if not
+			m=256	# 2MB for fossil (this will be slow)
+
+		# if we're using a venti in the back, take hourly snapshots
+		# that retire after three days, in addition to the daily dumps at 5am
+		if(~ $fstype fossil+venti){
+			v=''
+			snap='-s 60 -a 0500 -t 2880'
+		}
+		# otherwise, take the daily dumps but nothing else --
+		# we can't retire snapshots unless dumps are being archived
+		if not{
+			v='-V'
+			snap='-a 0500'
+		}
+		echo \
+'fsys main config '^$f^'
+fsys main open '^$v^' -c '^$m^'
+# fsys main snaptime '^$snap^'
+'		| fossil/conf -w $f
+	}
+	
+	echo Done.
+}

+ 173 - 0
sys/lib/dist/pc/inst/fmtventi

@@ -0,0 +1,173 @@
+#!/bin/rc
+
+# desc: initialize disks for a venti server
+# prereq: choosefs
+
+switch($1){
+case checkready checkdone
+	if(! ~ $fstype fossil+venti){
+		fmtventi=notdone
+		export fmtventi
+		exit
+	}
+	ff=`{ls /dev/sd*/v.arenas* /dev/fs/v.arenas* >[2]/dev/null}
+	gg=()
+	for(f in $ff)
+		if(isventi $f)
+			gg=($gg $f)
+	if(~ $#gg 0){
+		fmtventi=notdone
+		export fmtventi
+		exit
+	}
+	fmtventi=done
+	export fmtventi
+	exit
+
+case go
+	ff=`{ls /dev/sd*/v.arenas* /dev/fs/v.arenas* >[2]/dev/null}
+	if(~ $#ff 0){
+		echo 'You need to create a partition or partitions to hold the Venti arenas.'
+		echo 'The arena partition names must begin with "v.arenas".'
+		echo
+		fmtventi=notdone
+		export fmtventi
+		exit
+	}
+	default=(-d $"ff)
+	if(! ~ $#ventiarena 0){
+		default=(-d $"ventiarena)
+	}
+	echo You have the following Venti index partitions.
+	ls -l $ff
+	echo
+
+	prompt $default 'Venti arena partitions to use'
+	aa=`{echo $rd}
+	bad=no
+	for(a in $aa){
+		if(! ~ $a $ff){
+			echo 'Bad venti arena partition' $a
+			fmtventi=notdone
+			export fmtventi
+			exit
+		}
+	}
+	ventiarena=$aa
+	export ventiarena
+
+	gg=`{ls /dev/sd*/v.index* /dev/fs/v.index* >[2]/dev/null}
+	if(~ $#gg 0){
+		echo 'You need to create a partition or partitions to hold the Venti indices.'
+		echo 'The index partition names must begin with "v.index".'
+		echo
+		fmtventi=notdone
+		export fmtventi
+		exit
+	}
+	default=(-d $"gg)
+	if(! ~ $#ventiindex 0){
+		default=(-d $"ventiindex)
+	}
+
+	echo You have the following Venti index partitions.
+	ls -l $gg
+	echo
+
+	prompt $default 'Venti arena partitions to use'
+	aa=`{echo $rd}
+	bad=no
+	for(a in $aa){
+		if(! ~ $a $gg){
+			echo 'Bad venti index partition' $a
+			fmtventi=notdone
+			export fmtventi
+			exit
+		}
+	}
+	ventiindex=$aa
+	export ventiindex
+
+	n=-1
+	fmta=()
+	for(a in $ventiarena){
+		do=yes
+		n=`{hoc -e 1+$n}
+		if(isventiarenas $a){
+			echo File $a is already formatted as a Venti arenas partition.
+			prompt -d no 'Reformat '$a yes no
+			do=$rd
+		}
+		if(~ $do yes)
+			fmta=($fmta arenas$n:$a)
+	}
+
+	n=-1
+	fmti=()
+	for(a in $ventiindex){
+		do=yes
+		n=`{hoc -e 1+$n}
+		if(isventiisect $a){
+			echo File $a is already formatted as a Venti index section.
+			prompt -d no 'Reformat '$a yes no
+			do=$rd
+		}
+		if(~ $do yes)
+			fmti=($fmti isect$n:$a)
+	}
+
+	echo Formatting Venti arenas and indices (this takes a while).
+	# do each disk in parallel
+	echo good >/tmp/fmt
+	dd=()
+	for(a in $fmta $fmti){
+		d=`{echo $a | sed 's!.*:(/.*/).*!\1!'}
+		if(! ~ $d $dd)
+			$dd=($dd $d)
+	}
+	for(d in $dd){
+		{
+			for(a in $fmta){
+				i=`{echo $a | sed 's!(.*):(/.*/)(.*)!\1 \2 \2\3!'}
+				if(~ $i(2) $d){
+					echo $i(3) ...
+					venti/fmtarenas $i(1) $i(3) || echo bad >/tmp/fmt
+					echo done with $i(3)
+				}
+			}
+			for(a in $fmti){
+				i=`{echo $a | sed 's!(.*):(/.*/)(.*)!\1 \2 \2\3!'}
+				if(~ $i(2) $d){
+					echo $i(3) ...
+					venti/isect $i(1) $i(3) || echo bad >/tmp/fmt
+					echo done with $i(3)
+				}
+			}
+		} &
+	}
+	wait
+	if(~ bad `{cat /tmp/fmt}){
+		echo There were errors formatting the indices and arenas.
+		fmtventi=ready
+		export fmtventi
+		exit errors
+	}
+
+	echo Done formatting Venti arenas and indices.
+
+	v=$ventiarena(1)
+	echo Storing Venti config on $v...
+	{
+		echo index main
+		for(i in $ventiindex)
+			echo isect $i
+		for(a in $ventiarena)
+			echo arenas $i
+	} | venti/conf -w $v
+
+	echo Initializing index...
+	venti/fmtindex -c $v
+
+	echo Done with Venti!
+}
+

+ 7 - 0
sys/lib/dist/pc/inst/halt

@@ -10,6 +10,13 @@ for (i in /srv/kfs*) {
 			disk/kfscmd -n$n halt
 	}
 }
+if(ps | grep -s ' venti$')
+	venti/sync -h tcp!127.0.0.1!17034
+if(ps | grep -s ' fossil$'){
+	echo fsys all halt >>/srv/fscons
+	slay fossil|rc
+}
+
 echo done
 echo
 echo Remember to take the install disk out of the drive.

+ 16 - 0
sys/lib/dist/pc/inst/isfossil

@@ -0,0 +1,16 @@
+#!/bin/rc
+
+if(! ~ $#* 1){
+	echo 'usage: isfossil /dev/sdC0/part' >[1=2]
+	exit usage
+}
+
+arg=$1
+if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 127 |
+	dd -quiet 1 -bs 14 -count 1} <{echo 'fossil config'})
+	exit noconfig
+if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 128 |
+	dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000  37 76 ae 89'})
+	exit notwritebuffer
+exit 0
+

+ 13 - 0
sys/lib/dist/pc/inst/isventi

@@ -0,0 +1,13 @@
+#!/bin/rc
+
+if(! ~ $#* 1){
+	echo 'usage: isfossil /dev/sdC0/part' >[1=2]
+	exit usage
+}
+
+arg=$1
+if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 127 |
+	dd -quiet 1 -bs 13 -count 1} <{echo 'venti config'})
+	exit noconfig
+exit 0
+

+ 13 - 0
sys/lib/dist/pc/inst/isventiarenas

@@ -0,0 +1,13 @@
+#!/bin/rc
+
+if(! ~ $#* 1){
+	echo 'usage: isventiarenas /dev/sdC0/part' >[1=2]
+	exit usage
+}
+
+arg=$1
+if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 128 |
+	dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000  a9 e4 a5 e7'})
+	exit notarenas
+exit 0
+

+ 13 - 0
sys/lib/dist/pc/inst/isventiisect

@@ -0,0 +1,13 @@
+#!/bin/rc
+
+if(! ~ $#* 1){
+	echo 'usage: isventiisect /dev/sdC0/part' >[1=2]
+	exit usage
+}
+
+arg=$1
+if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 128 |
+	dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000  d1 5c 5e c7'})
+	exit notisect
+exit 0
+

+ 4 - 0
sys/lib/dist/pc/inst/main

@@ -12,7 +12,10 @@ echo -n 'Preparing menu...'
 
 # must be topologically sorted (by prereq)
 tasks=(\
+	configfs\
 	partdisk prepdisk\
+	fmtventi\
+	fmtfossil\
 	mountfs\
 	configdist\
 	confignet\
@@ -24,6 +27,7 @@ tasks=(\
 )
 #	startether startppp stopether stopppp download\
 
+# these don't show up in the menu but still matter
 pseudotasks=(configip havefiles etherup etherdown pppup pppdown)
 
 for(i in $tasks $pseudotasks)

+ 148 - 0
sys/lib/dist/pc/inst/mountfossil

@@ -0,0 +1,148 @@
+#!/bin/rc
+
+switch($1){
+case checkready checkdone
+	if(~ $fstype fossil+venti && ! ~ $fmtventi done){
+		mountfs=notdone
+		export mountfs
+		exit
+	}
+	if(! ~ $fmtfossil done){
+		mountfs=notdone
+		export mountfs
+		exit
+	}
+	if(! test -f /dev/sd*/fossil* && ! test -f /dev/fs/fossil*){
+		mountfs=notdone
+		export mountfs
+		exit
+	}
+	if(~ $fstype fossil+venti)
+	if(! ~ $#venti 1 || ! test -f $venti){
+		mountfs=ready
+		export mountfs
+		exit
+	}
+	if(! ~ $#fossil 1 || ! test -f $fossil){
+		mountfs=ready
+		export mountfs
+		exit
+	}
+	if(~ $fstype fossil+venti && ! ps | grep -s ' venti$'){
+		if(! logprog venti/venti -a tcp!127.1!17034 -c $venti >>[2]/srv/log){
+			echo 'venti: '^$status
+			mountfs=ready
+			export mountfs
+			exit oops
+		}
+		if(ps |grep -s ' fossil$'){
+			# reconnect to venti
+			echo fsys main venti 127.0.0.1 >>/srv/fscons
+		}
+	}
+	if(! ps | grep -s ' fossil$'){
+		{echo 'srv -p fscons'; echo 'srv -AP fossil'; fossil/conf $fossil | sed 's/^fsys main open .*/& -AWP/'}>/env/fossilconf
+		if(! logprog fossil/fossil -c .' /env/fossilconf'>>[2]/srv/log){
+			echo 'fossil: '^$status
+			mountfs=ready
+			export mountfs
+			exit oops
+		}
+		if(! test -f /srv/fossil){
+			echo 'fossil did not create /srv/fossil'
+			mountfs=ready
+			exit oops
+		}
+		cat /srv/fscons >>/srv/log &
+		if(! logprog mount -c /srv/fossil /n/fossil){
+			echo 'mount: '^$status
+			mountfs=ready
+			export mountfs
+			exit oops
+		}
+		fs=$fossil
+		export fs
+	}
+	if(! test -s /n/fossil/adm/users){
+		echo fsys main create /active/adm adm sys d775 >>/srv/fscons
+		echo fsys main create /active/adm/users adm sys 664 >>/srv/fscons
+		echo uname upas :upas >>/srv/fscons
+		echo users -w >>/srv/fscons
+		sleep 2
+	}
+	if(! test -s /n/fossil/adm/users){
+		echo 'could not create /adm/users'
+		mountfs=ready
+		export mountfs
+		exit oops
+	}
+	for(i in dist dist/replica dist/replica/client){
+		if(! test -d /n/fossil/$i)
+			echo fsys main create /active/$i sys sys d775 >>/srv/fscons
+		sleep 2
+	}
+	if(! test -d /n/fossil/dist/replica/client){
+		echo 'could not create /dist/replica/client'
+		mountfs=ready
+		export mountfs
+		exit oops
+	}
+	if(! test -e /n/fossil/dist/replica/client/plan9.db){
+		echo fsys main create /active/dist/replica/client/plan9.db sys sys 664 >>/srv/fscons
+		echo fsys main create /active/dist/replica/client/plan9.log sys sys a664 >>/srv/fscons
+	}
+	if(test -d /n/fossil/dist/replica/client && test -f /n/fossil/adm/users){
+		# the rest of the install assumes /n/kfs
+		bind -c /n/fossil /n/kfs
+		mountfs=done
+		export mountfs
+		exit
+	}
+	mountfs=ready
+	export mountfs
+	exit
+
+case go
+	if(~ $fstype fossil+venti){
+		echo 'The following formatted Venti arenas were found.'
+		echo
+		echo 'Please choose one to use as the Venti server.'
+		echo
+		files=(`{ls /dev/sd*/v.arenas* /dev/fs/v.arenas* >[2]/dev/null})
+		ls -l $files
+		echo
+		if(~ $#venti 1 && ~ $venti $files)
+			default=(-d $venti)
+		if not if(~ $#files 1)
+			default=(-d $files)
+		if not
+			default=()
+		prompt $default 'Venti arena w/ config file' $files
+		if(! ~ $#venti 1 || ! ~ $venti $rd){
+			slay venti|rc
+			venti=$rd
+			export venti
+		}
+	}
+
+	echo 'The following partitions named fossil* were found.'
+	echo
+	echo 'Please choose one to use as the installation file system'
+	echo 'for your Plan 9 installation.'
+	echo
+	files=(`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null})
+	ls -l $files
+	echo
+	if(~ $#fossil 1 && ~ $fossil $files)
+		default=(-d $fossil)
+	if not if(~ $#files 1)
+		default=(-d $files)
+	if not
+		default=()
+	prompt $default 'Fossil partition' $files
+	slay fossil|rc
+	fossil=$rd
+	export fossil
+}
+
+

+ 8 - 88
sys/lib/dist/pc/inst/mountfs

@@ -1,95 +1,15 @@
 #!/bin/rc
 
 # desc: choose and mount file system partition
+# prereq: configfs
 
-switch($1){
-case go
-	echo 'The following partitions named fs* were found.'
-	echo
-	echo 'Please choose one to use as the installation media'
-	echo 'for your Plan 9 installation.'
-	echo
-	files=(/dev/sd*/fs*)
-	ls -l $files
-	echo
-	if(~ $#files 1)
-		default=(-d $files)
-	if not
-		default=()
-	prompt $default 'Partition to use for Plan 9 installation' $files
-	fs=$rd
-	export fs
-
-	kname=`{kfsname $fs}
-	doinit=(-rb8192)
-	if(iskfs $fs){
-		echo 'A Plan 9 file system already exists on '^$fs^'.'
-		echo 'Do you want to wipe it clean?'
-		echo
-		prompt -d keep 'Wipe the Plan 9 file system clean' keep wipe
-		switch($rd){
-		case keep
-			doinit=()
-		}
-	}
-
-	log Starting kfs file server for $fs
-	unmount /n/kfs >[2]/dev/null
-	disk/kfscmd -n $kname halt >[2]/dev/null
-	rm -f /srv/kfs.$kname /srv/kfs.$kname.cmd
-	logprog disk/kfs -n $kname $doinit -f $fs
-	disk/kfscmd -n $kname allow >>[2]/srv/log
-	
-	log Mounting kfs file server for $fs
-	if(! logprog mount -c /srv/kfs.$kname /n/kfs){
-		echo 'mounting kfs: '^$status
-		exit oops
-	}
-
-	if(test -d /n/kfs/wrap){
-		moveoldfs go
-		if(test -d /n/kfs/wrap)
-			exit cannotsmashold
-	}
-	if(! test -f /n/kfs/dist/replica/client/plan9.log){
-		disk/kfscmd -n $kname 'create /dist sys sys 775 d'
-		disk/kfscmd -n $kname 'create /dist/replica sys sys 775 d'
-		disk/kfscmd -n $kname 'create /dist/replica/ndist sys sys 775'
-		disk/kfscmd -n $kname 'create /dist/replica/client sys sys 775 d'
-		disk/kfscmd -n $kname 'create /dist/replica/client/plan9.db sys sys 664'
-		disk/kfscmd -n $kname 'create /dist/replica/client/plan9.log sys sys 664 a'
-	}
-
-case checkready checkdone
-	if(! test -f /dev/sd*/fs*){
-		mountfs=notdone
-		export mountfs
-		exit
-	}
-	if(! ~ $#fs 1 || ! test -f $fs){
-		mountfs=ready
-		export mountfs
-		exit
-	}
-	kname=`{kfsname $fs}
-	if(! test -f /srv/kfs.$kname){
-		disk/kfscmd -n $kname halt >[2]/dev/null
-		rm -f /srv/kfs.$kname /srv/kfs.$kname.cmd
-		logprog disk/kfs -n $kname -f $fs
-		disk/kfscmd -n $kname allow >>[2]/srv/log
-	}
-	if(test -f /srv/kfs.$kname && ! test -f /n/kfs/dist/replica/client/plan9.log){
-		log Mounting kfs file server for $fs
-		if(! logprog mount -c /srv/kfs.$kname /n/kfs)
-			echo 'mounting kfs: '^$status
-		disk/kfscmd -n $kname allow >>[2]/srv/log
-	}
-	if(test -f /srv/kfs.$kname && test -f /n/kfs/dist/replica/client/plan9.log){
-		mountfs=done
-		export mountfs
-		exit
-	}
-	mountfs=ready
+switch($fstype){
+case kfs
+	exec mountkfs $*
+case fossil fossil+venti
+	exec mountfossil $*
+case *
+	mountfs=notdone
 	export mountfs
 	exit
 }

+ 96 - 0
sys/lib/dist/pc/inst/mountkfs

@@ -0,0 +1,96 @@
+#!/bin/rc
+
+# desc: choose and mount file system partition
+
+switch($1){
+case go
+	echo 'The following partitions named fs* were found.'
+	echo
+	echo 'Please choose one to use as the installation file system'
+	echo 'for your Plan 9 installation.'
+	echo
+	files=(`{ls /dev/sd*/fs* /dev/fs/fs* >[2]/dev/null})
+	ls -l $files
+	echo
+	if(~ $#files 1)
+		default=(-d $files)
+	if not
+		default=()
+	prompt $default 'Kfs partition to use for Plan 9 installation' $files
+	fs=$rd
+	export fs
+
+	kname=`{kfsname $fs}
+	doinit=(-rb8192)
+	if(iskfs $fs){
+		echo 'A Plan 9 kfs file system already exists on '^$fs^'.'
+		echo 'Do you want to wipe it clean?'
+		echo
+		prompt -d keep 'Wipe the Plan 9 file system clean' keep wipe
+		switch($rd){
+		case keep
+			doinit=()
+		}
+	}
+
+	log Starting kfs file server for $fs
+	unmount /n/kfs >[2]/dev/null
+	disk/kfscmd -n $kname halt >[2]/dev/null
+	rm -f /srv/kfs.$kname /srv/kfs.$kname.cmd
+	logprog disk/kfs -n $kname $doinit -f $fs
+	disk/kfscmd -n $kname allow >>[2]/srv/log
+	
+	log Mounting kfs file server for $fs
+	if(! logprog mount -c /srv/kfs.$kname /n/kfs){
+		echo 'mounting kfs: '^$status
+		exit oops
+	}
+
+	if(test -d /n/kfs/wrap){
+		moveoldfs go
+		if(test -d /n/kfs/wrap)
+			exit cannotsmashold
+	}
+	if(! test -f /n/kfs/dist/replica/client/plan9.log){
+		disk/kfscmd -n $kname 'create /dist sys sys 775 d'
+		disk/kfscmd -n $kname 'create /dist/replica sys sys 775 d'
+		disk/kfscmd -n $kname 'create /dist/replica/ndist sys sys 775'
+		disk/kfscmd -n $kname 'create /dist/replica/client sys sys 775 d'
+		disk/kfscmd -n $kname 'create /dist/replica/client/plan9.db sys sys 664'
+		disk/kfscmd -n $kname 'create /dist/replica/client/plan9.log sys sys 664 a'
+	}
+
+case checkready checkdone
+	if(! test -f /dev/sd*/fs*){
+		mountfs=notdone
+		export mountfs
+		exit
+	}
+	if(! ~ $#fs 1 || ! test -f $fs){
+		mountfs=ready
+		export mountfs
+		exit
+	}
+	kname=`{kfsname $fs}
+	if(! test -f /srv/kfs.$kname){
+		disk/kfscmd -n $kname halt >[2]/dev/null
+		rm -f /srv/kfs.$kname /srv/kfs.$kname.cmd
+		logprog disk/kfs -n $kname -f $fs
+		disk/kfscmd -n $kname allow >>[2]/srv/log
+	}
+	if(test -f /srv/kfs.$kname && ! test -f /n/kfs/dist/replica/client/plan9.log){
+		log Mounting kfs file server for $fs
+		if(! logprog mount -c /srv/kfs.$kname /n/kfs)
+			echo 'mounting kfs: '^$status
+		disk/kfscmd -n $kname allow >>[2]/srv/log
+	}
+	if(test -f /srv/kfs.$kname && test -f /n/kfs/dist/replica/client/plan9.log){
+		mountfs=done
+		export mountfs
+		exit
+	}
+	mountfs=ready
+	export mountfs
+	exit
+}
+

+ 10 - 2
sys/lib/dist/pc/inst/partdisk

@@ -1,6 +1,7 @@
 #!/bin/rc
 
 # desc: edit partition tables (e.g., to create a plan 9 partition)
+# prereq: configfs
 
 switch($1){
 case go
@@ -31,7 +32,7 @@ case go
 	disk=$rd
 
 	if(! hasmbr /dev/$disk/data) {
-		echo 'The disk you selected has no master boot record on its first sector.'
+		echo 'The disk you selected HAS NO master boot record on its first sector.'
 		echo '(Perhaps it is a completely blank disk.)'
 		echo 'You need a master boot record to use the disk.'
 		echo 'Should we install a default master boot record?'
@@ -58,7 +59,14 @@ case go
 	}
 
 case checkdone
-	if(! test -f /dev/sd*/plan9){
+	# we want at least one disk with both an mbr and a plan9 partition
+	mbrandplan9=0
+	disks=`{ls /dev/sd*/plan9 >[2]/dev/null | sed 's!/dev/(sd..)/plan9!\1!'}
+	for(disk in $disks) {
+		if(hasmbr /dev/$disk/data)
+			mbrandplan9=1
+	}
+	if(~ $mbrandplan9 0){
 		partdisk=notdone
 		export partdisk
 	}

+ 31 - 4
sys/lib/dist/pc/inst/prepdisk

@@ -3,6 +3,15 @@
 # desc: subdivide plan 9 disk partition
 # prereq: partdisk
 
+fn autotype {
+	if(~ $fstype kfs)
+		echo -a 9fat -a nvram -a fs -a swap
+	if(~ $fstype fossil)
+		echo -a 9fat -a nvram -a fossil -a swap
+	if(~ $fstype fossil+venti)
+		echo -a 9fat -a nvram -a arenas -a isect -a fossil -a swap # -a other
+}
+
 switch($1) {
 case checkready
 	if(! test -f /dev/sd*/plan9*){
@@ -30,12 +39,30 @@ case go
 	echo 'If it is not yet subdivided, a sensible layout will be suggested;'
 	echo 'you can probably just type ''w'' and then ''q''.'
 	echo
-	disk/prep -a $disk
+	disk/prep `{autotype} $disk
 	disk/prep -p $disk >`{basename -d $disk}^/ctl >[2]/dev/null
 
 case checkdone
-	if(! test -f /dev/sd*/fs* || ! test -f /dev/sd*/9fat){
-		prepdisk=notdone
-		export prepdisk
+	if(! test -f /dev/sd*/9fat)
+		prepdisk=ready
+
+	if(! ~ $prepdisk ready){
+		prepdisk=done
+		switch($fstype){
+		case kfs
+			if(! test -f /dev/sd*/fs* && ! test -f /dev/fs/fs*)
+				prepdisk=ready
+		case fossil
+			if(! test -f /dev/sd*/fossil* && ! test -f /dev/fs/fossil*)
+				prepdisk=ready
+		case fossil+venti
+			if(! test -f /dev/sd*/fossil* && ! test -f /dev/fs/fossil*)
+				prepdisk=ready
+			if(! test -f /dev/sd*/arenas && ! test -f /dev/fs/arenas*)
+				prepdisk=ready
+			if(! test -f /dev/sd*/isect && ! test -f /dev/fs/isect*)
+				prepdisk=ready
+		}
 	}
+	export prepdisk
 }

+ 9 - 8
sys/lib/dist/pc/mkfile

@@ -22,10 +22,11 @@ boot.raw:Q: proto $SUB
 		touchfs 1000000000 >boot.raw
 
 boot.bz2:Q: boot.raw
-	cat boot.raw |
-		bflz -n 32 | bzip2 -9 >$target
-	# rm -rf boot proto.cp
-	ls -l boot.bz2
+	ls -l boot.raw
+	bflz -n 32 < boot.raw >boot.bflz
+	ls -l boot.bflz
+	bzip2 -9 < boot.bflz >$target
+	ls -l $target
 
 root.bz2:Q: boot.bz2
 	{
@@ -69,13 +70,13 @@ clean:V:
 	rm -rf boot boot.bz2 root.bz2 9pcflop ndisk 9load cddisk proto.cp 9loaddebug
 
 install:V: ndisk 9loaddebug
-	cp 9loaddebug ../web.protect
-	cp ndisk ../web.protect/disk
+	cp 9loaddebug ../web.protect2
+	cp ndisk ../web.protect2/disk
 	#mk clean
 
 test:V: ndisk 9loaddebug
-	cp 9loaddebug ../web.protect/n9loaddebug
-	cp ndisk ../web.protect/ndisk
+	cp 9loaddebug ../web.protect2/n9loaddebug
+	cp ndisk ../web.protect2/ndisk
 
 cd0:D:	cddisk
 	rm -f cd0

+ 20 - 5
sys/lib/dist/pc/proto

@@ -7,7 +7,8 @@
 	pbslba	555 sys sys
 	bin	d775 sys sys
 		auth d555 sys sys
-			factotum	555 sys sys
+# i think factotum is only needed if we include cpu
+#			factotum	555 sys sys
 		aux	d555 sys sys
 			isvmware	555 sys sys
 			mouse	555 sys sys
@@ -18,13 +19,18 @@
 		#	vmware	555 sys sys
 		#	vmwarefs	555 sys sys
 		#	vmmousepoll	555 sys sys
-		disk	d775 sys sys
+			zerotrunc	555 sys sys
+		disk	d555 sys sys
 			fdisk	555 sys sys
 			format	555 sys sys
 			kfs	555 sys sys
 			kfscmd	555 sys sys
 			mbr	555 sys sys
 			prep	555 sys sys
+		fossil	d555 sys sys
+			fossil	555 sys sys
+			flfmt	555 sys sys
+			conf		555 sys sys
 		ip	d555 sys sys
 			ipconfig	555 sys sys
 			ppp	555 sys sys
@@ -39,9 +45,15 @@
 			changes	555 sys sys
 			compactdb	555 sys sys /sys/lib/dist/pc/sub/compactdb
 			pull		555 sys sys
+		venti	d555 sys sys
+#VENTI			venti	555 sys sys
+#VENTI			conf		555 sys sys
+#VENTI			fmtarenas	555 sys sys
+#VENTI			fmtindex	555 sys sys
+#VENTI			fmtisect	555 sys sys
 		9660srv	555 sys sys
 # acme could go
-		acme	555 sys sys
+#		acme	555 sys sys
 		awk	555 sys sys
 		bargraph	555 sys sys /sys/lib/dist/bin/386/bargraph
 		basename	555 sys sys
@@ -53,14 +65,15 @@
 		cdsh	555 sys sys /sys/lib/dist/bin/386/cdsh
 		cp	555 sys sys
 # cpu could go
-		cpu	555 sys sys
+#		cpu	555 sys sys
 		date	555 sys sys
 		dd	555 sys sys
 		dossrv 555 sys sys
 		echo	555 sys sys
 		ed	555 sys sys
 # if cpu goes, exportfs could go
-		exportfs	555 sys sys
+#		exportfs	555 sys sys
+		ext2srv	555 sys sys
 		grep	555 sys sys
 		hget	555 sys sys
 		hoc	555 sys sys
@@ -121,6 +134,7 @@ n	d777 sys sys
 	9	d000 sys sys
 	kfs	d000 sys sys	/sys/lib/dist/pc/empty
 	kremvax	d000 sys sys	/sys/lib/dist/pc/empty
+	fossil	d000 sys sys
 	dist	d000 sys sys	/sys/lib/dist/pc/empty
 	distmedia	d000 sys sys	/sys/lib/dist/pc/empty
 rc	d555 sys sys
@@ -144,6 +158,7 @@ rc	d555 sys sys
 			changes	555 sys sys
 			defs	555 sys sys
 			pull	555 sys sys
+		slay		555 sys sys
 		sleep	555 sys sys /sys/lib/dist/pc/sub/sleep
 		termrc	555 sys sys /sys/lib/dist/pc/sub/termrc
 		unmount	555 sys sys /sys/lib/dist/pc/sub/unmount

+ 1 - 1
sys/lib/dist/pc/sub/bunzip2

@@ -1,4 +1,4 @@
 #!/bin/rc
 
-exec /kfs BUNZIP
+exec /boot/kfs BUNZIP
 # kfs is bzfs

+ 1 - 1
sys/lib/dist/pc/sub/ramfs

@@ -1,4 +1,4 @@
 #!/bin/rc
 
-exec /kfs RAMFS $*
+exec boot/kfs RAMFS $*
 # kfs is bzfs

+ 21 - 5
sys/lib/dist/pc/sub/termrc

@@ -9,15 +9,20 @@ if(~ $debug yes) echo env...
 sysname=gnot
 font=/lib/font/bit/lucidasans/typelatin1.7.font
 
-for (i in '#P' '#S' '#f' '#m' '#t' '#v') {
+for (i in '#P' '#f' '#m' '#t' '#v') {
 	if(~ $debug yes) echo bind $i
 	bind -a $i /dev >/dev/null >[2=1]
 }
 if(~ $debug yes) echo binddev done
 
 for(disk in /dev/sd??) {
-	if(test -f $disk/data && test -f $disk/ctl)
+	if(test -f $disk/data && test -f $disk/ctl){
 		disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
+		if(~ $#nosddma 0)
+			echo dma on >$disk/ctl
+		if(~ $#nosdrwm 0)
+			echo rwm on >$disk/ctl
+	}
 }
 
 for (i in /sys/log/*) {
@@ -33,8 +38,10 @@ dossrv
 boota:
 boota:	# again, just in case a timeout made the earlier one fail
 cp /n/a:/plan9.ini /tmp/plan9.orig
-if(! ~ $cdboot yes)
+if(! ~ $cdboot yes){
 	pci >/n/a:/pci.txt >[2]/dev/null
+	cp /dev/kmesg /n/a:/boot.txt >[2]/dev/null
+}
 
 # restore a partial install
 if(test -f /n/a:/9inst.cnf)
@@ -73,7 +80,16 @@ if(~ $#mouseport 1) {
 			aux/vga -vip $vgasize >/n/a:/vgainfo.txt
 		sleep 2	# wait for floppy to finish
 		aux/vga -l $vgasize
-		echo -n 'hwaccel off' >'#v/vgactl' >[2]/dev/null
-		echo -n 'hwblank off' >'#v/vgactl' >[2]/dev/null
+		if(! ~ $#novgaaccel 0)
+			echo -n 'hwaccel off' >'#v/vgactl' >[2]/dev/null
+		if(! ~ $#novgablank 0)
+			echo -n 'hwblank off' >'#v/vgactl' >[2]/dev/null
 	}
 }
+
+# configure loopback device without touching /net/ndb
+{
+	echo bind loopback /dev/null
+	echo add 127.0.0.1 255.255.255.0 
+} >/net/ipifc/clone
+

+ 2 - 0
sys/lib/lp/bin/lpscratch

@@ -14,6 +14,8 @@ if not
 switch($SCRATCHFILESERVER){
 case kfs
 	SCRATCHFILESYSTEM=''
+case fossil
+	SCRATCHFILESYSTEM=''
 case *
 	SCRATCHFILESYSTEM=other
 }

+ 2 - 1
sys/lib/mimetype

@@ -37,7 +37,7 @@
 .executable	application	octet-stream	-		n # DOS executable
 .exz		application	octet-stream	gzip		n # gzipped DOS executable
 .f		text		plain		-		y # fortran-77 program
-.fm		application	octet-stream	-		y # frame maker
+.fm		application	framemaker	-		y
 .f90		text		plain		-		y # fortran-90 program
 .flc		video		x-flc		-		m
 .fli		video		x-fli		-		m
@@ -143,3 +143,4 @@
 .zzz		application	sleep		-		n # testing
 -		application	x-gunzip	-		p # type for .tar.gz
 -		message		delivery-status	-		y # mail bounces
+-		application	pgp-signature	-		y

+ 0 - 34
sys/lib/sysconfig/fl/boot

@@ -1,34 +0,0 @@
-#!/boot/rc -m /boot/rcmain
-
-cpuserver=no
-cd /boot
-cp '#r/rtc' '#c/time'
-bind -a '#I' /net
-bind -a '#l0' /net
-bind -a '#S' /dev
-bind '#p' /proc
-bind '#d' /fd
-bind -a /boot /
-ipconfig loopback /dev/null 127.1
-if(~ $cpuserver yes){
-	factotum -sfactotum -S
-}
-if not{
-	factotum -sfactotum -u
-	# add a key so mount and fossil can authenticate each other
-	# remove this key once factotum is initialized with other keys
-	factotum -g 'proto=p9sk1 user=rsc dom=localhost !password=localhost'
-}
-venti -c venti.conf -B 1m -C 1m -h tcp!127.1!8000 -I 1m -w -a tcp!127.1!17034 &
-sleep 10
-venti=tcp!127.0.0.1!17034
-fossil -c '. flproto'
-mount -c /srv/boot /root
-bind -ac /root /
-rootdir=/root
-rootspec=''
-if(~ $cpuserver yes)
-	/386/init -c
-if not
-	/386/init -t
-exec ./rc -m/boot/rcmain -i

+ 0 - 7
sys/lib/sysconfig/fl/flproto

@@ -1,7 +0,0 @@
-srv -p fscons
-srv boot
-fsys main config /dev/sdC0/fossil
-fsys main open -c 3000
-fsys main
-users /active/adm/users
-snaptime -s 60 -a 0500

+ 0 - 8
sys/lib/sysconfig/fl/venti.conf

@@ -1,8 +0,0 @@
-index main
-isect /dev/sdC0/v.index0
-isect /dev/sdC0/v.index1
-isect /dev/sdC0/v.index2
-isect /dev/sdC0/v.index3
-
-arenas /dev/sdC0/v.arenas
-

+ 3 - 3
sys/man/1/cb

@@ -3,7 +3,7 @@
 .I cb 
 \- C program beautifier
 .SH SYNOPSIS
-\fBcb\fR [\fB-s\fR] [\fB-j\fR] [\fB-l\fR \fIleng\fR] [\fIfile\fR ...]
+\fBcb\fR [\fB-s\fR] [\fB-j\fR] [\fB-l\fR \fIlength\fR] [\fIfile\fR ...]
 .SH DESCRIPTION
 \fBCb\fR reads syntactically correct C programs from
 from its input or the given files, and writes them to its stdout
@@ -20,8 +20,8 @@ Ritchie found in The C Programming Language.
 .B -j
 Put split lines back together.
 .TP 
-.B -l leng
-Split lines that are longer than \fIleng\fR.
+.B -l length
+Split lines that are longer than \fIlength\fR.
 .SH SOURCE
 .B /sys/src/cmd/cb
 .SH NOTES

+ 7 - 1
sys/man/1/seq

@@ -25,6 +25,12 @@ prints a sequence of numbers, one per line, from
 as possible, in increments of
 .I incr
 (default 1).
+The loop is:
+.sp
+.EX
+  for(val = min; val <= max; val += incr) print val;
+.EE
+.sp
 The numbers are interpreted as floating point.
 .PP
 Normally integer values are printed as decimal integers.
@@ -49,7 +55,7 @@ nor with numbers in exponential notation.
 .TP
 .L
 seq 0 .05 .1
-Print 
+Print
 .BR "0 0.05 0.1" 
 (on separate lines).
 .TP

+ 1 - 5
sys/man/2/prime

@@ -67,20 +67,16 @@ generates a prime,
 .IR p ,
 with the following properties:
 .IP \-
+(\fIp\fR-1)/2 is prime.  Therefore
 .IR p -1
 has a large prime factor,
 .IR p '.
-A large factor is one close to 1/2
-the bit length of
-.IR p .
 .IP \-
 .IR p '-1
 has a large prime factor
 .IP \-
 .IR p +1
 has a large prime factor
-.IP \-
-(\fIp\fR-1)/2 is prime
 .PP
 .I DSAprimes
 generates two primes,

+ 3 - 3
sys/man/3/usb

@@ -44,11 +44,11 @@ For each connected device there is a directory in
 .BI #U/usb n\fR.
 Reading
 .BI #U/usb n /*/status
-yields the state, class, subclass and proto of each device in the
+yields the state, class/subclass/proto, vendor-id and product-id of each device in the
 first line.  The remaining lines give the state of each of the
 interfaces.
 .PP
-To find a mouse, for example, scan the status files for the line
+To find a mouse, for example, scan the status files for the line beginning with
 .IP
 .EX
 .BR "Enabled 0x020103"
@@ -202,7 +202,7 @@ on the endpoint file.  See also
 .TF "#U/usb n /*/status"
 .TP
 .BI #U/usb n /*/status
-USB device status file, class, subclass and proto are found in line one
+USB device status file; class/subclass/proto, vendor-id and product-id are found in line one
 .TP
 .BI #U/usb n /*/ctl
 USB

+ 24 - 1
sys/man/5/flush

@@ -24,7 +24,7 @@ The semantics of
 .B flush
 depends on messages arriving in order.
 .PP
-The server must answer the
+The server should answer the
 .B flush
 message immediately.
 If it recognizes
@@ -46,6 +46,29 @@ can never be responded to by an
 .B Rerror
 message.
 .PP
+The server may respond to the pending request before
+responding to the
+.BR Tflush .
+It is possible for a client to send multiple
+.B Tflush
+messages for a particular pending request.  Each
+subsequent
+.B Tflush
+must contain as
+.I oldtag
+the tag of the pending request (not a previous
+.BR Tflush ).
+Should multiple
+.BR Tflush es
+be received for a pending request, they must be answered in
+order.  A
+.B Rflush
+for any of the multiple
+.BR Tflush es
+implies an answer for all previous ones.  Therefore, should
+a server receive a request and then multiple flushes for that
+request, it need respond only to the last flush.
+.PP
 When the client sends a 
 .BR Tflush ,
 it must wait to receive the corresponding

+ 85 - 3
sys/man/8/boot

@@ -254,9 +254,83 @@ obtained (if any) from DHCP during
 .TP 8
 .B local
 connect to the local file system.
-The
-.I args
-are passed to
+The first argument is a disk holding a file system.
+.I Boot
+inspects the disk.
+If the disk is a 
+.IR fossil (4)
+file system, it invokes
+.B /boot/fossil
+to serve it.
+If the
+.B venti 
+environment variable (really,
+.IR plan9.ini (8)
+variable) is set,
+.I boot
+first arranges for fossil to be able to
+contact the named
+.IR venti (8)
+server.
+The variable's value can take the following forms:
+.TP
+.B /dev/sdC0/arenas
+the file should be a venti partition with a configuration
+stored on using
+.I venti/conf 
+(see
+.IR ventiaux (8)).
+.I Boot
+will start a loopback IP interface on 127.0.0.1
+and start
+.I venti
+announcing on
+.B tcp!127.1!17034
+for venti service
+and 
+.B tcp!127.1!8000
+for web service,
+using the configuration stored in that partition.
+.TP
+.B /dev/sdC0/arenas tcp!*!17034
+same as the last but specify an alternate venti service address.
+In this example, using
+.B *
+will announce on all available IP interfaces (even ones configured later)
+rather than just the loopback device.
+The loopback interface is still configured.
+.TP
+.B /dev/sdC0/arenas tcp!*!17034 tcp!*!80
+same as the last but specify alternate venti service and web addresses.
+The loopback interface is still configured.
+.TP
+.B tcp!135.104.9.2!17034
+the network address of a venti server running on a separate machine.
+.I Boot
+will configure the IP stack by passing any remaining
+boot arguments to
+.IR ipconfig (8).
+.PP
+If the disk is not a
+.IR fossil (4)
+partition, 
+.I boot
+invokes
+.BR /boot/kfs .
+A variety of programs, like
+.IR 9660srv (4)
+and
+.IR dossrv (4)
+masquerade as
+.I kfs
+to allow booting from alternate media formats,
+so as long as the disk is not a
+.I fossil
+disk, no check is made that the disk is in fact
+a
+.I kfs
+disk.
+The args are passed to
 .IR kfs (4).
 .PP
 For the
@@ -308,3 +382,11 @@ line is split only for presentation; it is one line in the file.)
 .IR root (3),
 .IR dhcpd (8),
 .IR init (8)
+.SH BUGS
+The use of
+.B bootargs
+in general is odd.
+The configuration specification
+for fossil and venti servers
+is particularly odd, but it does
+cover the common cases well.

+ 1 - 1
sys/man/8/fossilcons

@@ -484,12 +484,12 @@ none:none::
 noworld:noworld::
 sys:sys::
 glenda:glenda:glenda:
+.EE
 .PP
 Except
 .BR glenda ,
 these users are mandatory: they must appear in all user
 files and cannot be renamed.
-.EE
 .PP
 The
 .B -r

+ 8 - 0
sys/man/8/ipserv

@@ -157,6 +157,14 @@ the namespace for anonymous users (default
 .B d
 write debugging output to standard error
 .PP
+To preserve intended protections in shared file trees,
+any directory containing a file
+.I .httplogin
+is locked by
+.IR ftpd;
+see
+.IR httpd (8).
+.PP
 .I Imap4d
 provides access to a user's mailboxes via the IMAP4rev1 protocol.
 Only files rooted in

+ 29 - 12
sys/man/8/ping

@@ -4,7 +4,7 @@ ping, gping, traceroute, hogports \- probe the Internet
 .SH SYNOPSIS
 .B ping
 [
-.B -d
+.B -alq
 ] [
 .B -i
 .I interval
@@ -50,16 +50,27 @@ ping, gping, traceroute, hogports \- probe the Internet
 .B [\fImtpt\fP/]\fIproto\fP!\fIaddress\fP!\fIstartport\fP[-\fIendport\fP]
 .SH DESCRIPTION
 .I Ping
-sends ICMP echo requests to a system and returns the time
-for a response.  It can be used to determine the network delay
+sends ICMP echo request messages to a system.
+It can be used to determine the network delay
 and whether or not the destination is up.
+By default, a line is written to standard output for
+each request.
+If a reply is received the line contains the request
+id (starting at 0 and incrementing), the round trip time
+for this request, the average round trip time, and the time
+to live in the reply packet.  If no reply is received the line
+contains the word "lost", the request id, and the average round
+trip time.
+.PP
+If a reply is received for each request,
+.I ping
+returns successfully. Otherwise it returns an error status of
+"lost messages".
 .PP
 The options are:
 .TP
-.B n
-requests that a total of
-.I count
-messages be sent, default 32.
+.B a
+adds the IP source and destination addresses to each report.
 .TP
 .B i
 sets the time between messages
@@ -67,6 +78,17 @@ to be
 .I interval
 milliseconds, default 1000 ms.
 .TP
+.B l
+causes only lost messages to be reported.
+.TP
+.B n
+requests that a total of
+.I count
+messages be sent, default 32.
+.TP
+.B q
+suppresses any output (i.e. be quiet).
+.TP
 .B s
 sets the length of the message to be
 .I size
@@ -74,11 +96,6 @@ bytes, ICMP header included.
 The size cannot be smaller than 32 or
 larger than 8192.  The default is
 64.
-.TP
-.B d
-causes message numbers to be printed
-so that one can see the order with which
-messages are received and which are lost.
 .PP
 .I Gping
 is a

+ 8 - 0
sys/man/8/plan9.ini

@@ -504,6 +504,14 @@ partition, the definition might read
 See
 .IR boot (8)
 for more.
+.SS \fLventi=value\fP
+When booting from a local fossil server backed by a local
+or remote venti server,
+this variable specifies how to establish the connection to the
+venti server.
+See
+.IR boot (8)
+for more.
 .SS \fLcfs=value\fP
 This gives the name of the file holding the disk partition
 for the cache file system,

+ 11 - 1
sys/man/8/pop3

@@ -142,4 +142,14 @@ running on the authentication server.
 .IR rewrite (6),
 .IR send (8),
 .IR upasfs (4)
-
+.SH BUGS
+Usually messages flagged for deletion with
+.B DELE
+are not actually deleted until the client sends a
+.B QUIT
+command to end the conversation.
+.I Pop3
+implements a non-standard command
+.B SYNC
+that deletes messages flagged for deletion
+without ending the conversation.

+ 9 - 0
sys/man/8/prep

@@ -57,6 +57,9 @@ prep, fdisk, format, mbr \- prepare hard and floppy diskettes, flashes
 .PP
 .B disk/mbr
 [
+.B -9
+]
+[
 .B -m
 .I mbrfile
 ]
@@ -636,6 +639,12 @@ If the
 .I mbrfile
 is not specified, a boot block is installed that
 prints a message explaining that the disk is not bootable.
+The
+.B -9
+option initialises the partition table to consist of one
+.BR plan9
+partition which spans the entire disc starting at the end of the
+first track.
 .SH EXAMPLES
 Initialize the kernel disk driver with the partition information
 from the FAT boot sectors.

+ 2 - 4
sys/man/8/ventiaux

@@ -340,10 +340,8 @@ but should only be used when it is known that the file was already zeroed.
 .I Rdarena
 extracts the named
 .I arena
-from the Venti system described by the
-.IR venti.conf (6)
-file
-.I venti.config
+from the arena partition
+.I arenapart
 and writes this arena to standard output.
 This command is typically used to back up an arena to external media.
 The

+ 175 - 17
sys/src/9/boot/local.c

@@ -49,40 +49,53 @@ configlocal(Method *mp)
 }
 
 int
-connectlocal(void)
+connectlocalkfs(void)
 {
-	int i, p[2];
-	Dir *dir;
+	int i, pid, fd, p[2];
 	char partition[64];
 	char *dev;
 	char **arg, **argp;
-	ulong mode;
+	Dir *d;
 
 	if(stat("/boot/kfs", statbuf, sizeof statbuf) < 0)
 		return -1;
 
 	dev = disk ? disk : bootdisk;
 	snprint(partition, sizeof partition, "%sfs", dev);
-	dir = dirstat(partition);
-	if(dir == nil){
+	fd = open(partition, OREAD);
+	if(fd < 0){
 		strcpy(partition, dev);
-		dir = dirstat(partition);
-		if(dir == nil)
+		fd = open(partition, OREAD);
+		if(fd < 0)
 			return -1;
 	}
-	mode = dir->mode;
-	free(dir);
-	if(mode & DMDIR)
+	/*
+	 * can't do this check -- might be some other server posing as kfs.
+	 *
+	memset(buf, 0, sizeof buf);
+	pread(fd, buf, 512, 0);
+	close(fd);
+	if(memcmp(buf+256, "kfs wren device\n", 16) != 0){
+		if(strstr(partition, "/fs"))
+			print("no kfs file system found on %s\n", partition);
+		return -1;
+	}
+	 *
+	 */
+	d = dirfstat(fd);
+	close(fd);
+	if(d == nil)
+		return -1;
+	if(d->mode&DMDIR){
+		free(d);
 		return -1;
+	}
+	free(d);
 
 	print("kfs...");
-	if(bind("#c", "/dev", MREPL) < 0)
-		fatal("bind #c");
-	if(bind("#p", "/proc", MREPL) < 0)
-		fatal("bind #p");
 	if(pipe(p)<0)
 		fatal("pipe");
-	switch(fork()){
+	switch(pid = fork()){
 	case -1:
 		fatal("fork");
 	case 0:
@@ -105,8 +118,153 @@ connectlocal(void)
 	default:
 		break;
 	}
-	waitpid();
+	for(;;){
+		if((i = waitpid()) == -1)
+			fatal("waitpid for kfs failed");
+		if(i == pid)
+			break;
+	}
 
 	close(p[1]);
 	return p[0];
 }
+
+static void
+run(char *file, ...)
+{
+	char buf[64];
+	Waitmsg *w;
+	int pid;
+
+	switch(pid = fork()){
+	case -1:
+		fatal("fork");
+	case 0:
+		exec(file, &file);
+		snprint(buf, sizeof buf, "can't exec %s", file);
+		fatal(buf);
+	default:
+		while((w = wait()) != nil)
+			if(w->pid == pid)
+				break;
+		if(w == nil){
+			snprint(buf, sizeof buf, "wait returned nil running %s", file);
+			fatal(buf);
+		}
+	}
+}
+
+static int
+print1(int fd, char *s)
+{
+	return write(fd, s, strlen(s));
+}
+
+void
+configloopback(void)
+{
+	int fd;
+
+	if((fd = open("/net/ipifc/clone", ORDWR)) < 0){
+		bind("#I", "/net", MAFTER);
+		if((fd = open("/net/ipifc/clone", ORDWR)) < 0)
+			fatal("open /net/ipifc/clone for loopback");
+	}
+	if(print1(fd, "bind loopback /dev/null") < 0
+	|| print1(fd, "add 127.0.0.1 255.255.255.255") < 0)
+		fatal("write /net/ipifc/clone for loopback");
+}
+
+int
+connectlocalfossil(void)
+{
+	int fd;
+	char *venti, *f[32];
+	int nf;
+	char partition[128], buf[512];
+	char *dev;
+
+	if(stat("/boot/fossil", statbuf, sizeof statbuf) < 0)
+		return -1;
+
+	/* look for fossil partition */
+	dev = disk ? disk : bootdisk;
+	snprint(partition, sizeof partition, "%sfossil", dev);
+	fd = open(partition, OREAD);
+	if(fd < 0){
+		strcpy(partition, dev);
+		fd = open(partition, OREAD);
+		if(fd < 0)
+			return -1;
+	}
+	memset(buf, 0, sizeof buf);
+	pread(fd, buf, 512, 127*1024);
+	close(fd);
+	if(memcmp(buf, "fossil config\n", 14) != 0){
+		if(strstr(partition, "/fossil"))
+			print("no fossil config found on %s\n", partition);
+		return -1;
+	}
+
+	settime(1, -1, nil);
+
+	/* make venti available */
+	if((venti = getenv("venti")) && (nf = tokenize(venti, f, nelem(f)))){
+		if((fd = open(f[0], OREAD)) >= 0){
+			print("venti...");
+			memset(buf, 0, sizeof buf);
+			pread(fd, buf, 512, 248*1024);
+			close(fd);
+			if(memcmp(buf, "venti config\n", 13) != 0){
+				print("no venti config found on %s\n", f[0]);
+				return -1;
+			}
+			if(stat("/boot/venti", statbuf, sizeof statbuf) < 0){
+				print("/boot/venti does not exist\n");
+				return -1;
+			}
+			switch(nf){
+			case 1:
+				f[1] = "tcp!127.1!17034";
+			case 2:
+				f[2] = "tcp!127.1!8000";
+			}
+			configloopback();
+			run("/boot/venti", "-c", venti, "-a", f[1], "-h", f[2], 0);
+			setenv("venti", f[1]);
+		}else{
+			/* set up the network so we can talk to the venti server */
+			/* this is such a crock. */
+			configip(nf, f, 0);
+			setenv("venti", f[0]);
+		}
+	}
+
+	/* start fossil */
+	print("fossil(%s)...", partition);
+	run("/boot/fossil", "-f", partition, "-c", "srv -A fboot", "-c", "srv -p fscons", 0);
+	fd = open("#s/fboot", ORDWR);
+	if(fd < 0){
+		print("open #s/fboot: %r\n");
+		return -1;
+	}
+	remove("#s/fboot");	/* we'll repost as #s/boot */
+	return fd;
+}
+
+int
+connectlocal(void)
+{
+	int fd;
+
+	if(bind("#c", "/dev", MREPL) < 0)
+		fatal("bind #c");
+	if(bind("#p", "/proc", MREPL) < 0)
+		fatal("bind #p");
+	bind("#S", "/dev", MAFTER);
+
+	if((fd = connectlocalfossil()) < 0)
+	if((fd = connectlocalkfs()) < 0)
+		return -1;
+	return fd;
+}

+ 1 - 1
sys/src/9/ip/ip.h

@@ -604,7 +604,7 @@ extern void	ipifcaddroute(Fs*, int, uchar*, uchar*, uchar*, int);
 extern void	ipifcremroute(Fs*, int, uchar*, uchar*);
 extern void	ipifcremmulti(Conv *c, uchar *ma, uchar *ia);
 extern void	ipifcaddmulti(Conv *c, uchar *ma, uchar *ia);
-extern char*	ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock);
+extern char*	ipifcrem(Ipifc *ifc, char **argv, int argc);
 extern char*	ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp);
 extern long	ipselftabread(Fs*, char *a, ulong offset, int n);
 extern char*	ipifcaddgate6(Fs *f, Ipifc *ifc, char**argv, int argc);

+ 65 - 80
sys/src/9/ip/ipifc.c

@@ -68,6 +68,7 @@ static void	remselfcache(Fs *f, Ipifc *ifc, Iplifc *lifc, uchar *a);
 static char*	ipifcjoinmulti(Ipifc *ifc, char **argv, int argc);
 static char*	ipifcleavemulti(Ipifc *ifc, char **argv, int argc);
 static void	ipifcregisterproxy(Fs*, Ipifc*, uchar*);
+static char*	ipifcremlifc(Ipifc*, Iplifc*);
 
 /*
  *  link in a new medium
@@ -175,9 +176,6 @@ ipifcbind(Conv *c, char **argv, int argc)
 static char*
 ipifcunbind(Ipifc *ifc)
 {
-	char *av[4];
-	char ip[32];
-	char mask[32];
 	char *err;
 
 	if(waserror()){
@@ -204,18 +202,10 @@ ipifcunbind(Ipifc *ifc)
 	qclose(ifc->conv->sq);
 
 	/* disassociate logical interfaces */
-	av[0] = "remove";
-	av[1] = ip;
-	av[2] = mask;
-	av[3] = 0;
 	while(ifc->lifc){
-		if(ipcmp(ifc->lifc->mask, IPallbits) == 0)
-			sprint(ip, "%I", ifc->lifc->remote);
-		else
-			sprint(ip, "%I", ifc->lifc->local);
-		sprint(mask, "%M", ifc->lifc->mask);
-		if (err = ipifcrem(ifc, av, 3, 0))
-			print("ipifcunbind, addr %s, mask %s: %s\n", ip, mask, err);
+		err = ipifcremlifc(ifc, ifc->lifc);
+		if(err)
+			error(err);
 	}
 
 	ifc->m = nil;
@@ -228,7 +218,7 @@ ipifcunbind(Ipifc *ifc)
 
 char sfixedformat[] = "device %s maxtu %d sendra %d recvra %d mflag %d oflag %d maxraint %d minraint %d linkmtu %d reachtime %d rxmitra %d ttl %d routerlt %d pktin %lud pktout %lud errin %lud errout %lud\n";
 
-char slineformat[] = "	%-40.40I %-10.10M %-40.40I %-12lud %-12lud\n";
+char slineformat[] = "	%-40I %-10M %-40I %-12lud %-12lud\n";
 
 
 static int
@@ -477,12 +467,8 @@ ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp)
 
 	/* check for point-to-point interface */
 	if(ipcmp(ip, v6loopback))  /* skip v6 loopback, it's a special address */
-	if(ipcmp(mask, IPallbits) == 0){
-		/* point to point networks are a hack */
-		if(ipcmp(ip, rem) == 0)
-			findprimaryip(f, lifc->local);
+	if(ipcmp(mask, IPallbits) == 0)
 		type |= Rptpt;
-	}
 
 	/* add local routes */
 	if(isv4(ip))
@@ -558,82 +544,90 @@ out:
 }
 
 /*
- *  remove an address from an interface.
- *  called with c->car locked
+ *  remove a logical interface from an ifc
+ *  always called with ifc wlock'd
  */
-char*
-ipifcrem(Ipifc *ifc, char **argv, int argc, int dolock)
+static char*
+ipifcremlifc(Ipifc *ifc, Iplifc *lifc)
 {
-	uchar ip[IPaddrlen];
-	uchar mask[IPaddrlen];
-	Iplifc *lifc, **l;
+	Iplifc **l;
 	Fs *f;
-	uchar *addr;
-	int type;
-
-	if(argc < 3)
-		return Ebadarg;
 
 	f = ifc->conv->p->f;
 
-	parseip(ip, argv[1]);
-	parseipmask(mask, argv[2]);
-
-	if(dolock)
-		wlock(ifc);
-
-	/* Are we point to point */
-	type = 0;
-	if(ipcmp(mask, IPallbits) == 0)
-		type = Rptpt;
-
 	/*
 	 *  find address on this interface and remove from chain.
 	 *  for pt to pt we actually specify the remote address as the
 	 *  addresss to remove.
 	 */
-	l = &ifc->lifc;
-	for(lifc = *l; lifc != nil; lifc = lifc->next) {
-		addr = lifc->local;
-		if(type == Rptpt)
-			addr = lifc->remote;
-		if (memcmp(ip, addr, IPaddrlen) == 0
-		&& memcmp(mask, lifc->mask, IPaddrlen) == 0) {
-			*l = lifc->next;
-			break;
-		}
-		l = &lifc->next;
-	}
-
-	if(lifc == nil){
-		if(dolock)
-			wunlock(ifc);
-		print("ipifcrem: wrong address\n");
+	for(l = &ifc->lifc; *l != nil && *l != lifc; l = &(*l)->next)
+		;
+	if(*l == nil)
 		return "address not on this interface";
-	}
+	*l = lifc->next;
 
 	/* disassociate any addresses */
 	while(lifc->link)
 		remselfcache(f, ifc, lifc, lifc->link->self->a);
 
 	/* remove the route for this logical interface */
-	if(isv4(ip))
+	if(isv4(lifc->local))
 		v4delroute(f, lifc->remote+IPv4off, lifc->mask+IPv4off, 1);
 	else {
 		v6delroute(f, lifc->remote, lifc->mask, 1);
-		if(ipcmp(ip, v6loopback) == 0)
+		if(ipcmp(lifc->local, v6loopback) == 0)
 			/* remove route for all node multicast */
 			v6delroute(f, v6allnodesN, v6allnodesNmask, 1);
-		else if(memcmp(ip, v6linklocal, v6linklocalprefix) == 0)
+		else if(memcmp(lifc->local, v6linklocal, v6linklocalprefix) == 0)
 			/* remove route for all link multicast */
 			v6delroute(f, v6allnodesL, v6allnodesLmask, 1);
 	}
 
 	free(lifc);
-
-	if(dolock)
-		wunlock(ifc);
 	return nil;
+
+}
+
+/*
+ *  remove an address from an interface.
+ *  called with c->car locked
+ */
+char*
+ipifcrem(Ipifc *ifc, char **argv, int argc)
+{
+	uchar ip[IPaddrlen];
+	uchar mask[IPaddrlen];
+	uchar rem[IPaddrlen];
+	Iplifc *lifc;
+	char *rv;
+
+	if(argc < 3)
+		return Ebadarg;
+
+	parseip(ip, argv[1]);
+	parseipmask(mask, argv[2]);
+	if(argc < 4)
+		maskip(ip, mask, rem);
+	else
+		parseip(rem, argv[3]);
+
+	wlock(ifc);
+
+	/*
+	 *  find address on this interface and remove from chain.
+	 *  for pt to pt we actually specify the remote address as the
+	 *  addresss to remove.
+	 */
+	for(lifc = ifc->lifc; lifc != nil; lifc = lifc->next) {
+		if (memcmp(ip, lifc->local, IPaddrlen) == 0
+		&& memcmp(mask, lifc->mask, IPaddrlen) == 0
+		&& memcmp(rem, lifc->remote, IPaddrlen) == 0)
+			break;
+	}
+
+	rv = ipifcremlifc(ifc, lifc);
+	wunlock(ifc);
+	return rv;
 }
 
 /*
@@ -690,30 +684,21 @@ ipifcconnect(Conv* c, char **argv, int argc)
 {
 	char *err;
 	Ipifc *ifc;
-	char *av[4];
-	char ip[80], mask[80];
 
 	ifc = (Ipifc*)c->ptcl;
 
 	if(ifc->m == nil)
 		 return "ipifc not yet bound to device";
 
-	av[0] = "remove";
-	av[1] = ip;
-	av[2] = mask;
-	av[3] = 0;
 	if(waserror()){
 		wunlock(ifc);
 		nexterror();
 	}
 	wlock(ifc);
 	while(ifc->lifc){
-		if(ipcmp(ifc->lifc->mask, IPallbits) == 0)
-			sprint(ip, "%I", ifc->lifc->remote);
-		else
-			sprint(ip, "%I", ifc->lifc->local);
-		sprint(mask, "%M", ifc->lifc->mask);
-		ipifcrem(ifc, av, 3, 0);
+		err = ipifcremlifc(ifc, ifc->lifc);
+		if(err)
+			error(err);
 	}
 	wunlock(ifc);
 	poperror();
@@ -818,7 +803,7 @@ ipifcctl(Conv* c, char**argv, int argc)
 	else if(strcmp(argv[0], "try") == 0)
 		return ipifcadd(ifc, argv, argc, 1, nil);
 	else if(strcmp(argv[0], "remove") == 0)
-		return ipifcrem(ifc, argv, argc, 1);
+		return ipifcrem(ifc, argv, argc);
 	else if(strcmp(argv[0], "unbind") == 0)
 		return ipifcunbind(ifc);
 	else if(strcmp(argv[0], "joinmulti") == 0)

+ 2 - 0
sys/src/9/mkfile

@@ -1,7 +1,9 @@
 ARCH=\
 	alphapc\
+	bitsy\
 	mtx\
 	pc\
+	ppc\
 	
 all:V:
 	for(i in $ARCH)@{

+ 14 - 5
sys/src/9/pc/devusb.c

@@ -103,7 +103,7 @@ static Cmdtab usbportmsg[] =
 
 static Cmdtab usbctlmsg[] =
 {
-	CMclass,		"class",	4,
+	CMclass,		"class",	0,
 	CMdata,		"data",	3,
 	CMdebug,		"debug",	3,
 	CMep,		"ep",		6,
@@ -681,7 +681,10 @@ usbread(Chan *c, void *a, long n, vlong offset)
 		break;
 
 	case Qstatus:
-		p = seprint(s, se, "%s %#6.6lux\n", devstates[d->state], d->csp);
+		if (d->did || d->vid)
+			p = seprint(s, se, "%s %#6.6lux %#4.4ux %#4.4ux\n", devstates[d->state], d->csp, d->vid, d->did);
+		else
+			p = seprint(s, se, "%s %#6.6lux\n", devstates[d->state], d->csp);
 		for(i=0; i<nelem(d->ep); i++) {
 			e = d->ep[i];
 			if(e == nil)
@@ -750,12 +753,18 @@ usbwrite(Chan *c, void *a, long n, vlong offset)
 			d->ls = strtoul(cb->f[1], nil, 0) == 0;
 			break;
 		case CMclass:
-			i = strtoul(cb->f[2], nil, 0);
-			d->npt = strtoul(cb->f[1], nil, 0);
-			/* class config# csp ( == class subclass proto) */
+			if (cb->nf != 4 && cb->nf != 6)
+				cmderror(cb, Ebadusbmsg);
+			/* class #ifc ept csp ( == class subclass proto) [vendor product] */
+			d->npt = strtoul(cb->f[1], nil, 0);	/* # of interfaces */
+			i = strtoul(cb->f[2], nil, 0);		/* endpoint */
 			if (i < 0 || i >= nelem(d->ep)
 			 || d->npt > nelem(d->ep) || i >= d->npt)
 				cmderror(cb, Ebadusbmsg);
+			if (cb->nf == 6) {
+				d->vid = strtoul(cb->f[4], nil, 0);
+				d->did = strtoul(cb->f[5], nil, 0);
+			}
 			if (i == 0)
 				d->csp = strtoul(cb->f[3], nil, 0);
 			if(d->ep[i] == nil){

+ 6 - 0
sys/src/9/pc/devvga.c

@@ -41,6 +41,7 @@ enum {
 	CMpanning,
 	CMsize,
 	CMtype,
+	CMunblank,
 };
 
 static Cmdtab vgactlmsg[] = {
@@ -56,6 +57,7 @@ static Cmdtab vgactlmsg[] = {
 	CMpanning,	"panning",	2,
 	CMsize,		"size",		3,
 	CMtype,		"type",		2,
+	CMunblank,	"unblank",	1,
 };
 
 static void
@@ -348,6 +350,10 @@ vgactl(Cmdbuf *cb)
 		drawblankscreen(1);
 		return;
 	
+	case CMunblank:
+		drawblankscreen(0);
+		return;
+	
 	case CMblanktime:
 		blanktime = strtoul(cb->f[1], 0, 0);
 		return;

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

@@ -1803,6 +1803,7 @@ etherelnk3reset(Ether* ether)
 	case 0x7646:		/* 3CSOHO100-TX */
 	case 0x9055:		/* 3C905B-TX */
 	case 0x9200:		/* 3C905C-TX */
+	case 0x9201:		/* 3C920 */
 		/*FALLTHROUGH*/
 	case 0x9000:		/* 3C900-TPO */
 	case 0x9001:		/* 3C900-COMBO */
@@ -1895,6 +1896,7 @@ etherelnk3reset(Ether* ether)
 	case 0x7646:
 	case 0x9055:
 	case 0x9200:
+	case 0x9201:
 		ctlr->xcvr = xcvrMii;
 		txrxreset(port);
 		x = ins(port+ResetOp905B);

+ 2 - 0
sys/src/9/pc/usb.h

@@ -117,6 +117,8 @@ struct Udev
 	int		id;
 	uchar	port;		/* port number on connecting hub */
 	ulong	csp;
+	ushort	vid;		/* vendor id */
+	ushort	did;		/* product id */
 	int		ls;
 	int		npt;
 	Endpt*	ep[16];	/* active end points */

+ 1 - 1
sys/src/9/pc/usbuhci.c

@@ -963,7 +963,7 @@ 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("e->buffered %d?\n", e->buffered);
 					e->buffered = 0;
 				}
 			}

+ 2 - 0
sys/src/9/port/devsrv.c

@@ -243,6 +243,8 @@ srvwstat(Chan *c, uchar *dp, int n)
 		error (Eshortstat);
 	if(d.mode != ~0UL)
 		sp->perm = d.mode & 0777;
+	if(d.uid && *d.uid)
+		kstrdup(&sp->owner, d.uid);
 
 	qunlock(&srvlk);
 	poperror();

+ 3 - 1
sys/src/9/port/master

@@ -1,8 +1,11 @@
+# do not edit; automatically generated
+
 $	pnp
 /	root
 A	audio
 A	uda1341
 B	bridge
+C	ce
 D	ssl
 E	sdp
 F	flash
@@ -18,7 +21,6 @@ T	lm78
 U	usb
 V	lml
 V	tv
-V	tvnew
 X	loopback
 Y	pccard
 a	tls

+ 10 - 0
sys/src/9/port/master.local

@@ -0,0 +1,10 @@
+α	local use
+β	local use
+γ	local use
+δ	local use
+ε	local use
+ζ	local use
+η	local use
+θ	local use
+ι	local use
+κ	local use

+ 8 - 2
sys/src/9/port/mkfile

@@ -1,9 +1,15 @@
 # If the existence of this mkfile screws something up, rename it.	-rsc
 
-master:D:
+master:DV:
+	{
+	echo '# do not edit; automatically generated'
+	echo
 	echo '
 		X , s/Dev (.*)devtab.*{.*\n	L?''(.*)''/DEV \1 \2\n/
 		X ,x g/^DEV/ p
 	' | sam -d ../*/dev*.c >[2]/dev/null |
 	awk '/^DEV/ { printf("%s\t%s\n", $3, $2); }' |
-	sort -u >master
+	sort -u
+	echo
+	cat master.local
+	} >master

+ 7 - 0
sys/src/9/port/qio.c

@@ -1324,6 +1324,13 @@ qiwrite(Queue *q, void *vp, int len)
 
 		ilock(q);
 
+		/* don't queue over the limit, just lose the bytes */
+		if(q->len >= q->limit){
+			iunlock(q);
+			freeb(b);
+			break;
+		}
+	
 		QDEBUG checkb(b, "qiwrite");
 		if(q->bfirst)
 			q->blast->next = b;

+ 3 - 3
sys/src/9/port/qlock.c

@@ -44,9 +44,9 @@ qlock(QLock *q)
 	up->qnext = 0;
 	up->state = Queueing;
 	up->qpc = getcallerpc(&q);
-	unlock(&q->use);
 	if(edf->isedf(up))
 		edf->edfblock(up);
+	unlock(&q->use);
 	sched();
 }
 
@@ -108,9 +108,9 @@ rlock(RWlock *q)
 	q->tail = up;
 	up->qnext = 0;
 	up->state = QueueingR;
-	unlock(&q->use);
 	if(edf->isedf(up))
 		edf->edfblock(up);
+	unlock(&q->use);
 	sched();
 }
 
@@ -165,9 +165,9 @@ wlock(RWlock *q)
 	q->tail = up;
 	up->qnext = 0;
 	up->state = QueueingW;
-	unlock(&q->use);
 	if(edf->isedf(up))
 		edf->edfblock(up);
+	unlock(&q->use);
 	sched();
 }
 

+ 1 - 1
sys/src/boot/pc/conf.c

@@ -193,7 +193,7 @@ again:
 		mtimeout = 0;
 		i = strtol(buf, &p, 0)-1;
 		if(i < 0 || i >= nmitem)
-			continue;
+			goto again;
 		switch(*p){
 		case 'p':
 		case 'P':

+ 3 - 0
sys/src/boot/pc/console.c

@@ -151,6 +151,9 @@ getstr(char *prompt, char *buf, int size, char *def, int timeout)
 		print(pbuf);
 		len = getline(buf, size, timeout);
 		switch(len){
+		case 0:
+			/* RETURN */
+			continue;
 		case -1:
 			/* ^U typed */
 			continue;

+ 4 - 0
sys/src/boot/pc/l.s

@@ -1,7 +1,11 @@
 #include "x16.h"
 #include "mem.h"
 
+#ifdef PXE
 #define PDB		0x90000		/* temporary page tables (24KB) */
+#else
+#define PDB		0x08000
+#endif PXE
 
 #define NoScreenBlank	1
 /*#define ResetDiscs	1*/

+ 5 - 2
sys/src/boot/pc/mkfile

@@ -87,7 +87,7 @@ all:V:	$TARG
 	$LD -o $target -H3 -T0x80010000 -l $prereq -lflate -lc
 	ls -l $target
 
-9pxeload:	l.$O $CORE $LOAD $ETHER
+9pxeload:	lpxe.$O $CORE $LOAD $ETHER
 	$LD -o $target -H3 -T0x80007C00 -l $prereq -lflate -lc
 	ls -l $target
 
@@ -118,7 +118,10 @@ lddebug:	ld.$O $CORE $BCOM
 	# map({"text", 0x80080100, 0x800B0000, 0x00000020})
 
 ld.$O:	l.s
-	$AS -DDOTCOM -o ld.$O l.s
+	$AS -DDOTCOM -o $target l.s
+
+lpxe.$O: l.s
+	$AS -DPXE -o $target l.s
 
 %.$O:	%.s
 	$AS $stem.s

+ 4 - 8
sys/src/cmd/auth/keyfs.c

@@ -33,8 +33,6 @@ enum{
 	Sdisabled,
 	Stempdisabled,
 	Smax,
-
-	PurgatorySecs=	MAXBAD,		/* averages out to 1 attempt a second */
 };
 
 struct Fid{
@@ -51,7 +49,7 @@ struct User{
 	char	secret[SECRETLEN];
 	ulong	expire;			/* 0 == never */
 	uchar	status;
-	uchar	bad;			/* number of consecutive bad authentication attempts */
+	ulong	bad;			/* number of consecutive bad authentication attempts */
 	int	ref;
 	char	removed;
 	uchar	warnings;
@@ -453,7 +451,7 @@ Read(Fid *f)
 			thdr.count = 0;
 			return 0;
 		}
-		sprint(data, "%d\n", f->user->bad);
+		sprint(data, "%lud\n", f->user->bad);
 		if(n > strlen(data))
 			n = strlen(data);
 		thdr.count = n;
@@ -535,10 +533,8 @@ Write(Fid *f)
 			f->user->bad = 0;
 		else
 			f->user->bad++;
-		if(f->user->bad >= MAXBAD){
-			f->user->purgatory = time(0) + PurgatorySecs;
-			f->user->bad = 0;
-		}
+		if(f->user->bad && ((f->user->bad)%MAXBAD) == 0)
+			f->user->purgatory = time(0) + f->user->bad;
 		return 0;
 	case Qwarnings:
 		data[n] = '\0';

+ 1 - 0
sys/src/cmd/aux/mouse.c

@@ -131,6 +131,7 @@ setupeia(int fd, char *baud, char *bits)
 	timedwrite(fd, bits, strlen(bits));
 	timedwrite(fd, "s1", 2);
 	timedwrite(fd, "pn", 2);
+	timedwrite(fd, "i1", 2);
 	alarm(0);
 }
 

+ 11 - 8
sys/src/cmd/aux/zerotrunc.c

@@ -4,20 +4,23 @@
 
 #include <u.h>
 #include <libc.h>
-#include <bio.h>
 
 void
 main(void)
 {
-	int c;
-	Biobuf bin, bout;
+	char buf[4096];
+	char *p;
+	int n;
 
-	Binit(&bin, 0, OREAD);
-	Binit(&bout, 1, OWRITE);
-	while((c = Bgetc(&bin)) != Beof && c != 0){
-		Bputc(&bout, c);
+	while((n = read(0, buf, sizeof(buf))) > 0){
+		p = memchr(buf, 0, n);
+		if(p != nil)
+			n = p-buf;
+		if(n > 0)
+			write(1, buf, n);
+		if(p != nil)
+			break;
 	}
-	Bflush(&bout);
 	exits(0);
 }
 

+ 13 - 12
sys/src/cmd/cc/pickle.c

@@ -7,6 +7,7 @@ static char *kwd[] =
 	"$local", "$loop", "$return", "$tail", "$then",
 	"$union", "$whatis", "$while",
 };
+static char picklestr[] = "\tbp = pickle(bp, ep, un, ";
 
 static char*
 pmap(char *s)
@@ -112,12 +113,12 @@ picklemember(Type *t, long off)
 	case TIND:
 		if(s == S)
 			Bprint(&outbuf,
-				"\tpickle(bp, un, \"p\", (char*)addr+%ld+_i*%ld);\n",
-				t->offset+off, t->width);
+				"%s\"p\", (char*)addr+%ld+_i*%ld);\n",
+				picklestr, t->offset+off, t->width);
 		else
 			Bprint(&outbuf,
-				"\tpickle(bp, un, \"p\", &addr->%s);\n",
-				pmap(s->name));
+				"%s\"p\", &addr->%s);\n",
+				picklestr, pmap(s->name));
 		break;
 
 	case TINT:
@@ -133,11 +134,11 @@ picklemember(Type *t, long off)
 	case TFLOAT:
 	case TDOUBLE:
 		if(s == S)
-			Bprint(&outbuf, "\tpickle(bp, un, \"%c\", (char*)addr+%ld+_i*%ld);\n",
-				picklechar[t->etype], t->offset+off, t->width);
+			Bprint(&outbuf, "%s\"%c\", (char*)addr+%ld+_i*%ld);\n",
+				picklestr, picklechar[t->etype], t->offset+off, t->width);
 		else
-			Bprint(&outbuf, "\tpickle(bp, un, \"%c\", &addr->%s);\n",
-				picklechar[t->etype], pmap(s->name));
+			Bprint(&outbuf, "%s\"%c\", &addr->%s);\n",
+				picklestr, picklechar[t->etype], pmap(s->name));
 		break;
 	case TARRAY:
 		Bprint(&outbuf, "\tfor(_i = 0; _i < %ld; _i++) {\n\t",
@@ -152,10 +153,10 @@ picklemember(Type *t, long off)
 		if(s1 == S)
 			break;
 		if(s == S) {
-			Bprint(&outbuf, "\tpickle_%s(bp, un, (%s*)((char*)addr+%ld+_i*%ld));\n",
+			Bprint(&outbuf, "\tbp = pickle_%s(bp, ep, un, (%s*)((char*)addr+%ld+_i*%ld));\n",
 				pmap(s1->name), pmap(s1->name), t->offset+off, t->width);
 		} else {
-			Bprint(&outbuf, "\tpickle_%s(bp, un, &addr->%s);\n",
+			Bprint(&outbuf, "\tbp = pickle_%s(bp, ep, un, &addr->%s);\n",
 				pmap(s1->name), pmap(s->name));
 		}
 		break;
@@ -194,10 +195,10 @@ pickletype(Type *t)
 			goto asmstr;
 		an = pmap(s->name);
 
-		Bprint(&outbuf, "void\npickle_%s(char **bp, int un, %s *addr)\n{\n\tint _i = 0;\n\n\tUSED(_i);\n", an, an);
+		Bprint(&outbuf, "char *\npickle_%s(char *bp, char *ep, int un, %s *addr)\n{\n\tint _i = 0;\n\n\tUSED(_i);\n", an, an);
 		for(l = t->link; l != T; l = l->down)
 			picklemember(l, 0);
-		Bprint(&outbuf, "}\n\n");
+		Bprint(&outbuf, "\treturn bp;\n}\n\n");
 		break;
 	asmstr:
 		if(s == S)

+ 3 - 2
sys/src/cmd/dict/mkindex.c

@@ -26,7 +26,7 @@ void
 main(int argc, char **argv)
 {
 	int i;
-	long a;
+	long a, ae;
 	char *p;
 	Entry e;
 
@@ -54,11 +54,12 @@ main(int argc, char **argv)
 	ARGEND }
 	USED(argc,argv);
 	bdict = Bopen(dict->path, OREAD);
+	ae = Bseek(bdict, 0, 2);
 	if(!bdict) {
 		err("can't open dictionary %s", dict->path);
 		exits("nodict");
 	}
-	for(a = 0; a >= 0; a = (*dict->nextoff)(a+1)) {
+	for(a = 0; a < ae; a = (*dict->nextoff)(a+1)) {
 		linelen = 0;
 		e = getentry(a);
 		Bprint(bout, "%ld\t", a);

+ 70 - 2
sys/src/cmd/disk/mbr.c

@@ -6,8 +6,23 @@
 #include <libc.h>
 #include <disk.h>
 
+typedef struct {
+	uchar	active;			/* active flag */
+	uchar	starth;			/* starting head */
+	uchar	starts;			/* starting sector */
+	uchar	startc;			/* starting cylinder */
+	uchar	type;			/* partition type */
+	uchar	endh;			/* ending head */
+	uchar	ends;			/* ending sector */
+	uchar	endc;			/* ending cylinder */
+	uchar	lba[4];			/* starting LBA */
+	uchar	size[4];		/* size in sectors */
+} Tentry;
+
 enum {
-	Toffset = 0x1BE	/* offset of partition table */
+	Toffset = 0x1BE,		/* offset of partition table */
+
+	Type9	= 0x39,
 };
 
 /*
@@ -55,17 +70,64 @@ fatal(char *fmt, ...)
 	exits(err);
 }
 
+static void
+putle32(void* v, u32int i)
+{
+	uchar *p;
+
+	p = v;
+	p[0] = i;
+	p[1] = i>>8;
+	p[2] = i>>16;
+	p[3] = i>>24;
+}
+
+static void
+writechs(Disk *disk, uchar *p, vlong lba)
+{
+	int c, h, s;
+
+	s = lba % disk->s;
+	h = (lba / disk->s) % disk->h;
+	c = lba / (disk->s * disk->h);
+
+	if(c >= 1024) {
+		c = 1023;
+		h = disk->h - 1;
+		s = disk->s - 1;
+	}
+
+	p[0] = h;
+	p[1] = ((s+1) & 0x3F) | ((c>>2) & 0xC0);
+	p[2] = c;
+}
+
+static void
+wrtentry(Disk *disk, Tentry *tp, int type, u32int base, u32int lba, u32int end)
+{
+	tp->type = type;
+	writechs(disk, &tp->starth, lba);
+	writechs(disk, &tp->endh, end-1);
+	putle32(tp->lba, lba-base);
+	putle32(tp->size, end-lba);
+}
+
 void
 main(int argc, char **argv)
 {
 	Disk *disk;
+	Tentry *tp;
 	uchar *mbr, *buf;
 	char *mbrfile;
 	ulong secsize;
-	int sysfd, nmbr;
+	int flag9, sysfd, nmbr;
 
+	flag9 = 0;
 	mbrfile = nil;
 	ARGBEGIN {
+	case '9':
+		flag9 = 1;
+		break;
 	case 'm':
 		mbrfile = ARGF();
 		break;
@@ -116,6 +178,12 @@ main(int argc, char **argv)
 		memmove(buf+Toffset, mbr+Toffset, secsize-Toffset);
 		memmove(mbr, buf, nmbr);
 	}
+
+	if(flag9){
+		tp = (Tentry*)(mbr+Toffset);
+		memset(tp, 0, secsize-Toffset);
+		wrtentry(disk, tp, Type9, 0, disk->s, disk->secs);
+	}
 	mbr[secsize-2] = 0x55;
 	mbr[secsize-1] = 0xAA;
 	nmbr = (nmbr+secsize-1)&~(secsize-1);

+ 12 - 1
sys/src/cmd/fossil/9p.c

@@ -12,6 +12,8 @@ enum {
 	PermR		= 4,
 };
 
+int fixFid;	/* clumsy hack to debug fid-in-use problems */
+
 static char EPermission[] = "permission denied";
 
 static int
@@ -800,9 +802,18 @@ rTwalk(Msg* m)
 	 */
 	nfid = nil;
 	if(t->fid != t->newfid){
+again:
 		nfid = fidGet(m->con, t->newfid, FidFWlock|FidFCreate);
 		if(nfid == nil){
-			vtSetError("fid in use");
+			if(fixFid && fixFid == t->newfid){
+				fixFid = 0;
+				nfid = fidGet(m->con, t->newfid, FidFWlock);
+				if(nfid){
+					fprint(2, "clunking in-use fid %d to appease client\n", t->newfid);
+					_rTclunk(nfid, 0);
+				}
+				goto again;
+			}
 			fidPut(ofid);
 			return 0;
 		}

+ 7 - 3
sys/src/cmd/fossil/9proc.c

@@ -193,6 +193,8 @@ msgFlush(Msg* m)
 
 	con = m->con;
 
+fprint(2, "msgFlush %F\n", &m->t);
+
 	/*
 	 * Look for the message to be flushed in the
 	 * queue of all messages still on this connection.
@@ -208,6 +210,8 @@ msgFlush(Msg* m)
 		return;
 	}
 
+fprint(2, "\tmsgFlush found %F\n", &old->t);
+
 	/*
 	 * Found it.
 	 *
@@ -402,7 +406,7 @@ msgRead(void* v)
 			continue;
 		}
 		if(Dflag)
-			fprint(2, "msgRead: t %F\n", &m->t);
+			fprint(2, "msgRead %p: t %F\n", con, &m->t);
 
 		vtLock(con->mlock);
 		if(con->mtail != nil){
@@ -453,7 +457,7 @@ _msgWrite(Msg* m)
 	 * until the 'oldtag' message goes out (see below).
 	 */
 	if(m->r.type == Rflush && m->fprev != nil){
-		fprint(2, "msgWrite: delay r %F\n", &m->r);
+		fprint(2, "msgWrite %p: delay r %F\n", con, &m->r);
 		return 0;
 	}
 
@@ -471,7 +475,7 @@ _msgWrite(Msg* m)
 		eof = 0;
 
 	if(Dflag)
-		fprint(2, "msgWrite: r %F\n", &m->r);
+		fprint(2, "msgWrite %p: r %F\n", con, &m->r);
 
 	/*
 	 * Just wrote a reply. If it has any flushes waiting

+ 21 - 0
sys/src/cmd/fossil/Ccmd.c

@@ -395,6 +395,26 @@ cmdEcho(int argc, char* argv[])
 	return 1;
 }
 
+static int
+cmdFixFid(int argc, char* argv[])
+{
+	char *usage;
+	extern int fixFid;
+
+	usage = "usage: fixfid fidnum\n";
+
+	ARGBEGIN{
+	default:
+		return cliError(usage);
+	}ARGEND
+
+	if(argc != 1)
+		return cliError(usage);
+
+	fixFid = atoi(argv[0]);
+	return 1;
+}
+
 int
 cmdInit(void)
 {
@@ -405,6 +425,7 @@ cmdInit(void)
 	cliAddCmd("9p", cmd9p);
 	cliAddCmd("dflag", cmdDflag);
 	cliAddCmd("echo", cmdEcho);
+	cliAddCmd("fixfid", cmdFixFid);
 
 	if(pipe(cbox.confd) < 0)
 		return 0;

+ 14 - 4
sys/src/cmd/fossil/cache.c

@@ -1958,10 +1958,10 @@ flushFill(Cache *c)
 	Block *b;
 
 	vtLock(c->lk);
-//	if(c->ndirty == 0){
-//		vtUnlock(c->lk);
-//		return;
-//	}
+	if(c->ndirty == 0){
+		vtUnlock(c->lk);
+		return;
+	}
 
 	p = c->baddr;
 	ndirty = 0;
@@ -2064,6 +2064,16 @@ flushThread(void *a)
 		for(i=0; i<FlushSize; i++)
 			if(!cacheFlushBlock(c))
 				break;
+		if(i==0 && c->ndirty){
+			/*
+			 * All the blocks are being written right now -- there's nothing to do.
+			 * We might be spinning with cacheFlush though -- he'll just keep
+			 * kicking us until c->ndirty goes down.  Probably we should sleep
+			 * on something that the diskThread can kick, but for now we'll
+			 * just pause for a little while waiting for disks to finish.
+			 */
+			sleep(100);
+		}
 		vtLock(c->lk);
 		vtWakeupAll(c->flushwait);
 	}

+ 5 - 5
sys/src/cmd/fossil/disk.c

@@ -268,11 +268,11 @@ diskThread(void *a)
 	for(;;){
 		while(disk->nqueue == 0){
 			t += nsec();
-if(nio >= 10000){
-fprint(2, "disk: io=%d at %.3fms\n", nio, t*1e-6/nio);
-nio = 0;
-t = 0.;
-}
+//if(nio >= 10000){
+//fprint(2, "disk: io=%d at %.3fms\n", nio, t*1e-6/nio);
+//nio = 0;
+//t = 0.;
+//}
 			if(disk->die != nil)
 				goto Done;
 			vtSleep(disk->starve);

+ 1 - 3
sys/src/cmd/ip/dhcpd/ndb.c

@@ -85,12 +85,10 @@ lookupip(uchar *ipaddr, Info *iip, int gate)
 	*p++ = "@ipgw";
 	if(!gate){
 		*p++ = "bootf";
-		*p++ = "bootf2";
 		*p++ = "@tftp";
-		*p++ = "@tftp2";
 		*p++ = "rootpath";
 		*p++ = "dhcp";
-		*p++ = "vendor";
+		*p++ = "vendorclass";
 		*p++ = "ether";
 		*p++ = "dom";
 		*p++ = "@fs";

+ 29 - 9
sys/src/cmd/ip/ppp/ppp.c

@@ -467,7 +467,7 @@ getframe(PPP *ppp, int *protop)
 			}
 		} else if(BLEN(b) > 0){
 			ppp->in.discards++;
-			netlog("ppp: len %ld/%ld cksum %ux (%ux %ux %ux %ux)\n",
+			netlog("ppp: discard len %ld/%ld cksum %ux (%ux %ux %ux %ux)\n",
 				BLEN(b), BLEN(buf), fcs, b->rptr[0],
 				b->rptr[1], b->rptr[2], b->rptr[3]);
 		}
@@ -1559,8 +1559,8 @@ ipopen(PPP *ppp)
 		/* we may have changed addresses */
 		if(ipcmp(ppp->local, ppp->curlocal) != 0 ||
 		   ipcmp(ppp->remote, ppp->curremote) != 0){
-			snprint(buf, sizeof buf, "remove %I 255.255.255.255",
-			    ppp->curremote);
+			snprint(buf, sizeof buf, "remove %I 255.255.255.255 %I",
+			    ppp->curlocal, ppp->curremote);
 			if(fprint(ppp->ipcfd, "%s", buf) < 0)
 				syslog(0, "ppp", "can't %s: %r", buf);
 			snprint(buf, sizeof buf, "add %I 255.255.255.255 %I %lud proxy",
@@ -2502,6 +2502,25 @@ xfer(int fd)
 	close(fd);
 }
 
+static int
+readcr(int fd, char *buf, int nbuf)
+{
+	char c;
+	int n, tot;
+
+	tot = 0;
+	while((n=read(fd, &c, 1)) == 1){
+		if(c == '\n'){
+			buf[tot] = 0;
+			return tot;
+		}
+		buf[tot++] = c;
+		if(tot == nbuf)
+			sysfatal("line too long in readcr");
+	}
+	return n;
+}
+
 static void
 connect(int fd, int cfd)
 {
@@ -2552,12 +2571,13 @@ connect(int fd, int cfd)
 			if (debug)
 				print("sending %s, expecting %s\n", _args[0], _args[1]);
 
-			if ((nb = write(fd, _args[0], strlen(_args[0]))) < 0)
-				sysfatal("cannot write %ss: %r", _args[0]);
-			assert(nb == strlen(_args[0]));
+			if(strlen(_args[0])){
+				nb = fprint(fd, "%s\r", _args[0]);
+				assert(nb > 0);
+			}
 
 			if (strlen(_args[1]) > 0) {
-				if ((nb = read(fd, response, sizeof response)) < 0)
+				if ((nb = readcr(fd, response, sizeof response-1)) < 0)
 					sysfatal("cannot read response from: %r");
 
 				if (debug)
@@ -2758,11 +2778,11 @@ main(int argc, char **argv)
 			fprint(cfd, "r1");	/* rts on */
 			fprint(cfd, "d1");	/* dtr on */
 			fprint(cfd, "c1");	/* dcdhup on */
-			if(user)
+			if(user || chatfile)
 				connect(mediain, cfd);
 			close(cfd);
 		} else {
-			if(user)
+			if(user || chatfile)
 				connect(mediain, -1);
 		}
 		mediaout = mediain;

+ 3 - 3
sys/src/cmd/ip/tftpd.c

@@ -160,11 +160,11 @@ doserve(int fd)
 	}
 
 	if(restricted){
-		if(strncmp(bigbuf+2, "../", 3) || strstr(bigbuf+2, "/../") ||
-		  (bigbuf[2] == '/' && strncmp(bigbuf+2, dirsl, dirsllen)!=0)){
+		if(strncmp(bigbuf+2, "../", 3) == 0 || strstr(bigbuf+2, "/../") ||
+		  (bigbuf[2] == '/' && strncmp(bigbuf+2, dirsl, dirsllen) != 0)){
 			nak(fd, 4, "Permission denied");
 			close(fd);
-			syslog(dbg, flog, "bad request %d %s", op, raddr);
+			syslog(dbg, flog, "bad request %d from %s file %s", op, raddr, bigbuf+2);
 			return;
 		}
 	}

+ 1 - 1
sys/src/cmd/lex/parser.y

@@ -632,7 +632,7 @@ freturn(int i)
 		print("now return ");
 		if(i < NCH) allprint(i);
 		else print("%d",i);
-		printf("   yylval = ");
+		print("   yylval = ");
 		switch(i){
 			case STR: case CCL: case NCCL:
 				strpt(yylval.cp);

+ 2 - 2
sys/src/cmd/lex/sub1.c

@@ -531,11 +531,11 @@ treedump(void)
 				break;
 			case RCCL:
 				print("ccl ");
-				strpt(left[t]);
+				allprint(left[t]);
 				break;
 			case RNCCL:
 				print("nccl ");
-				strpt(left[t]);
+				allprint(left[t]);
 				break;
 			case DIV:
 				print("/ %d %d",left[t],right[t]);

+ 2 - 0
sys/src/cmd/ndb/dn.c

@@ -401,6 +401,7 @@ getactivity(Request *req)
 {
 	int rv;
 
+	if(traceactivity) syslog(0, "dns", "get %d by %d", dnvars.active, getpid());
 	lock(&dnvars);
 	while(dnvars.mutex){
 		unlock(&dnvars);
@@ -419,6 +420,7 @@ putactivity(void)
 {
 	static ulong lastclean;
 
+	if(traceactivity) syslog(0, "dns", "put %d by %d", dnvars.active, getpid());
 	lock(&dnvars);
 	dnvars.active--;
 	assert(dnvars.active >= 0); /* "dnvars.active %d", dnvars.active */;

+ 2 - 0
sys/src/cmd/ndb/dns.c

@@ -62,6 +62,7 @@ struct {
 
 int	mfd[2];
 int	debug;
+int traceactivity;
 int	cachedb;
 ulong	now;
 int	testing;
@@ -120,6 +121,7 @@ main(int argc, char *argv[])
 	ARGBEGIN{
 	case 'd':
 		debug = 1;
+		traceactivity = 1;
 		break;
 	case 'f':
 		p = ARGF();

+ 1 - 0
sys/src/cmd/ndb/dns.h

@@ -381,6 +381,7 @@ extern void	mallocsanity(void*);
 extern void	lasthist(void*, int, ulong);
 
 extern int debug;
+extern int traceactivity;
 extern char	*trace;
 extern int	testing;	/* test cache whenever removing a DN */
 extern int	cachedb;

+ 1 - 1
sys/src/cmd/netstat.c

@@ -219,7 +219,7 @@ pipifc(void)
 
 	for(nip = ip; nip; nip = nip->next){
 		for(lifc = nip->lifc; lifc; lifc = lifc->next)
-			Bprint(&out, "%-12s %5d %-*I %5.5M %-*I %8lud %8lud %8lud %8lud\n",
+			Bprint(&out, "%-12s %5d %-*I %5M %-*I %8lud %8lud %8lud %8lud\n",
 				nip->dev, nip->mtu, 
 				l, lifc->ip, lifc->mask, l, lifc->net,
 				nip->pktin, nip->pktout,

+ 2 - 0
sys/src/cmd/plumb/match.c

@@ -423,6 +423,8 @@ execproc(void *v)
 	char buf[1024], *args[NARGS+1], argc[NARGCHAR];
 
 	rfork(RFFDG);
+	close(0);
+	open("/dev/null", OREAD);
 	av = v;
 	stackargv(av, args, argc);
 	free(av);

+ 5 - 2
sys/src/cmd/sam/mesg.c

@@ -398,8 +398,11 @@ inmesg(Tmesg type)
 		setgenstr(f, p0, p1);
 		for(l = 0; l<genstr.n; l++){
 			i = genstr.s[l];
-			if(utfrune(".*+?(|)\\[]^$", i))
-				Strinsert(&genstr, tmpcstr("\\"), l++);
+			if(utfrune(".*+?(|)\\[]^$", i)){
+				str = tmpcstr("\\");
+				Strinsert(&genstr, str, l++);
+				freetmpstr(str);
+			}
 		}
 		Straddc(&genstr, '\0');
 		nextmatch(f, &genstr, p1, 1);

+ 7 - 7
sys/src/cmd/seq.c

@@ -18,19 +18,19 @@ usage(void)
 void
 buildfmt(void)
 {
-	int i;
 	char *dp;
 	int w, p, maxw, maxp;
 	static char fmt[16];
 	char buf[32];
+	double val;
 
 	format = "%g\n";
 	if(!constant)
 		return;
 	maxw = 0;
 	maxp = 0;
-	for(i=0; i<=nsteps; i++){
-		sprint(buf, "%g", min+i*incr);
+	for(val = min; val <= max; val += incr){
+		sprint(buf, "%g", val);
 		if(strchr(buf, 'e')!=0)
 			return;
 		dp = strchr(buf,'.');
@@ -49,8 +49,9 @@ buildfmt(void)
 
 void
 main(int argc, char *argv[]){
-	int i, j, n;
+	int j, n;
 	char buf[256], ffmt[4096];
+	double val;
 
 	ARGBEGIN{
 	case 'w':
@@ -78,11 +79,10 @@ main(int argc, char *argv[]){
 		fprint(2, "seq: zero increment\n");
 		exits("zero increment");
 	}
-	nsteps = (max-min)/incr+.5;
 	if(!format)
 		buildfmt();
-	for(i=0; i<=nsteps; i++){
-		n = sprint(buf, format, min+i*incr);
+	for(val = min; val <= max; val += incr){
+		n = sprint(buf, format, val);
 		if(constant)
 			for(j=0; buf[j]==' '; j++)
 				buf[j] ='0';

+ 2 - 1
sys/src/cmd/tapefs/tapfs.c

@@ -53,10 +53,11 @@ populate(char *name)
 		f.size = tpp->size[0] + (tpp->size[1]<<8);
 		f.mdate = cvtime(tpp->tmod);
 		f.mode = tpp->mode[0]&0777;
+		f.uid = tpp->uid[0]&0377;
 		isabs = tpp->name[0]=='/';
 		f.name = (char *)tpp->name+isabs;
 		if (verbose)
-			print("%s mode %o, %s", f.name, f.mode, ctime(f.mdate));
+			print("%s mode %o uid %d, %s", f.name, f.mode, f.uid, ctime(f.mdate));
 		poppath(f, 1);
 	}
 }

+ 3 - 3
sys/src/cmd/upas/filterkit/deliver.c

@@ -52,7 +52,7 @@ main(int argc, char **argv)
 	now[28] = 0;
 	if(fprint(fd, "From %s %s\n", a->val, now) < 0)
 		sysfatal("writing mailbox: %r");
-	last = 0;
+	last = '\n';
 
 	/* pass all \n terminated lines.  Escape '^From ' */
 	for(bytes = 0;; bytes += n){
@@ -60,7 +60,7 @@ main(int argc, char **argv)
 		if(p == nil)
 			break;
 		n = Blinelen(&in);
-		if((last == 0 || last == '\n') && n >= 5 && strncmp(p, "From ", 5) == 0)
+		if(last == '\n' && n >= 5 && strncmp(p, "From ", 5) == 0)
 			if(write(fd, " ", 1) != 1)
 				sysfatal("writing mailbox: %r");
 		if(write(fd, p, n) != n){
@@ -75,7 +75,7 @@ main(int argc, char **argv)
 		n = Bread(&in, buf, sizeof(buf));
 		if(n <= 0)
 			break;
-		if((last == 0 || last == '\n') && n >= 5 && strncmp(buf, "From ", 5) == 0)
+		if(last == '\n' && n >= 5 && strncmp(buf, "From ", 5) == 0)
 			if(write(fd, " ", 1) != 1)
 				sysfatal("writing mailbox: %r");
 		if(write(fd, buf, n) != n){

+ 38 - 6
sys/src/cmd/upas/fs/pop3.c

@@ -21,6 +21,7 @@ struct Pop {
 	int pipeline;
 	int hastls;
 	int needtls;
+	int notls;
 
 	// open network connection
 	Biobuf bin;
@@ -78,8 +79,14 @@ pop3resp(Pop *pop)
 	char *s;
 	char *p;
 
-	if((s = Brdline(&pop->bin, '\n')) == nil)
+	alarm(60*1000);
+	if((s = Brdline(&pop->bin, '\n')) == nil){
+		close(pop->fd);
+		pop->fd = -1;
+		alarm(0);
 		return "unexpected eof";
+	}
+	alarm(0);
 
 	p = s+Blinelen(&pop->bin)-1;
 	while(p >= s && (*p == '\r' || *p == '\n'))
@@ -129,7 +136,7 @@ pop3capa(Pop *pop)
 			pop->pipeline = 1;
 	}
 
-	if(hastls){
+	if(hastls && !pop->notls){
 		pop3cmd(pop, "STLS");
 		if(!isokay(s = pop3resp(pop)))
 			return s;
@@ -486,11 +493,33 @@ pop3purge(Pop *pop, Mailbox *mb)
 {
 	Message *m, *next;
 
+	if(pop->pipeline){
+		switch(rfork(RFPROC|RFMEM)){
+		case -1:
+			fprint(2, "rfork: %r\n");
+			pop->pipeline = 0;
+
+		default:
+			break;
+
+		case 0:
+			for(m = mb->root->part; m != nil; m = next){
+				next = m->next;
+				if(m->deleted && m->refs == 0){
+					if(m->inmbox)
+						Bprint(&pop->bout, "DELE %d\r\n", m->mesgno);
+				}
+			}
+			Bflush(&pop->bout);
+			_exits(nil);
+		}
+	}
 	for(m = mb->root->part; m != nil; m = next) {
 		next = m->next;
 		if(m->deleted && m->refs == 0) {
 			if(m->inmbox) {
-				pop3cmd(pop, "DELE %d", m->mesgno);
+				if(!pop->pipeline)
+					pop3cmd(pop, "DELE %d", m->mesgno);
 				if(isokay(pop3resp(pop)))
 					delmessage(mb, m);
 			} else
@@ -585,14 +614,16 @@ char*
 pop3mbox(Mailbox *mb, char *path)
 {
 	char *f[10];
-	int nf, apop, ppop, apoptls, poptls;
+	int nf, apop, ppop, apoptls, popnotls, apopnotls, poptls;
 	Pop *pop;
 
 	quotefmtinstall();
 	poptls = strncmp(path, "/poptls/", 8) == 0;
-	ppop = poptls || strncmp(path, "/pop/", 5) == 0;
+	popnotls = strncmp(path, "/popnotls/", 10) == 0;
+	ppop = poptls || popnotls || strncmp(path, "/pop/", 5) == 0;
 	apoptls = strncmp(path, "/apoptls/", 9) == 0;
-	apop = apoptls || strncmp(path, "/apop/", 6) == 0;
+	apopnotls = strncmp(path, "/apopnotls/", 11) == 0;
+	apop = apoptls || apopnotls || strncmp(path, "/apop/", 6) == 0;
 	
 	if(!ppop && !apop)
 		return Enotme;
@@ -617,6 +648,7 @@ pop3mbox(Mailbox *mb, char *path)
 	pop->ppop = ppop;
 	pop->needtls = poptls || apoptls;
 	pop->refreshtime = 60;
+	pop->notls = popnotls || apopnotls;
 	pop->thumb = initThumbprints("/sys/lib/tls/mail", "/sys/lib/tls/mail.exclude");
 
 	mb->aux = pop;

+ 39 - 7
sys/src/cmd/upas/ml/ml.c

@@ -8,8 +8,9 @@ int na;
 String *from;
 String *sender;
 
-void printmsg(int fd, String *msg, char *replyto);
+void printmsg(int fd, String *msg, char *replyto, char *listname);
 void appendtoarchive(char* listname, String *firstline, String *msg);
+void printsubject(int fd, Field *f, char *listname);
 
 void
 usage(void)
@@ -55,8 +56,9 @@ main(int argc, char **argv)
 	if(s_read_line(&in, firstline) == nil)
 		sysfatal("reading input: %r");
 
-	/* read up to the first 128k of the message.  more is redculous */
-	if(s_read(&in, msg, 128*1024) <= 0)
+	/* read up to the first 128k of the message.  more is redculous. 
+	     Not if word documents are distributed.  Upped it to 2MB (pb) */
+	if(s_read(&in, msg, 2*1024*1024) <= 0)
 		sysfatal("reading input: %r");
 
 	/* parse the header */
@@ -77,7 +79,7 @@ main(int argc, char **argv)
 	fd = startmailer(listname);
 
 	/* send message adding our own reply-to and precedence */
-	printmsg(fd, msg, replytoname);
+	printmsg(fd, msg, replytoname, listname);
 	close(fd);
 
 	/* wait for mailer to end */
@@ -94,14 +96,14 @@ main(int argc, char **argv)
 
 /* send message filtering Reply-to out of messages */
 void
-printmsg(int fd, String *msg, char *replyto)
+printmsg(int fd, String *msg, char *replyto, char *listname)
 {
-	Field *f;
+	Field *f, *subject;
 	Node *p;
 	char *cp, *ocp;
 
+	subject = nil;
 	cp = s_to_c(msg);
-	fprint(fd, "Reply-To: %s\nPrecedence: bulk\n", replyto);
 	for(f = firstfield; f; f = f->next){
 		ocp = cp;
 		for(p = f->node; p; p = p->next)
@@ -110,8 +112,14 @@ printmsg(int fd, String *msg, char *replyto)
 			continue;
 		if(f->node->c == PRECEDENCE)
 			continue;
+		if(f->node->c == SUBJECT){
+			subject = f;
+			continue;
+		}
 		write(fd, ocp, cp-ocp);
 	}
+	printsubject(fd, subject, listname);
+	fprint(fd, "Reply-To: %s\nPrecedence: bulk\n", replyto);
 	write(fd, cp, s_len(msg) - (cp - s_to_c(msg)));
 }
 
@@ -133,3 +141,27 @@ appendtoarchive(char* listname, String *firstline, String *msg)
 	write(fd, s_to_c(firstline), s_len(firstline));
 	write(fd, s_to_c(msg), s_len(msg));
 }
+
+/* add the listname to the subject */
+void
+printsubject(int fd, Field *f, char *listname)
+{
+	char *s, *e;
+	Node *p;
+	char *ln;
+
+	if(f == nil || f->node == nil){
+		fprint(fd, "Subject: [%s]\n", listname);
+		return;
+	}
+	s = e = f->node->end + 1;
+	for(p = f->node; p; p = p->next)
+		e = p->end;
+	*e = 0;
+	ln = smprint("[%s]", listname);
+	if(ln != nil && strstr(s, ln) == nil)
+		fprint(fd, "Subject: %s%s\n", ln, s);
+	else
+		fprint(fd, "Subject:%s\n", s);
+	free(ln);
+}

+ 22 - 7
sys/src/cmd/upas/pop3/pop3.c

@@ -24,6 +24,7 @@ static int retrcmd(char*);
 static int statcmd(char*);
 static int stlscmd(char*);
 static int topcmd(char*);
+static int synccmd(char*);
 static int uidlcmd(char*);
 static int usercmd(char*);
 static char *nextarg(char*);
@@ -49,6 +50,7 @@ Cmd cmdtab[] =
 	"retr", 1, retrcmd,
 	"stat", 1, statcmd,
 	"stls", 0, stlscmd,
+	"sync", 1, synccmd,
 	"top", 1, topcmd,
 	"uidl", 1, uidlcmd,
 	"user", 0, usercmd,
@@ -437,8 +439,8 @@ noopcmd(char *arg)
 	return 0;
 }
 
-static int
-quitcmd(char*)
+static void
+_synccmd(char*)
 {
 	int i, fd;
 	char *s;
@@ -446,7 +448,7 @@ quitcmd(char*)
 
 	if(!loggedin){
 		sendok("");
-		exits(nil);
+		return;
 	}
 
 	fmtstrinit(&f);
@@ -458,16 +460,29 @@ quitcmd(char*)
 	if(strcmp(s, "delete mbox") != 0){	/* must have something to delete */
 		if((fd = open("../ctl", OWRITE)) < 0){
 			senderr("open ctl to delete messages: %r");
-			exits(nil);
+			return;
 		}
 		if(write(fd, s, strlen(s)) < 0){
 			senderr("error deleting messages: %r");
-			exits(nil);
+			return;
 		}
 	}
 	sendok("");
-	exits(nil);	
-	return 0;		
+}
+
+static int
+synccmd(char*)
+{
+	_synccmd(nil);
+	return 0;
+}
+
+static int
+quitcmd(char*)
+{
+	synccmd(nil);
+	exits(nil);
+	return 0;
 }
 
 static int

+ 2 - 2
sys/src/cmd/venti/arenas.c

@@ -337,8 +337,8 @@ wbArenaMap(AMap *am, int n, Part *part, u64int base, u64int size)
 /*
  * amap: n '\n' amapelem * n
  * n: u32int
- * amapelem: name '\t' astart '\t' asize '\n'
- * astart, asize: u64int
+ * amapelem: name '\t' astart '\t' astop '\n'
+ * astart, astop: u64int
  */
 int
 parseAMap(IFile *f, AMapN *amn)

+ 1 - 1
sys/src/cmd/venti/config.c

@@ -62,7 +62,7 @@ numOk(char *s)
  *		| "httpaddr" address
  *		| "addr" address
  *
- * '#' and \n delimate comments
+ * '#' and \n delimit comments
  */
 enum
 {

+ 1 - 1
sys/src/cmd/venti/findscore.c

@@ -127,7 +127,7 @@ main(int argc, char *argv[])
 	for(i = 0; i < ap->narenas; i++)
 		found += findscore(ap->arenas[i], score);
 
-	print("found %d occurances of %V\n", found, score);
+	print("found %d occurences of %V\n", found, score);
 
 	if(verbose > 1)
 		printStats();

+ 7 - 3
sys/src/cmd/venti/sortientry.c

@@ -75,8 +75,8 @@ sortRawIEntries(Index *ix, Part *tmp, u64int *base)
 		}
 		clumps += n;
 	}
-fprint(2, "got %lld clumps - starting sort\n", clumps);
 	if(ok){
+fprint(2, "got %lld clumps - starting sort\n", clumps);
 		sorted = sortIEBucks(ib);
 		*base = (u64int)ib->chunks * ib->size;
 		if(sorted != clumps){
@@ -110,7 +110,7 @@ readArenaInfo(IEBucks *ib, Arena *arena, u64int a)
 	cis = MKN(ClumpInfo, ClumpChunks);
 	ok = 1;
 	memset(&ie, 0, sizeof(IEntry));
-	for(clump = 0; clump < arena->clumps; clump += n){
+	for(clump = 0; clump < arena->clumps && ok; clump += n){
 		n = ClumpChunks;
 		if(n > arena->clumps - clump)
 			n = arena->clumps - clump;
@@ -128,7 +128,11 @@ readArenaInfo(IEBucks *ib, Arena *arena, u64int a)
 			a += ci->size + ClumpSize;
 			ie.ia.blocks = (ci->size + ClumpSize + (1 << ABlockLog) - 1) >> ABlockLog;
 			scoreCp(ie.score, ci->score);
-			sprayIEntry(ib, &ie);
+			if(!sprayIEntry(ib, &ie)){
+				setErr(EOk, "can't put entry into bucket: %R");
+				ok = 0;
+				break;
+			}
 		}
 	}
 	free(cis);

+ 5 - 10
sys/src/cmd/venti/utils.c

@@ -187,19 +187,14 @@ void
 fatal(char *fmt, ...)
 {
 	Fmt f;
+	va_list arg;
 	char buf[256];
 
-	f.runes = 0;
-	f.start = buf;
-	f.to = buf;
-	f.stop = buf + sizeof(buf);
-	f.flush = fmtfdflush;
-	f.farg = (void*)2;
-	f.nfmt = 0;
+	fmtfdinit(&f, 2, buf, sizeof buf);
 	fmtprint(&f, "fatal %s error:", argv0);
-	va_start(f.args, fmt);
-	dofmt(&f, fmt);
-	va_end(f.args);
+	va_start(arg, fmt);
+	fmtprint(&f, fmt, arg);
+	va_end(arg);
 	fmtprint(&f, "\n");
 	fmtfdflush(&f);
 	if(0)

Some files were not shown because too many files changed in this diff