Browse Source

Plan 9 from Bell Labs 2005-12-12

David du Colombier 15 years ago
parent
commit
a32296d415
55 changed files with 980 additions and 430 deletions
  1. 52 51
      dist/replica/_plan9.db
  2. 52 51
      dist/replica/plan9.db
  3. 63 0
      dist/replica/plan9.log
  4. 19 3
      sys/include/9p.h
  5. 9 4
      sys/man/1/calendar
  6. 31 16
      sys/man/1/cb
  7. 11 11
      sys/man/1/cmp
  8. 1 2
      sys/man/1/colors
  9. 5 5
      sys/man/1/con
  10. 26 0
      sys/man/2/9p
  11. 1 1
      sys/src/cmd/5l/obj.c
  12. 1 1
      sys/src/cmd/9660srv/main.c
  13. 6 5
      sys/src/cmd/aux/consolefs.c
  14. 1 1
      sys/src/cmd/aux/depend.c
  15. 1 1
      sys/src/cmd/calendar.c
  16. 3 0
      sys/src/cmd/cc/cc.h
  17. 9 0
      sys/src/cmd/cc/cc.y
  18. 184 2
      sys/src/cmd/cc/com.c
  19. 19 20
      sys/src/cmd/cc/lex.c
  20. 2 0
      sys/src/cmd/cc/scon.c
  21. 5 0
      sys/src/cmd/cc/sub.c
  22. 3 3
      sys/src/cmd/cfs/cfs.c
  23. 1 1
      sys/src/cmd/cfs/disk.c
  24. 1 1
      sys/src/cmd/cmp.c
  25. 1 1
      sys/src/cmd/con/con.c
  26. 1 1
      sys/src/cmd/cpu.c
  27. 6 4
      sys/src/cmd/db/format.c
  28. 1 1
      sys/src/cmd/db/runpcs.c
  29. 1 1
      sys/src/cmd/disk/format.c
  30. 1 1
      sys/src/cmd/disk/kfs/ofcallfmt.c
  31. 1 1
      sys/src/cmd/ext2srv/ext2subs.c
  32. 1 1
      sys/src/cmd/fossil/9fsys.c
  33. 0 3
      sys/src/cmd/iostats/iostats.c
  34. 1 1
      sys/src/cmd/ip/ftpd.c
  35. 0 6
      sys/src/cmd/ndb/cs.c
  36. 0 4
      sys/src/cmd/ndb/dns.c
  37. 1 1
      sys/src/cmd/ql/obj.c
  38. 1 1
      sys/src/cmd/scat/scat.c
  39. 1 1
      sys/src/cmd/srvold9p/9p1lib.c
  40. 1 1
      sys/src/cmd/tweak.c
  41. 3 2
      sys/src/cmd/vac/vacfs.c
  42. 2 6
      sys/src/cmd/vnc/devdraw.c
  43. 0 83
      sys/src/cmd/wikifs/fs.c
  44. 0 77
      sys/src/lib9p/_post.c
  45. 198 0
      sys/src/lib9p/auth.c
  46. 103 0
      sys/src/lib9p/listen.c
  47. 5 3
      sys/src/lib9p/mkfile
  48. 60 13
      sys/src/lib9p/post.c
  49. 0 13
      sys/src/lib9p/post.h
  50. 10 3
      sys/src/lib9p/ramfs.c
  51. 34 0
      sys/src/lib9p/rfork.c
  52. 15 3
      sys/src/lib9p/srv.c
  53. 25 0
      sys/src/lib9p/thread.c
  54. 0 18
      sys/src/lib9p/tpost.c
  55. 1 1
      sys/src/libc/9sys/fcallfmt.c

+ 52 - 51
dist/replica/_plan9.db

@@ -15,7 +15,7 @@
 386/_9pcdisk.gz - 664 sys sys 1039764191 695837
 386/bin - 20000000775 sys sys 1018897690 0
 386/bin/8a - 775 sys sys 1132506823 116045
-386/bin/8c - 775 sys sys 1132603401 358647
+386/bin/8c - 775 sys sys 1134321928 362166
 386/bin/8l - 775 sys sys 1130384229 115712
 386/bin/9660srv - 775 sys sys 1130594690 104069
 386/bin/aan - 775 sys sys 1130594690 130742
@@ -5941,7 +5941,7 @@ sys/games/lib/sudoku/images/8.bit - 664 sys sys 1117226542 528
 sys/games/lib/sudoku/images/9.bit - 664 sys sys 1117226542 537
 sys/games/sudoku - 20000000775 sys sys 1117225532 0
 sys/include - 20000000775 sys sys 1016902416 0
-sys/include/9p.h - 664 sys sys 1130649668 4420
+sys/include/9p.h - 664 sys sys 1134337548 4759
 sys/include/String.h - 664 sys sys 1091904425 1319
 sys/include/a.out.h - 664 sys sys 1131293220 1407
 sys/include/ape - 20000000775 sys sys 1014927784 0
@@ -7249,16 +7249,16 @@ sys/man/1/bind - 664 sys sys 1034195345 3928
 sys/man/1/bitsyload - 664 sys sys 988225301 2883
 sys/man/1/bundle - 664 sys sys 1113743325 986
 sys/man/1/cal - 664 sys sys 1113743325 849
-sys/man/1/calendar - 664 sys sys 1104939769 1249
+sys/man/1/calendar - 664 sys sys 1134330265 1294
 sys/man/1/cat - 664 sys sys 1113743325 1338
-sys/man/1/cb - 664 sys sys 1063855627 896
+sys/man/1/cb - 664 sys sys 1134330484 785
 sys/man/1/chgrp - 664 sys sys 944959673 710
 sys/man/1/chmod - 664 sys sys 1079372922 1299
 sys/man/1/cleanname - 664 sys sys 944959674 580
-sys/man/1/cmp - 664 sys sys 944959673 1092
-sys/man/1/colors - 664 sys sys 954523212 1443
+sys/man/1/cmp - 664 sys sys 1134330626 1069
+sys/man/1/colors - 664 sys sys 1134330626 1438
 sys/man/1/comm - 664 sys sys 944959675 665
-sys/man/1/con - 664 sys sys 1071156278 4318
+sys/man/1/con - 664 sys sys 1134330721 4306
 sys/man/1/cp - 664 sys sys 1110816882 1947
 sys/man/1/cpp - 664 sys sys 944959674 2105
 sys/man/1/cpu - 664 sys sys 1128483118 3804
@@ -7388,7 +7388,7 @@ sys/man/1/yacc - 664 sys sys 944959676 3273
 sys/man/1/yesterday - 664 sys sys 1070288431 2348
 sys/man/2 - 20000000775 sys sys 1017423721 0
 sys/man/2/0intro - 664 sys sys 1115941566 11660
-sys/man/2/9p - 664 sys sys 1106291974 15232
+sys/man/2/9p - 664 sys sys 1134335896 15859
 sys/man/2/9pcmdbuf - 664 sys sys 1044430197 2057
 sys/man/2/9pfid - 664 sys sys 1106072437 3663
 sys/man/2/9pfile - 664 sys sys 1048637158 4408
@@ -8115,7 +8115,7 @@ sys/src/9/port/qlock.c - 664 sys sys 1067722765 3196
 sys/src/9/port/rdb.c - 664 sys sys 1018721202 1698
 sys/src/9/port/rebootcmd.c - 664 sys sys 1015278340 1561
 sys/src/9/port/sd.h - 664 sys sys 1131289990 2494
-sys/src/9/port/segment.c - 664 sys sys 1131298540 13722
+sys/src/9/port/segment.c - 664 sys sys 1134276516 13762
 sys/src/9/port/swap.c - 664 sys sys 1055688551 6980
 sys/src/9/port/sysfile.c - 664 sys sys 1134042952 22178
 sys/src/9/port/sysproc.c - 664 sys sys 1134042973 15146
@@ -9157,7 +9157,7 @@ sys/src/cmd/5l/l.s - 664 sys sys 944960727 454
 sys/src/cmd/5l/list.c - 664 sys sys 1014924786 5849
 sys/src/cmd/5l/mkfile - 664 sys sys 944960727 288
 sys/src/cmd/5l/noop.c - 664 sys sys 1089299172 8989
-sys/src/cmd/5l/obj.c - 664 sys sys 1089299173 25833
+sys/src/cmd/5l/obj.c - 664 sys sys 1134305456 25819
 sys/src/cmd/5l/optab.c - 664 sys sys 1014924786 10071
 sys/src/cmd/5l/pass.c - 664 sys sys 1089299173 10297
 sys/src/cmd/5l/sched.c - 664 sys sys 1014936032 10641
@@ -9235,7 +9235,7 @@ sys/src/cmd/9660srv/data.c - 664 sys sys 944960735 373
 sys/src/cmd/9660srv/fns.h - 664 sys sys 1019425186 428
 sys/src/cmd/9660srv/iobuf.c - 664 sys sys 1128255068 3126
 sys/src/cmd/9660srv/iso9660.h - 664 sys sys 1014924873 2607
-sys/src/cmd/9660srv/main.c - 664 sys sys 1020313483 9680
+sys/src/cmd/9660srv/main.c - 664 sys sys 1134305455 9664
 sys/src/cmd/9660srv/mkfile - 664 sys sys 1048644372 238
 sys/src/cmd/9660srv/xfile.c - 664 sys sys 1113742177 2736
 sys/src/cmd/9nfs - 20000000775 sys sys 1015090374 0
@@ -9524,10 +9524,10 @@ sys/src/cmd/aux/apm.c - 664 sys sys 1130423972 20275
 sys/src/cmd/aux/astarld.c - 664 sys sys 1015008684 4638
 sys/src/cmd/aux/cddb.c - 664 sys sys 1126795279 4610
 sys/src/cmd/aux/clog.c - 664 sys sys 1014925109 1000
-sys/src/cmd/aux/consolefs.c - 664 sys sys 1123094543 20187
+sys/src/cmd/aux/consolefs.c - 664 sys sys 1134305455 20200
 sys/src/cmd/aux/conswdir.c - 664 sys sys 1045504955 2077
 sys/src/cmd/aux/data2s.c - 664 sys sys 1032059295 796
-sys/src/cmd/aux/depend.c - 664 sys sys 1132451758 25875
+sys/src/cmd/aux/depend.c - 664 sys sys 1134305455 25880
 sys/src/cmd/aux/disksim.c - 664 sys sys 1073852076 10914
 sys/src/cmd/aux/flashfs - 20000000775 sys sys 1015009082 0
 sys/src/cmd/aux/flashfs/aux.c - 664 sys sys 1015009080 699
@@ -9717,7 +9717,7 @@ sys/src/cmd/bzip2/lib/randtable.c - 664 sys sys 964847967 5473
 sys/src/cmd/bzip2/lib/unix.h - 664 sys sys 964847967 136
 sys/src/cmd/bzip2/mkfile - 664 sys sys 969510789 881
 sys/src/cmd/cal.c - 664 sys sys 944961619 4206
-sys/src/cmd/calendar.c - 664 sys sys 1116769436 4221
+sys/src/cmd/calendar.c - 664 sys sys 1134330186 4227
 sys/src/cmd/cat.c - 664 sys sys 1014926693 532
 sys/src/cmd/cb - 20000000775 sys sys 1062860425 0
 sys/src/cmd/cb/cb.c - 664 sys sys 1130594748 18532
@@ -9728,24 +9728,24 @@ sys/src/cmd/cb/mkfile - 664 sys sys 1062860425 172
 sys/src/cmd/cc - 20000000775 sys sys 1018556175 0
 sys/src/cmd/cc/acid.c - 664 sys sys 944960808 5314
 sys/src/cmd/cc/bits.c - 664 sys sys 944960873 850
-sys/src/cmd/cc/cc.h - 664 sys sys 1131110443 12071
-sys/src/cmd/cc/cc.y - 664 sys sys 1076969746 15801
-sys/src/cmd/cc/com.c - 664 sys sys 1089299183 18909
+sys/src/cmd/cc/cc.h - 664 sys sys 1134321729 12122
+sys/src/cmd/cc/cc.y - 664 sys sys 1134321719 16058
+sys/src/cmd/cc/com.c - 664 sys sys 1134321739 22202
 sys/src/cmd/cc/com64.c - 664 sys sys 1089299182 9975
 sys/src/cmd/cc/compat - 664 sys sys 1014925177 684
 sys/src/cmd/cc/compat.c - 664 sys sys 1132451523 454
 sys/src/cmd/cc/dcl.c - 664 sys sys 1132595282 26815
 sys/src/cmd/cc/dpchk.c - 664 sys sys 1107365037 7152
 sys/src/cmd/cc/funct.c - 664 sys sys 984718510 6167
-sys/src/cmd/cc/lex.c - 664 sys sys 1131293446 23883
+sys/src/cmd/cc/lex.c - 664 sys sys 1134321742 23923
 sys/src/cmd/cc/lexbody - 664 sys sys 1131293457 9188
 sys/src/cmd/cc/mac.c - 664 sys sys 944960808 36
 sys/src/cmd/cc/macbody - 664 sys sys 1108281581 11703
 sys/src/cmd/cc/machcap.c - 664 sys sys 1084472048 78
 sys/src/cmd/cc/mkfile - 664 sys sys 1107365240 563
 sys/src/cmd/cc/pickle.c - 664 sys sys 1063855374 4829
-sys/src/cmd/cc/scon.c - 664 sys sys 1089343502 8606
-sys/src/cmd/cc/sub.c - 664 sys sys 1131110436 34138
+sys/src/cmd/cc/scon.c - 664 sys sys 1134321732 8645
+sys/src/cmd/cc/sub.c - 664 sys sys 1134321729 34315
 sys/src/cmd/cc/y.tab.c - 664 sys sys 1098501521 53564
 sys/src/cmd/cc/y.tab.h - 664 sys sys 1098501521 1680
 sys/src/cmd/cdfs - 20000000775 sys sys 959922196 0
@@ -9759,8 +9759,8 @@ sys/src/cmd/cfs - 20000000775 sys sys 1015009266 0
 sys/src/cmd/cfs/bcache.c - 664 sys sys 1014925219 2956
 sys/src/cmd/cfs/bcache.h - 664 sys sys 1014925220 797
 sys/src/cmd/cfs/cformat.h - 664 sys sys 1014925220 1404
-sys/src/cmd/cfs/cfs.c - 664 sys sys 1045505024 16548
-sys/src/cmd/cfs/disk.c - 664 sys sys 1014925220 5942
+sys/src/cmd/cfs/cfs.c - 664 sys sys 1134305455 16526
+sys/src/cmd/cfs/disk.c - 664 sys sys 1134305455 5949
 sys/src/cmd/cfs/disk.h - 664 sys sys 1014925220 467
 sys/src/cmd/cfs/file.c - 664 sys sys 944960876 5124
 sys/src/cmd/cfs/file.h - 664 sys sys 944960876 225
@@ -9775,11 +9775,11 @@ sys/src/cmd/chgrp.c - 664 sys sys 1014926580 624
 sys/src/cmd/chmod.c - 664 sys sys 1079372923 1904
 sys/src/cmd/cleanname.c - 664 sys sys 944960760 715
 sys/src/cmd/clock.c - 664 sys sys 1014925410 1881
-sys/src/cmd/cmp.c - 664 sys sys 1072145760 2379
+sys/src/cmd/cmp.c - 664 sys sys 1134330528 2379
 sys/src/cmd/colors.c - 664 sys sys 951763912 3186
 sys/src/cmd/comm.c - 664 sys sys 1093979717 2140
 sys/src/cmd/con - 20000000775 sys sys 944961996 0
-sys/src/cmd/con/con.c - 664 sys sys 1121977158 15235
+sys/src/cmd/con/con.c - 664 sys sys 1134330724 15237
 sys/src/cmd/con/hayes.c - 664 sys sys 1014925263 3865
 sys/src/cmd/con/mkfile - 664 sys sys 1046654774 204
 sys/src/cmd/con/rufilio.h - 664 sys sys 944960877 595
@@ -9801,7 +9801,7 @@ sys/src/cmd/cpp/mkfile - 664 sys sys 944960879 178
 sys/src/cmd/cpp/nlist.c - 664 sys sys 1116770041 4645
 sys/src/cmd/cpp/test.c - 664 sys sys 944960879 47
 sys/src/cmd/cpp/tokens.c - 664 sys sys 944960879 6755
-sys/src/cmd/cpu.c - 664 sys sys 1123676384 21128
+sys/src/cmd/cpu.c - 664 sys sys 1134305456 21135
 sys/src/cmd/crop.c - 664 sys sys 1039753034 4136
 sys/src/cmd/date.c - 664 sys sys 944961351 449
 sys/src/cmd/db - 20000000775 sys sys 988249965 0
@@ -9809,7 +9809,7 @@ sys/src/cmd/db/command.c - 664 sys sys 1131297926 4377
 sys/src/cmd/db/defs.h - 664 sys sys 1131292957 1700
 sys/src/cmd/db/expr.c - 664 sys sys 1131292957 5441
 sys/src/cmd/db/fns.h - 664 sys sys 1131297926 2014
-sys/src/cmd/db/format.c - 664 sys sys 1131297926 6868
+sys/src/cmd/db/format.c - 664 sys sys 1134305455 6878
 sys/src/cmd/db/input.c - 664 sys sys 1016731556 2194
 sys/src/cmd/db/main.c - 664 sys sys 1016731556 3308
 sys/src/cmd/db/mkfile - 664 sys sys 944960880 233
@@ -9817,7 +9817,7 @@ sys/src/cmd/db/output.c - 664 sys sys 1014925293 2009
 sys/src/cmd/db/pcs.c - 664 sys sys 1016731557 2859
 sys/src/cmd/db/print.c - 664 sys sys 1131297926 5949
 sys/src/cmd/db/regs.c - 664 sys sys 1131297926 1998
-sys/src/cmd/db/runpcs.c - 664 sys sys 1014925293 2929
+sys/src/cmd/db/runpcs.c - 664 sys sys 1134305454 2928
 sys/src/cmd/db/setup.c - 664 sys sys 1014925293 3581
 sys/src/cmd/db/trcrun.c - 664 sys sys 1131297926 4433
 sys/src/cmd/dc.c - 664 sys sys 1121977159 36572
@@ -9888,7 +9888,7 @@ sys/src/cmd/disk/9660/unix.c - 664 sys sys 984788373 1352
 sys/src/cmd/disk/9660/util.c - 664 sys sys 1017679315 1294
 sys/src/cmd/disk/9660/write.c - 664 sys sys 1077376396 8836
 sys/src/cmd/disk/exsort.c - 664 sys sys 944960885 1964
-sys/src/cmd/disk/format.c - 664 sys sys 1116595013 17648
+sys/src/cmd/disk/format.c - 664 sys sys 1134305454 17649
 sys/src/cmd/disk/kfs - 20000000775 sys sys 1019072794 0
 sys/src/cmd/disk/kfs/9p1.c - 664 sys sys 1065916867 25359
 sys/src/cmd/disk/kfs/9p1.h - 664 sys sys 1091904426 2220
@@ -9912,7 +9912,7 @@ sys/src/cmd/disk/kfs/iobuf.c - 664 sys sys 1015009189 3769
 sys/src/cmd/disk/kfs/main.c - 664 sys sys 1106924274 9515
 sys/src/cmd/disk/kfs/misc.c - 664 sys sys 1015009189 1182
 sys/src/cmd/disk/kfs/mkfile - 664 sys sys 1065916865 717
-sys/src/cmd/disk/kfs/ofcallfmt.c - 664 sys sys 1015009189 4674
+sys/src/cmd/disk/kfs/ofcallfmt.c - 664 sys sys 1134305454 4681
 sys/src/cmd/disk/kfs/portdat.h - 664 sys sys 1082221137 6055
 sys/src/cmd/disk/kfs/portfns.h - 664 sys sys 1020313861 2804
 sys/src/cmd/disk/kfs/porttime.c - 664 sys sys 1015009190 3922
@@ -9998,7 +9998,7 @@ sys/src/cmd/execnet/note.c - 664 sys sys 1019855740 2315
 sys/src/cmd/exportfs - 20000000775 sys sys 988249971 0
 sys/src/cmd/exportfs/exportfs.c - 664 sys sys 1115314269 16357
 sys/src/cmd/exportfs/exportfs.h - 664 sys sys 1066823091 2800
-sys/src/cmd/exportfs/exportsrv.c - 664 sys sys 1081082332 11914
+sys/src/cmd/exportfs/exportsrv.c - 664 sys sys 1134316119 11914
 sys/src/cmd/exportfs/mkfile - 664 sys sys 1066825703 194
 sys/src/cmd/exportfs/pattern.c - 664 sys sys 1066823092 2960
 sys/src/cmd/ext2srv - 20000000775 sys sys 1055687763 0
@@ -10007,7 +10007,7 @@ sys/src/cmd/ext2srv/dat.h - 664 sys sys 1055687746 5275
 sys/src/cmd/ext2srv/errstr.h - 664 sys sys 1055687747 565
 sys/src/cmd/ext2srv/ext2fs.c - 664 sys sys 1055687747 6063
 sys/src/cmd/ext2srv/ext2srv.man - 664 sys sys 1055687747 2409
-sys/src/cmd/ext2srv/ext2subs.c - 664 sys sys 1055687747 38701
+sys/src/cmd/ext2srv/ext2subs.c - 664 sys sys 1134305454 38683
 sys/src/cmd/ext2srv/fns.h - 664 sys sys 1055687748 1803
 sys/src/cmd/ext2srv/iobuf.c - 664 sys sys 1055687748 2854
 sys/src/cmd/ext2srv/mkfile - 664 sys sys 1055687748 194
@@ -10047,7 +10047,7 @@ sys/src/cmd/fossil/9auth.c - 664 sys sys 1061530721 3393
 sys/src/cmd/fossil/9dir.c - 664 sys sys 1085333382 2219
 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 1128255102 33313
+sys/src/cmd/fossil/9fsys.c - 664 sys sys 1134305453 33320
 sys/src/cmd/fossil/9lstn.c - 664 sys sys 1042005503 2865
 sys/src/cmd/fossil/9p.c - 664 sys sys 1104940048 21862
 sys/src/cmd/fossil/9ping.c - 664 sys sys 1042005503 1563
@@ -11912,7 +11912,7 @@ sys/src/cmd/idiff.c - 664 sys sys 1014926695 6896
 sys/src/cmd/import.c - 664 sys sys 1133180705 7028
 sys/src/cmd/init.c - 664 sys sys 1121977160 4462
 sys/src/cmd/iostats - 20000000775 sys sys 944962001 0
-sys/src/cmd/iostats/iostats.c - 664 sys sys 1127431876 9669
+sys/src/cmd/iostats/iostats.c - 664 sys sys 1134305453 9616
 sys/src/cmd/iostats/mkfile - 664 sys sys 1014925727 122
 sys/src/cmd/iostats/statfs.h - 664 sys sys 1127431876 2617
 sys/src/cmd/iostats/statsrv.c - 664 sys sys 1127431876 10745
@@ -11931,7 +11931,7 @@ 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
 sys/src/cmd/ip/dhcpd/testping.c - 664 sys sys 950389141 352
-sys/src/cmd/ip/ftpd.c - 664 sys sys 1121977160 33081
+sys/src/cmd/ip/ftpd.c - 664 sys sys 1134305453 33088
 sys/src/cmd/ip/ftpfs - 20000000775 sys sys 1014925642 0
 sys/src/cmd/ip/ftpfs/file.c - 664 sys sys 1014925642 4208
 sys/src/cmd/ip/ftpfs/ftpfs.c - 664 sys sys 1116737713 13860
@@ -12259,7 +12259,7 @@ sys/src/cmd/mv.c - 664 sys sys 1126278115 4241
 sys/src/cmd/ndb - 20000000775 sys sys 988249988 0
 sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1119276409 6866
 sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1060612175 7248
-sys/src/cmd/ndb/cs.c - 664 sys sys 1128706486 33223
+sys/src/cmd/ndb/cs.c - 664 sys sys 1134305453 33083
 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 1123602793 18275
@@ -12267,7 +12267,7 @@ sys/src/cmd/ndb/dn.c - 664 sys sys 1127392642 27986
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1121977162 2128
 sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1055701929 3062
 sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1079747687 15363
-sys/src/cmd/ndb/dns.c - 664 sys sys 1079747686 15333
+sys/src/cmd/ndb/dns.c - 664 sys sys 1134305452 15248
 sys/src/cmd/ndb/dns.h - 664 sys sys 1127392642 10141
 sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1079747685 8488
 sys/src/cmd/ndb/dnserver.c - 664 sys sys 1021579994 3687
@@ -12686,7 +12686,7 @@ sys/src/cmd/ql/list.c - 664 sys sys 1089299166 5663
 sys/src/cmd/ql/mkcname - 664 sys sys 944961082 143
 sys/src/cmd/ql/mkfile - 664 sys sys 1089299166 304
 sys/src/cmd/ql/noop.c - 664 sys sys 1089299167 8982
-sys/src/cmd/ql/obj.c - 664 sys sys 1089299167 25301
+sys/src/cmd/ql/obj.c - 664 sys sys 1134346080 25287
 sys/src/cmd/ql/optab.c - 664 sys sys 1089299167 13392
 sys/src/cmd/ql/pass.c - 664 sys sys 1132450403 11861
 sys/src/cmd/ql/sched.c - 664 sys sys 1089299166 12776
@@ -12815,7 +12815,7 @@ sys/src/cmd/scat/plot.c - 664 sys sys 1014926794 21167
 sys/src/cmd/scat/posn.c - 664 sys sys 944961465 5532
 sys/src/cmd/scat/prose.c - 664 sys sys 944961465 2892
 sys/src/cmd/scat/qtree.c - 664 sys sys 964307379 5811
-sys/src/cmd/scat/scat.c - 664 sys sys 964307379 29813
+sys/src/cmd/scat/scat.c - 664 sys sys 1134305452 29820
 sys/src/cmd/scat/sky.h - 664 sys sys 964307380 7573
 sys/src/cmd/scat/strings.c - 664 sys sys 944961465 1650
 sys/src/cmd/scat/util.c - 664 sys sys 964307380 4802
@@ -12900,7 +12900,7 @@ sys/src/cmd/srv.c - 664 sys sys 1074452607 3885
 sys/src/cmd/srvfs.c - 664 sys sys 1116770384 1702
 sys/src/cmd/srvold9p - 20000000775 sys sys 1016921011 0
 sys/src/cmd/srvold9p/9p1.h - 664 sys sys 1016921010 2413
-sys/src/cmd/srvold9p/9p1lib.c - 664 sys sys 1016921010 11446
+sys/src/cmd/srvold9p/9p1lib.c - 664 sys sys 1134305452 11453
 sys/src/cmd/srvold9p/fcall.c - 664 sys sys 1016921010 2571
 sys/src/cmd/srvold9p/mkfile - 664 sys sys 1016921011 132
 sys/src/cmd/srvold9p/srvold9p.c - 664 sys sys 1045505578 19752
@@ -13066,7 +13066,7 @@ sys/src/cmd/troff2html - 20000000775 sys sys 961257241 0
 sys/src/cmd/troff2html/chars.h - 664 sys sys 1105584129 3957
 sys/src/cmd/troff2html/mkfile - 664 sys sys 1105631961 242
 sys/src/cmd/troff2html/troff2html.c - 664 sys sys 1132450028 14280
-sys/src/cmd/tweak.c - 664 sys sys 1018721441 38987
+sys/src/cmd/tweak.c - 664 sys sys 1134305456 38986
 sys/src/cmd/unicode.c - 664 sys sys 944961351 1953
 sys/src/cmd/uniq.c - 664 sys sys 944961351 2236
 sys/src/cmd/units.y - 664 sys sys 1014926801 10979
@@ -13487,7 +13487,7 @@ sys/src/cmd/vac/stdinc.h - 664 sys sys 1036006059 121
 sys/src/cmd/vac/util.c - 664 sys sys 1019678787 930
 sys/src/cmd/vac/vac.c - 664 sys sys 1036470170 23082
 sys/src/cmd/vac/vac.h - 664 sys sys 1091904424 3598
-sys/src/cmd/vac/vacfs.c - 664 sys sys 1084333048 13630
+sys/src/cmd/vac/vacfs.c - 664 sys sys 1134305451 13635
 sys/src/cmd/vac/vactest.c - 664 sys sys 1036024047 2742
 sys/src/cmd/vac/vtdump.c - 664 sys sys 1036006056 7170
 sys/src/cmd/vac/vtread.c - 664 sys sys 1019678788 2052
@@ -13603,7 +13603,7 @@ sys/src/cmd/vnc/compat.c - 664 sys sys 1132454890 3122
 sys/src/cmd/vnc/compat.h - 664 sys sys 1047512521 3425
 sys/src/cmd/vnc/dev.c - 664 sys sys 1044880749 5496
 sys/src/cmd/vnc/devcons.c - 664 sys sys 1132456488 6786
-sys/src/cmd/vnc/devdraw.c - 664 sys sys 1044880749 42068
+sys/src/cmd/vnc/devdraw.c - 664 sys sys 1134305451 41974
 sys/src/cmd/vnc/devmouse.c - 664 sys sys 1091816253 7389
 sys/src/cmd/vnc/draw.c - 664 sys sys 1044880749 6974
 sys/src/cmd/vnc/error.h - 664 sys sys 1044880749 2482
@@ -13658,7 +13658,7 @@ sys/src/cmd/webfs/util.c - 664 sys sys 1015015823 1211
 sys/src/cmd/webfs/webget.c - 664 sys sys 1124711795 1589
 sys/src/cmd/webfsget.c - 664 sys sys 1068413017 1595
 sys/src/cmd/wikifs - 20000000775 sys sys 1018211094 0
-sys/src/cmd/wikifs/fs.c - 664 sys sys 1125835789 15730
+sys/src/cmd/wikifs/fs.c - 664 sys sys 1134354783 14440
 sys/src/cmd/wikifs/io.c - 664 sys sys 1084469671 11572
 sys/src/cmd/wikifs/lookup.c - 664 sys sys 1018211093 182
 sys/src/cmd/wikifs/map.c - 664 sys sys 1018211093 109
@@ -13876,21 +13876,22 @@ sys/src/games/sudoku/sudoku.h - 664 sys sys 1117226432 1159
 sys/src/games/xs.c - 664 sys sys 1128271724 17124
 sys/src/games/xs.h - 664 sys sys 1128271724 292
 sys/src/lib9p - 20000000775 sys sys 1015023311 0
-sys/src/lib9p/_post.c - 664 sys sys 1103565871 1642
+sys/src/lib9p/auth.c - 664 sys sys 1134337555 3392
 sys/src/lib9p/dirread.c - 664 sys sys 1015023310 641
 sys/src/lib9p/fid.c - 664 sys sys 1089299187 1066
 sys/src/lib9p/file.c - 664 sys sys 1132447639 6651
 sys/src/lib9p/ftest.c - 664 sys sys 1015023310 502
 sys/src/lib9p/intmap.c - 664 sys sys 1016833881 2255
+sys/src/lib9p/listen.c - 664 sys sys 1134335266 1626
 sys/src/lib9p/mem.c - 664 sys sys 1015023310 765
-sys/src/lib9p/mkfile - 664 sys sys 1035389775 371
+sys/src/lib9p/mkfile - 664 sys sys 1134337555 387
 sys/src/lib9p/parse.c - 664 sys sys 1032324435 2050
-sys/src/lib9p/post.c - 664 sys sys 1103565871 356
-sys/src/lib9p/post.h - 664 sys sys 1029850260 201
-sys/src/lib9p/ramfs.c - 664 sys sys 1030450927 2534
+sys/src/lib9p/post.c - 664 sys sys 1134346047 1559
+sys/src/lib9p/ramfs.c - 664 sys sys 1134335266 2657
 sys/src/lib9p/req.c - 664 sys sys 1089299187 1652
-sys/src/lib9p/srv.c - 664 sys sys 1133180783 16904
-sys/src/lib9p/tpost.c - 664 sys sys 1103565872 316
+sys/src/lib9p/rfork.c - 664 sys sys 1134335266 493
+sys/src/lib9p/srv.c - 664 sys sys 1134335265 17110
+sys/src/lib9p/thread.c - 664 sys sys 1134335266 407
 sys/src/lib9p/uid.c - 664 sys sys 1015023311 517
 sys/src/lib9p/util.c - 664 sys sys 1017679319 465
 sys/src/libString - 20000000775 sys sys 984754301 0
@@ -14093,7 +14094,7 @@ sys/src/libc/9sys/dirmodefmt.c - 664 sys sys 1014927337 581
 sys/src/libc/9sys/dirread.c - 664 sys sys 1014927337 1385
 sys/src/libc/9sys/dirstat.c - 664 sys sys 1041363499 688
 sys/src/libc/9sys/dirwstat.c - 664 sys sys 1014927337 246
-sys/src/libc/9sys/fcallfmt.c - 664 sys sys 1108319655 5740
+sys/src/libc/9sys/fcallfmt.c - 664 sys sys 1134305457 5747
 sys/src/libc/9sys/fork.c - 664 sys sys 950892938 89
 sys/src/libc/9sys/getenv.c - 664 sys sys 1132331534 589
 sys/src/libc/9sys/getnetconninfo.c - 664 sys sys 1108157974 2477

+ 52 - 51
dist/replica/plan9.db

@@ -15,7 +15,7 @@
 386/_9pcdisk.gz - 664 sys sys 1039764191 695837
 386/bin - 20000000775 sys sys 1018897690 0
 386/bin/8a - 775 sys sys 1132506823 116045
-386/bin/8c - 775 sys sys 1132603401 358647
+386/bin/8c - 775 sys sys 1134321928 362166
 386/bin/8l - 775 sys sys 1130384229 115712
 386/bin/9660srv - 775 sys sys 1130594690 104069
 386/bin/aan - 775 sys sys 1130594690 130742
@@ -5941,7 +5941,7 @@ sys/games/lib/sudoku/images/8.bit - 664 sys sys 1117226542 528
 sys/games/lib/sudoku/images/9.bit - 664 sys sys 1117226542 537
 sys/games/sudoku - 20000000775 sys sys 1117225532 0
 sys/include - 20000000775 sys sys 1016902416 0
-sys/include/9p.h - 664 sys sys 1130649668 4420
+sys/include/9p.h - 664 sys sys 1134337548 4759
 sys/include/String.h - 664 sys sys 1091904425 1319
 sys/include/a.out.h - 664 sys sys 1131293220 1407
 sys/include/ape - 20000000775 sys sys 1014927784 0
@@ -7249,16 +7249,16 @@ sys/man/1/bind - 664 sys sys 1034195345 3928
 sys/man/1/bitsyload - 664 sys sys 988225301 2883
 sys/man/1/bundle - 664 sys sys 1113743325 986
 sys/man/1/cal - 664 sys sys 1113743325 849
-sys/man/1/calendar - 664 sys sys 1104939769 1249
+sys/man/1/calendar - 664 sys sys 1134330265 1294
 sys/man/1/cat - 664 sys sys 1113743325 1338
-sys/man/1/cb - 664 sys sys 1063855627 896
+sys/man/1/cb - 664 sys sys 1134330484 785
 sys/man/1/chgrp - 664 sys sys 944959673 710
 sys/man/1/chmod - 664 sys sys 1079372922 1299
 sys/man/1/cleanname - 664 sys sys 944959674 580
-sys/man/1/cmp - 664 sys sys 944959673 1092
-sys/man/1/colors - 664 sys sys 954523212 1443
+sys/man/1/cmp - 664 sys sys 1134330626 1069
+sys/man/1/colors - 664 sys sys 1134330626 1438
 sys/man/1/comm - 664 sys sys 944959675 665
-sys/man/1/con - 664 sys sys 1071156278 4318
+sys/man/1/con - 664 sys sys 1134330721 4306
 sys/man/1/cp - 664 sys sys 1110816882 1947
 sys/man/1/cpp - 664 sys sys 944959674 2105
 sys/man/1/cpu - 664 sys sys 1128483118 3804
@@ -7388,7 +7388,7 @@ sys/man/1/yacc - 664 sys sys 944959676 3273
 sys/man/1/yesterday - 664 sys sys 1070288431 2348
 sys/man/2 - 20000000775 sys sys 1017423721 0
 sys/man/2/0intro - 664 sys sys 1115941566 11660
-sys/man/2/9p - 664 sys sys 1106291974 15232
+sys/man/2/9p - 664 sys sys 1134335896 15859
 sys/man/2/9pcmdbuf - 664 sys sys 1044430197 2057
 sys/man/2/9pfid - 664 sys sys 1106072437 3663
 sys/man/2/9pfile - 664 sys sys 1048637158 4408
@@ -8115,7 +8115,7 @@ sys/src/9/port/qlock.c - 664 sys sys 1067722765 3196
 sys/src/9/port/rdb.c - 664 sys sys 1018721202 1698
 sys/src/9/port/rebootcmd.c - 664 sys sys 1015278340 1561
 sys/src/9/port/sd.h - 664 sys sys 1131289990 2494
-sys/src/9/port/segment.c - 664 sys sys 1131298540 13722
+sys/src/9/port/segment.c - 664 sys sys 1134276516 13762
 sys/src/9/port/swap.c - 664 sys sys 1055688551 6980
 sys/src/9/port/sysfile.c - 664 sys sys 1134042952 22178
 sys/src/9/port/sysproc.c - 664 sys sys 1134042973 15146
@@ -9157,7 +9157,7 @@ sys/src/cmd/5l/l.s - 664 sys sys 944960727 454
 sys/src/cmd/5l/list.c - 664 sys sys 1014924786 5849
 sys/src/cmd/5l/mkfile - 664 sys sys 944960727 288
 sys/src/cmd/5l/noop.c - 664 sys sys 1089299172 8989
-sys/src/cmd/5l/obj.c - 664 sys sys 1089299173 25833
+sys/src/cmd/5l/obj.c - 664 sys sys 1134305456 25819
 sys/src/cmd/5l/optab.c - 664 sys sys 1014924786 10071
 sys/src/cmd/5l/pass.c - 664 sys sys 1089299173 10297
 sys/src/cmd/5l/sched.c - 664 sys sys 1014936032 10641
@@ -9235,7 +9235,7 @@ sys/src/cmd/9660srv/data.c - 664 sys sys 944960735 373
 sys/src/cmd/9660srv/fns.h - 664 sys sys 1019425186 428
 sys/src/cmd/9660srv/iobuf.c - 664 sys sys 1128255068 3126
 sys/src/cmd/9660srv/iso9660.h - 664 sys sys 1014924873 2607
-sys/src/cmd/9660srv/main.c - 664 sys sys 1020313483 9680
+sys/src/cmd/9660srv/main.c - 664 sys sys 1134305455 9664
 sys/src/cmd/9660srv/mkfile - 664 sys sys 1048644372 238
 sys/src/cmd/9660srv/xfile.c - 664 sys sys 1113742177 2736
 sys/src/cmd/9nfs - 20000000775 sys sys 1015090374 0
@@ -9524,10 +9524,10 @@ sys/src/cmd/aux/apm.c - 664 sys sys 1130423972 20275
 sys/src/cmd/aux/astarld.c - 664 sys sys 1015008684 4638
 sys/src/cmd/aux/cddb.c - 664 sys sys 1126795279 4610
 sys/src/cmd/aux/clog.c - 664 sys sys 1014925109 1000
-sys/src/cmd/aux/consolefs.c - 664 sys sys 1123094543 20187
+sys/src/cmd/aux/consolefs.c - 664 sys sys 1134305455 20200
 sys/src/cmd/aux/conswdir.c - 664 sys sys 1045504955 2077
 sys/src/cmd/aux/data2s.c - 664 sys sys 1032059295 796
-sys/src/cmd/aux/depend.c - 664 sys sys 1132451758 25875
+sys/src/cmd/aux/depend.c - 664 sys sys 1134305455 25880
 sys/src/cmd/aux/disksim.c - 664 sys sys 1073852076 10914
 sys/src/cmd/aux/flashfs - 20000000775 sys sys 1015009082 0
 sys/src/cmd/aux/flashfs/aux.c - 664 sys sys 1015009080 699
@@ -9717,7 +9717,7 @@ sys/src/cmd/bzip2/lib/randtable.c - 664 sys sys 964847967 5473
 sys/src/cmd/bzip2/lib/unix.h - 664 sys sys 964847967 136
 sys/src/cmd/bzip2/mkfile - 664 sys sys 969510789 881
 sys/src/cmd/cal.c - 664 sys sys 944961619 4206
-sys/src/cmd/calendar.c - 664 sys sys 1116769436 4221
+sys/src/cmd/calendar.c - 664 sys sys 1134330186 4227
 sys/src/cmd/cat.c - 664 sys sys 1014926693 532
 sys/src/cmd/cb - 20000000775 sys sys 1062860425 0
 sys/src/cmd/cb/cb.c - 664 sys sys 1130594748 18532
@@ -9728,24 +9728,24 @@ sys/src/cmd/cb/mkfile - 664 sys sys 1062860425 172
 sys/src/cmd/cc - 20000000775 sys sys 1018556175 0
 sys/src/cmd/cc/acid.c - 664 sys sys 944960808 5314
 sys/src/cmd/cc/bits.c - 664 sys sys 944960873 850
-sys/src/cmd/cc/cc.h - 664 sys sys 1131110443 12071
-sys/src/cmd/cc/cc.y - 664 sys sys 1076969746 15801
-sys/src/cmd/cc/com.c - 664 sys sys 1089299183 18909
+sys/src/cmd/cc/cc.h - 664 sys sys 1134321729 12122
+sys/src/cmd/cc/cc.y - 664 sys sys 1134321719 16058
+sys/src/cmd/cc/com.c - 664 sys sys 1134321739 22202
 sys/src/cmd/cc/com64.c - 664 sys sys 1089299182 9975
 sys/src/cmd/cc/compat - 664 sys sys 1014925177 684
 sys/src/cmd/cc/compat.c - 664 sys sys 1132451523 454
 sys/src/cmd/cc/dcl.c - 664 sys sys 1132595282 26815
 sys/src/cmd/cc/dpchk.c - 664 sys sys 1107365037 7152
 sys/src/cmd/cc/funct.c - 664 sys sys 984718510 6167
-sys/src/cmd/cc/lex.c - 664 sys sys 1131293446 23883
+sys/src/cmd/cc/lex.c - 664 sys sys 1134321742 23923
 sys/src/cmd/cc/lexbody - 664 sys sys 1131293457 9188
 sys/src/cmd/cc/mac.c - 664 sys sys 944960808 36
 sys/src/cmd/cc/macbody - 664 sys sys 1108281581 11703
 sys/src/cmd/cc/machcap.c - 664 sys sys 1084472048 78
 sys/src/cmd/cc/mkfile - 664 sys sys 1107365240 563
 sys/src/cmd/cc/pickle.c - 664 sys sys 1063855374 4829
-sys/src/cmd/cc/scon.c - 664 sys sys 1089343502 8606
-sys/src/cmd/cc/sub.c - 664 sys sys 1131110436 34138
+sys/src/cmd/cc/scon.c - 664 sys sys 1134321732 8645
+sys/src/cmd/cc/sub.c - 664 sys sys 1134321729 34315
 sys/src/cmd/cc/y.tab.c - 664 sys sys 1098501521 53564
 sys/src/cmd/cc/y.tab.h - 664 sys sys 1098501521 1680
 sys/src/cmd/cdfs - 20000000775 sys sys 959922196 0
@@ -9759,8 +9759,8 @@ sys/src/cmd/cfs - 20000000775 sys sys 1015009266 0
 sys/src/cmd/cfs/bcache.c - 664 sys sys 1014925219 2956
 sys/src/cmd/cfs/bcache.h - 664 sys sys 1014925220 797
 sys/src/cmd/cfs/cformat.h - 664 sys sys 1014925220 1404
-sys/src/cmd/cfs/cfs.c - 664 sys sys 1045505024 16548
-sys/src/cmd/cfs/disk.c - 664 sys sys 1014925220 5942
+sys/src/cmd/cfs/cfs.c - 664 sys sys 1134305455 16526
+sys/src/cmd/cfs/disk.c - 664 sys sys 1134305455 5949
 sys/src/cmd/cfs/disk.h - 664 sys sys 1014925220 467
 sys/src/cmd/cfs/file.c - 664 sys sys 944960876 5124
 sys/src/cmd/cfs/file.h - 664 sys sys 944960876 225
@@ -9775,11 +9775,11 @@ sys/src/cmd/chgrp.c - 664 sys sys 1014926580 624
 sys/src/cmd/chmod.c - 664 sys sys 1079372923 1904
 sys/src/cmd/cleanname.c - 664 sys sys 944960760 715
 sys/src/cmd/clock.c - 664 sys sys 1014925410 1881
-sys/src/cmd/cmp.c - 664 sys sys 1072145760 2379
+sys/src/cmd/cmp.c - 664 sys sys 1134330528 2379
 sys/src/cmd/colors.c - 664 sys sys 951763912 3186
 sys/src/cmd/comm.c - 664 sys sys 1093979717 2140
 sys/src/cmd/con - 20000000775 sys sys 944961996 0
-sys/src/cmd/con/con.c - 664 sys sys 1121977158 15235
+sys/src/cmd/con/con.c - 664 sys sys 1134330724 15237
 sys/src/cmd/con/hayes.c - 664 sys sys 1014925263 3865
 sys/src/cmd/con/mkfile - 664 sys sys 1046654774 204
 sys/src/cmd/con/rufilio.h - 664 sys sys 944960877 595
@@ -9801,7 +9801,7 @@ sys/src/cmd/cpp/mkfile - 664 sys sys 944960879 178
 sys/src/cmd/cpp/nlist.c - 664 sys sys 1116770041 4645
 sys/src/cmd/cpp/test.c - 664 sys sys 944960879 47
 sys/src/cmd/cpp/tokens.c - 664 sys sys 944960879 6755
-sys/src/cmd/cpu.c - 664 sys sys 1123676384 21128
+sys/src/cmd/cpu.c - 664 sys sys 1134305456 21135
 sys/src/cmd/crop.c - 664 sys sys 1039753034 4136
 sys/src/cmd/date.c - 664 sys sys 944961351 449
 sys/src/cmd/db - 20000000775 sys sys 988249965 0
@@ -9809,7 +9809,7 @@ sys/src/cmd/db/command.c - 664 sys sys 1131297926 4377
 sys/src/cmd/db/defs.h - 664 sys sys 1131292957 1700
 sys/src/cmd/db/expr.c - 664 sys sys 1131292957 5441
 sys/src/cmd/db/fns.h - 664 sys sys 1131297926 2014
-sys/src/cmd/db/format.c - 664 sys sys 1131297926 6868
+sys/src/cmd/db/format.c - 664 sys sys 1134305455 6878
 sys/src/cmd/db/input.c - 664 sys sys 1016731556 2194
 sys/src/cmd/db/main.c - 664 sys sys 1016731556 3308
 sys/src/cmd/db/mkfile - 664 sys sys 944960880 233
@@ -9817,7 +9817,7 @@ sys/src/cmd/db/output.c - 664 sys sys 1014925293 2009
 sys/src/cmd/db/pcs.c - 664 sys sys 1016731557 2859
 sys/src/cmd/db/print.c - 664 sys sys 1131297926 5949
 sys/src/cmd/db/regs.c - 664 sys sys 1131297926 1998
-sys/src/cmd/db/runpcs.c - 664 sys sys 1014925293 2929
+sys/src/cmd/db/runpcs.c - 664 sys sys 1134305454 2928
 sys/src/cmd/db/setup.c - 664 sys sys 1014925293 3581
 sys/src/cmd/db/trcrun.c - 664 sys sys 1131297926 4433
 sys/src/cmd/dc.c - 664 sys sys 1121977159 36572
@@ -9888,7 +9888,7 @@ sys/src/cmd/disk/9660/unix.c - 664 sys sys 984788373 1352
 sys/src/cmd/disk/9660/util.c - 664 sys sys 1017679315 1294
 sys/src/cmd/disk/9660/write.c - 664 sys sys 1077376396 8836
 sys/src/cmd/disk/exsort.c - 664 sys sys 944960885 1964
-sys/src/cmd/disk/format.c - 664 sys sys 1116595013 17648
+sys/src/cmd/disk/format.c - 664 sys sys 1134305454 17649
 sys/src/cmd/disk/kfs - 20000000775 sys sys 1019072794 0
 sys/src/cmd/disk/kfs/9p1.c - 664 sys sys 1065916867 25359
 sys/src/cmd/disk/kfs/9p1.h - 664 sys sys 1091904426 2220
@@ -9912,7 +9912,7 @@ sys/src/cmd/disk/kfs/iobuf.c - 664 sys sys 1015009189 3769
 sys/src/cmd/disk/kfs/main.c - 664 sys sys 1106924274 9515
 sys/src/cmd/disk/kfs/misc.c - 664 sys sys 1015009189 1182
 sys/src/cmd/disk/kfs/mkfile - 664 sys sys 1065916865 717
-sys/src/cmd/disk/kfs/ofcallfmt.c - 664 sys sys 1015009189 4674
+sys/src/cmd/disk/kfs/ofcallfmt.c - 664 sys sys 1134305454 4681
 sys/src/cmd/disk/kfs/portdat.h - 664 sys sys 1082221137 6055
 sys/src/cmd/disk/kfs/portfns.h - 664 sys sys 1020313861 2804
 sys/src/cmd/disk/kfs/porttime.c - 664 sys sys 1015009190 3922
@@ -9998,7 +9998,7 @@ sys/src/cmd/execnet/note.c - 664 sys sys 1019855740 2315
 sys/src/cmd/exportfs - 20000000775 sys sys 988249971 0
 sys/src/cmd/exportfs/exportfs.c - 664 sys sys 1115314269 16357
 sys/src/cmd/exportfs/exportfs.h - 664 sys sys 1066823091 2800
-sys/src/cmd/exportfs/exportsrv.c - 664 sys sys 1081082332 11914
+sys/src/cmd/exportfs/exportsrv.c - 664 sys sys 1134316119 11914
 sys/src/cmd/exportfs/mkfile - 664 sys sys 1066825703 194
 sys/src/cmd/exportfs/pattern.c - 664 sys sys 1066823092 2960
 sys/src/cmd/ext2srv - 20000000775 sys sys 1055687763 0
@@ -10007,7 +10007,7 @@ sys/src/cmd/ext2srv/dat.h - 664 sys sys 1055687746 5275
 sys/src/cmd/ext2srv/errstr.h - 664 sys sys 1055687747 565
 sys/src/cmd/ext2srv/ext2fs.c - 664 sys sys 1055687747 6063
 sys/src/cmd/ext2srv/ext2srv.man - 664 sys sys 1055687747 2409
-sys/src/cmd/ext2srv/ext2subs.c - 664 sys sys 1055687747 38701
+sys/src/cmd/ext2srv/ext2subs.c - 664 sys sys 1134305454 38683
 sys/src/cmd/ext2srv/fns.h - 664 sys sys 1055687748 1803
 sys/src/cmd/ext2srv/iobuf.c - 664 sys sys 1055687748 2854
 sys/src/cmd/ext2srv/mkfile - 664 sys sys 1055687748 194
@@ -10047,7 +10047,7 @@ sys/src/cmd/fossil/9auth.c - 664 sys sys 1061530721 3393
 sys/src/cmd/fossil/9dir.c - 664 sys sys 1085333382 2219
 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 1128255102 33313
+sys/src/cmd/fossil/9fsys.c - 664 sys sys 1134305453 33320
 sys/src/cmd/fossil/9lstn.c - 664 sys sys 1042005503 2865
 sys/src/cmd/fossil/9p.c - 664 sys sys 1104940048 21862
 sys/src/cmd/fossil/9ping.c - 664 sys sys 1042005503 1563
@@ -11912,7 +11912,7 @@ sys/src/cmd/idiff.c - 664 sys sys 1014926695 6896
 sys/src/cmd/import.c - 664 sys sys 1133180705 7028
 sys/src/cmd/init.c - 664 sys sys 1121977160 4462
 sys/src/cmd/iostats - 20000000775 sys sys 944962001 0
-sys/src/cmd/iostats/iostats.c - 664 sys sys 1127431876 9669
+sys/src/cmd/iostats/iostats.c - 664 sys sys 1134305453 9616
 sys/src/cmd/iostats/mkfile - 664 sys sys 1014925727 122
 sys/src/cmd/iostats/statfs.h - 664 sys sys 1127431876 2617
 sys/src/cmd/iostats/statsrv.c - 664 sys sys 1127431876 10745
@@ -11931,7 +11931,7 @@ 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
 sys/src/cmd/ip/dhcpd/testping.c - 664 sys sys 950389141 352
-sys/src/cmd/ip/ftpd.c - 664 sys sys 1121977160 33081
+sys/src/cmd/ip/ftpd.c - 664 sys sys 1134305453 33088
 sys/src/cmd/ip/ftpfs - 20000000775 sys sys 1014925642 0
 sys/src/cmd/ip/ftpfs/file.c - 664 sys sys 1014925642 4208
 sys/src/cmd/ip/ftpfs/ftpfs.c - 664 sys sys 1116737713 13860
@@ -12259,7 +12259,7 @@ sys/src/cmd/mv.c - 664 sys sys 1126278115 4241
 sys/src/cmd/ndb - 20000000775 sys sys 988249988 0
 sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1119276409 6866
 sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1060612175 7248
-sys/src/cmd/ndb/cs.c - 664 sys sys 1128706486 33223
+sys/src/cmd/ndb/cs.c - 664 sys sys 1134305453 33083
 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 1123602793 18275
@@ -12267,7 +12267,7 @@ sys/src/cmd/ndb/dn.c - 664 sys sys 1127392642 27986
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1121977162 2128
 sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1055701929 3062
 sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1079747687 15363
-sys/src/cmd/ndb/dns.c - 664 sys sys 1079747686 15333
+sys/src/cmd/ndb/dns.c - 664 sys sys 1134305452 15248
 sys/src/cmd/ndb/dns.h - 664 sys sys 1127392642 10141
 sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1079747685 8488
 sys/src/cmd/ndb/dnserver.c - 664 sys sys 1021579994 3687
@@ -12686,7 +12686,7 @@ sys/src/cmd/ql/list.c - 664 sys sys 1089299166 5663
 sys/src/cmd/ql/mkcname - 664 sys sys 944961082 143
 sys/src/cmd/ql/mkfile - 664 sys sys 1089299166 304
 sys/src/cmd/ql/noop.c - 664 sys sys 1089299167 8982
-sys/src/cmd/ql/obj.c - 664 sys sys 1089299167 25301
+sys/src/cmd/ql/obj.c - 664 sys sys 1134346080 25287
 sys/src/cmd/ql/optab.c - 664 sys sys 1089299167 13392
 sys/src/cmd/ql/pass.c - 664 sys sys 1132450403 11861
 sys/src/cmd/ql/sched.c - 664 sys sys 1089299166 12776
@@ -12815,7 +12815,7 @@ sys/src/cmd/scat/plot.c - 664 sys sys 1014926794 21167
 sys/src/cmd/scat/posn.c - 664 sys sys 944961465 5532
 sys/src/cmd/scat/prose.c - 664 sys sys 944961465 2892
 sys/src/cmd/scat/qtree.c - 664 sys sys 964307379 5811
-sys/src/cmd/scat/scat.c - 664 sys sys 964307379 29813
+sys/src/cmd/scat/scat.c - 664 sys sys 1134305452 29820
 sys/src/cmd/scat/sky.h - 664 sys sys 964307380 7573
 sys/src/cmd/scat/strings.c - 664 sys sys 944961465 1650
 sys/src/cmd/scat/util.c - 664 sys sys 964307380 4802
@@ -12900,7 +12900,7 @@ sys/src/cmd/srv.c - 664 sys sys 1074452607 3885
 sys/src/cmd/srvfs.c - 664 sys sys 1116770384 1702
 sys/src/cmd/srvold9p - 20000000775 sys sys 1016921011 0
 sys/src/cmd/srvold9p/9p1.h - 664 sys sys 1016921010 2413
-sys/src/cmd/srvold9p/9p1lib.c - 664 sys sys 1016921010 11446
+sys/src/cmd/srvold9p/9p1lib.c - 664 sys sys 1134305452 11453
 sys/src/cmd/srvold9p/fcall.c - 664 sys sys 1016921010 2571
 sys/src/cmd/srvold9p/mkfile - 664 sys sys 1016921011 132
 sys/src/cmd/srvold9p/srvold9p.c - 664 sys sys 1045505578 19752
@@ -13066,7 +13066,7 @@ sys/src/cmd/troff2html - 20000000775 sys sys 961257241 0
 sys/src/cmd/troff2html/chars.h - 664 sys sys 1105584129 3957
 sys/src/cmd/troff2html/mkfile - 664 sys sys 1105631961 242
 sys/src/cmd/troff2html/troff2html.c - 664 sys sys 1132450028 14280
-sys/src/cmd/tweak.c - 664 sys sys 1018721441 38987
+sys/src/cmd/tweak.c - 664 sys sys 1134305456 38986
 sys/src/cmd/unicode.c - 664 sys sys 944961351 1953
 sys/src/cmd/uniq.c - 664 sys sys 944961351 2236
 sys/src/cmd/units.y - 664 sys sys 1014926801 10979
@@ -13487,7 +13487,7 @@ sys/src/cmd/vac/stdinc.h - 664 sys sys 1036006059 121
 sys/src/cmd/vac/util.c - 664 sys sys 1019678787 930
 sys/src/cmd/vac/vac.c - 664 sys sys 1036470170 23082
 sys/src/cmd/vac/vac.h - 664 sys sys 1091904424 3598
-sys/src/cmd/vac/vacfs.c - 664 sys sys 1084333048 13630
+sys/src/cmd/vac/vacfs.c - 664 sys sys 1134305451 13635
 sys/src/cmd/vac/vactest.c - 664 sys sys 1036024047 2742
 sys/src/cmd/vac/vtdump.c - 664 sys sys 1036006056 7170
 sys/src/cmd/vac/vtread.c - 664 sys sys 1019678788 2052
@@ -13603,7 +13603,7 @@ sys/src/cmd/vnc/compat.c - 664 sys sys 1132454890 3122
 sys/src/cmd/vnc/compat.h - 664 sys sys 1047512521 3425
 sys/src/cmd/vnc/dev.c - 664 sys sys 1044880749 5496
 sys/src/cmd/vnc/devcons.c - 664 sys sys 1132456488 6786
-sys/src/cmd/vnc/devdraw.c - 664 sys sys 1044880749 42068
+sys/src/cmd/vnc/devdraw.c - 664 sys sys 1134305451 41974
 sys/src/cmd/vnc/devmouse.c - 664 sys sys 1091816253 7389
 sys/src/cmd/vnc/draw.c - 664 sys sys 1044880749 6974
 sys/src/cmd/vnc/error.h - 664 sys sys 1044880749 2482
@@ -13658,7 +13658,7 @@ sys/src/cmd/webfs/util.c - 664 sys sys 1015015823 1211
 sys/src/cmd/webfs/webget.c - 664 sys sys 1124711795 1589
 sys/src/cmd/webfsget.c - 664 sys sys 1068413017 1595
 sys/src/cmd/wikifs - 20000000775 sys sys 1018211094 0
-sys/src/cmd/wikifs/fs.c - 664 sys sys 1125835789 15730
+sys/src/cmd/wikifs/fs.c - 664 sys sys 1134354783 14440
 sys/src/cmd/wikifs/io.c - 664 sys sys 1084469671 11572
 sys/src/cmd/wikifs/lookup.c - 664 sys sys 1018211093 182
 sys/src/cmd/wikifs/map.c - 664 sys sys 1018211093 109
@@ -13876,21 +13876,22 @@ sys/src/games/sudoku/sudoku.h - 664 sys sys 1117226432 1159
 sys/src/games/xs.c - 664 sys sys 1128271724 17124
 sys/src/games/xs.h - 664 sys sys 1128271724 292
 sys/src/lib9p - 20000000775 sys sys 1015023311 0
-sys/src/lib9p/_post.c - 664 sys sys 1103565871 1642
+sys/src/lib9p/auth.c - 664 sys sys 1134337555 3392
 sys/src/lib9p/dirread.c - 664 sys sys 1015023310 641
 sys/src/lib9p/fid.c - 664 sys sys 1089299187 1066
 sys/src/lib9p/file.c - 664 sys sys 1132447639 6651
 sys/src/lib9p/ftest.c - 664 sys sys 1015023310 502
 sys/src/lib9p/intmap.c - 664 sys sys 1016833881 2255
+sys/src/lib9p/listen.c - 664 sys sys 1134335266 1626
 sys/src/lib9p/mem.c - 664 sys sys 1015023310 765
-sys/src/lib9p/mkfile - 664 sys sys 1035389775 371
+sys/src/lib9p/mkfile - 664 sys sys 1134337555 387
 sys/src/lib9p/parse.c - 664 sys sys 1032324435 2050
-sys/src/lib9p/post.c - 664 sys sys 1103565871 356
-sys/src/lib9p/post.h - 664 sys sys 1029850260 201
-sys/src/lib9p/ramfs.c - 664 sys sys 1030450927 2534
+sys/src/lib9p/post.c - 664 sys sys 1134346047 1559
+sys/src/lib9p/ramfs.c - 664 sys sys 1134335266 2657
 sys/src/lib9p/req.c - 664 sys sys 1089299187 1652
-sys/src/lib9p/srv.c - 664 sys sys 1133180783 16904
-sys/src/lib9p/tpost.c - 664 sys sys 1103565872 316
+sys/src/lib9p/rfork.c - 664 sys sys 1134335266 493
+sys/src/lib9p/srv.c - 664 sys sys 1134335265 17110
+sys/src/lib9p/thread.c - 664 sys sys 1134335266 407
 sys/src/lib9p/uid.c - 664 sys sys 1015023311 517
 sys/src/lib9p/util.c - 664 sys sys 1017679319 465
 sys/src/libString - 20000000775 sys sys 984754301 0
@@ -14093,7 +14094,7 @@ sys/src/libc/9sys/dirmodefmt.c - 664 sys sys 1014927337 581
 sys/src/libc/9sys/dirread.c - 664 sys sys 1014927337 1385
 sys/src/libc/9sys/dirstat.c - 664 sys sys 1041363499 688
 sys/src/libc/9sys/dirwstat.c - 664 sys sys 1014927337 246
-sys/src/libc/9sys/fcallfmt.c - 664 sys sys 1108319655 5740
+sys/src/libc/9sys/fcallfmt.c - 664 sys sys 1134305457 5747
 sys/src/libc/9sys/fork.c - 664 sys sys 950892938 89
 sys/src/libc/9sys/getenv.c - 664 sys sys 1132331534 589
 sys/src/libc/9sys/getnetconninfo.c - 664 sys sys 1108157974 2477

+ 63 - 0
dist/replica/plan9.log

@@ -23461,3 +23461,66 @@
 1134262892 1 c sys/src/cmd/7l/l.h - 774 sys sys 1134261563 5002
 1134262892 2 c sys/src/cmd/7l/mkfile - 774 sys sys 1134261563 372
 1134262892 3 c sys/src/cmd/7l/obj.c - 774 sys sys 1134261563 22824
+1134277296 0 c sys/src/9/port/segment.c - 664 sys sys 1134276516 13762
+1134306103 0 c sys/src/cmd/5l/obj.c - 664 sys sys 1134305456 25819
+1134306103 1 c sys/src/cmd/9660srv/main.c - 664 sys sys 1134305455 9664
+1134306103 2 c sys/src/cmd/aux/consolefs.c - 664 sys sys 1134305455 20200
+1134306103 3 c sys/src/cmd/aux/depend.c - 664 sys sys 1134305455 25880
+1134306103 4 c sys/src/cmd/cfs/cfs.c - 664 sys sys 1134305455 16526
+1134306103 5 c sys/src/cmd/cfs/disk.c - 664 sys sys 1134305455 5949
+1134306103 6 c sys/src/cmd/db/format.c - 664 sys sys 1134305455 6878
+1134306103 7 c sys/src/cmd/db/runpcs.c - 664 sys sys 1134305454 2928
+1134306103 8 c sys/src/cmd/disk/format.c - 664 sys sys 1134305454 17649
+1134306103 9 c sys/src/cmd/disk/kfs/ofcallfmt.c - 664 sys sys 1134305454 4681
+1134306103 10 c sys/src/cmd/exportfs/exportsrv.c - 664 sys sys 1134305454 11946
+1134306103 11 c sys/src/cmd/iostats/iostats.c - 664 sys sys 1134305453 9616
+1134306103 12 c sys/src/cmd/ip/ftpd.c - 664 sys sys 1134305453 33088
+1134306103 13 c sys/src/cmd/ndb/cs.c - 664 sys sys 1134305453 33083
+1134306103 14 c sys/src/cmd/ndb/dns.c - 664 sys sys 1134305452 15248
+1134306103 15 c sys/src/cmd/vnc/devdraw.c - 664 sys sys 1134305451 41974
+1134306103 16 c sys/src/cmd/ql/obj.c - 664 sys sys 1134305452 25288
+1134306103 17 c sys/src/cmd/srvold9p/9p1lib.c - 664 sys sys 1134305452 11453
+1134306103 18 c sys/src/cmd/vac/vacfs.c - 664 sys sys 1134305451 13635
+1134306103 19 c sys/src/cmd/cpu.c - 664 sys sys 1134305456 21135
+1134306103 20 c sys/src/cmd/ext2srv/ext2subs.c - 664 sys sys 1134305454 38683
+1134306103 21 c sys/src/cmd/fossil/9fsys.c - 664 sys sys 1134305453 33320
+1134306103 22 c sys/src/cmd/scat/scat.c - 664 sys sys 1134305452 29820
+1134306103 23 c sys/src/cmd/tweak.c - 664 sys sys 1134305456 38986
+1134306103 24 c sys/src/lib9p/srv.c - 664 sys sys 1134305451 16921
+1134306103 25 c sys/src/libc/9sys/fcallfmt.c - 664 sys sys 1134305457 5747
+1134315107 0 c sys/src/cmd/exportfs/exportsrv.c - 664 sys sys 1134313623 11914
+1134316909 0 c sys/src/cmd/exportfs/exportsrv.c - 664 sys sys 1134316119 11914
+1134322313 0 c 386/bin/8c - 775 sys sys 1134321928 362166
+1134322313 1 c sys/src/cmd/cc/cc.h - 664 sys sys 1134321729 12122
+1134322313 2 c sys/src/cmd/cc/cc.y - 664 sys sys 1134321719 16058
+1134322313 3 c sys/src/cmd/cc/com.c - 664 sys sys 1134321739 22202
+1134322313 4 c sys/src/cmd/cc/lex.c - 664 sys sys 1134321742 23923
+1134322313 5 c sys/src/cmd/cc/scon.c - 664 sys sys 1134321732 8645
+1134322313 6 c sys/src/cmd/cc/sub.c - 664 sys sys 1134321729 34315
+1134331316 0 c sys/man/1/cmp - 664 sys sys 1134330626 1069
+1134331316 1 c sys/man/1/calendar - 664 sys sys 1134330265 1294
+1134331316 2 c sys/man/1/cb - 664 sys sys 1134330484 785
+1134331316 3 c sys/man/1/colors - 664 sys sys 1134330626 1438
+1134331316 4 c sys/man/1/con - 664 sys sys 1134330721 4306
+1134331316 5 c sys/src/cmd/con/con.c - 664 sys sys 1134330724 15237
+1134331316 6 c sys/src/cmd/cmp.c - 664 sys sys 1134330528 2379
+1134331316 7 c sys/src/cmd/calendar.c - 664 sys sys 1134330186 4227
+1134333117 0 c sys/src/lib9p/srv.c - 664 sys sys 1134331549 17064
+1134336718 0 c sys/man/2/9p - 664 sys sys 1134335896 15859
+1134336718 1 a sys/src/lib9p/listen.c - 664 sys sys 1134335266 1626
+1134336718 2 c sys/src/lib9p/mkfile - 664 sys sys 1134335266 377
+1134336718 3 c sys/src/lib9p/post.c - 664 sys sys 1134335266 1559
+1134336718 4 c sys/src/lib9p/ramfs.c - 664 sys sys 1134335266 2657
+1134336718 5 a sys/src/lib9p/rfork.c - 664 sys sys 1134335266 493
+1134336718 6 c sys/src/lib9p/srv.c - 664 sys sys 1134335265 17110
+1134336718 7 a sys/src/lib9p/thread.c - 664 sys sys 1134335266 407
+1134336718 8 d sys/src/lib9p/tpost.c - 664 sys sys 1103565872 0
+1134336718 9 d sys/src/lib9p/post.h - 664 sys sys 1029850260 0
+1134336718 10 d sys/src/lib9p/_post.c - 664 sys sys 1103565871 0
+1134338519 0 c sys/include/9p.h - 664 sys sys 1134337548 4759
+1134338519 1 a sys/src/lib9p/auth.c - 664 sys sys 1134337555 3392
+1134338519 2 c sys/src/lib9p/mkfile - 664 sys sys 1134337555 387
+1134347521 0 c sys/src/cmd/ql/obj.c - 664 sys sys 1134346080 25287
+1134347521 1 c sys/src/lib9p/post.c - 664 sys sys 1134346047 1559
+1134354723 0 c sys/src/cmd/wikifs/fs.c - 664 sys sys 1134354769 14833
+1134356523 0 c sys/src/cmd/wikifs/fs.c - 664 sys sys 1134354783 14440

+ 19 - 3
sys/include/9p.h

@@ -198,6 +198,7 @@ struct Srv {
 	int		nopipe;
 	int		srvfd;
 	int		leavefdsopen;	/* magic for acme win */
+	char*	keyspec;
 
 /* below is implementation-specific; don't use */
 	Fidpool*	fpool;
@@ -208,13 +209,19 @@ struct Srv {
 	QLock	rlock;
 	uchar*	wbuf;
 	QLock	wlock;
+	
+	char*	addr;
 };
 
 void		srv(Srv*);
 void		postmountsrv(Srv*, char*, char*, int);
+void		_postmountsrv(Srv*, char*, char*, int);
+void		listensrv(Srv*, char*);
+void		_listensrv(Srv*, char*);
 int 		postfd(char*, int);
 int		chatty9p;
 void		respond(Req*, char*);
+void		responderror(Req*);
 void		threadpostmountsrv(Srv*, char*, char*, int);
 
 /*
@@ -230,7 +237,16 @@ enum {
 	OMASK = 3
 };
 
-void readstr(Req*, char*);
-void readbuf(Req*, void*, long);
-void	walkandclone(Req*, char*(*walk1)(Fid*,char*,void*), char*(*clone)(Fid*,Fid*,void*), void*);
+void		readstr(Req*, char*);
+void		readbuf(Req*, void*, long);
+void		walkandclone(Req*, char*(*walk1)(Fid*,char*,void*), 
+			char*(*clone)(Fid*,Fid*,void*), void*);
+
+void		auth9p(Req*);
+void		authread(Req*);
+void		authwrite(Req*);
+void		authdestroy(Fid*);
+int		authattach(Req*);
+
+extern void (*_forker)(void (*)(void*), void*, int);
 

+ 9 - 4
sys/man/1/calendar

@@ -4,10 +4,11 @@ calendar \- print upcoming events
 .SH SYNOPSIS
 .B calendar
 [
-.B \-y
+.B -dy
 ]
 [
-.B \-p days
+.B -p
+.I days
 ]
 [
 .I file ...
@@ -32,18 +33,22 @@ monthly events:
 All comparisons are case insensitive.
 .PP
 If the
-.B \-y
+.B -y
 flag is given, an attempt is made to match on year too.  In this case,
 dates of the forms listed above will be accepted if they are followed
 by the current year (or last two digits thereof) or not a year —
 digits not followed by white space or non-digits.
 .PP
 If the
-.B \-p
+.B -p
 flag is given, its argument is the number of days ahead to match
 dates.  This flag is not repeatable, and it performs no special
 processing at the end of the week.
 .PP
+The
+.B -d
+flag enables debugging output.
+.PP
 On Friday and Saturday, events through Monday are printed.
 .PP
 To have your calendar mailed to you every day, use

+ 31 - 16
sys/man/1/cb

@@ -1,31 +1,46 @@
 .TH CB 1
 .SH NAME
-.I cb 
-\- C program beautifier
+cb \- C program beautifier
 .SH SYNOPSIS
-\fBcb\fR [\fB-s\fR] [\fB-j\fR] [\fB-l\fR \fIlength\fR] [\fIfile\fR ...]
+.B cb
+[
+.B -js
+]
+[
+.B -l
+.I length
+]
+[
+.I file
+\&...
+]
 .SH DESCRIPTION
-\fBCb\fR reads syntactically correct C programs from
+.I Cb
+reads syntactically correct C programs from
 from its input or the given files, and writes them to its stdout
-with a more visualy pleasing spacing and indentation. \fBCb\fR
+with a more visualy pleasing spacing and indentation.
+.I Cb
 understands no C++ syntax bar newline terminated comments;
 and by default all user new-lines are preserved in the output.
 .PP
-\fBCb\fR accepts the following options.
-.TP 
-.B -s
-Write the code in the style of Kernighan and
-Ritchie found in The C Programming Language.
+The options are:
 .TP
 .B -j
-Put split lines back together.
+Join split lines.
+.TP 
+.B -s
+Print code in the so-called K&R style used in
+.IR "The C Programming Language" .
 .TP 
 .B -l length
-Split lines that are longer than \fIlength\fR.
+Split lines that are longer than
+.IR length .
+.PD
 .SH SOURCE
 .B /sys/src/cmd/cb
-.SH NOTES
-The format of structure initializations is unchanged by \fBcb\fR.
+.SH BUGS
+.I Cb
+does not reformat structure initializers.
 .br
-Punctuation that is hidden in preprocessing directives
-causes indentation errors.
+Punctuation hidden in macros can cause
+indentation errors.

+ 11 - 11
sys/man/1/cmp

@@ -4,7 +4,7 @@ cmp \- compare two files
 .SH SYNOPSIS
 .B cmp
 [
-.B -lsL
+.B -lLs
 ]
 .I file1 file2
 [
@@ -14,23 +14,23 @@ cmp \- compare two files
 ]
 ]
 .SH DESCRIPTION
-The two files are
-compared.
-A diagnostic results if the contents differ, otherwise
-there is no output.
+.I Cmp
+compares the two files and prints
+a message if the contents differ.
 .PP
 The options are:
 .TP
-.B l
+.B -l
 Print the byte number (decimal) and the
 differing bytes (hexadecimal) for each difference.
 .TP
-.B s
+.B -L
+Print the line number of the first differing byte.
+.TP
+.B -s
 Print nothing for differing files,
 but set the exit status.
-.TP
-.B L
-Print the line number of the first differing byte.
+.PD
 .PP
 If offsets are given,
 comparison starts at the designated byte position
@@ -43,7 +43,7 @@ with
 octal; with anything else, decimal.
 .SH SOURCE
 .B /sys/src/cmd/cmp.c
-.SH "SEE ALSO"
+.SH SEE ALSO
 .IR diff (1) 
 .SH DIAGNOSTICS
 If a file is inaccessible or missing, the exit status is

+ 1 - 2
sys/man/1/colors

@@ -5,8 +5,7 @@ getmap, colors \- display color map
 .PP
 .B colors
 [
-.B -r
-.B -x
+.B -rx
 ]
 .PP
 .B getmap

+ 5 - 5
sys/man/1/con

@@ -4,7 +4,7 @@ con, telnet, rx, xms, xmr \- remote login, execution, and XMODEM file transfer
 .SH SYNOPSIS
 .B con
 [
-.B -CdnrRvsT
+.B -CdnrRsTv
 ]
 [
 .B -b
@@ -13,7 +13,7 @@ con, telnet, rx, xms, xmr \- remote login, execution, and XMODEM file transfer
 [
 .B -l
 [
-.I remuser
+.I user
 ]
 ]
 [
@@ -37,7 +37,7 @@ con, telnet, rx, xms, xmr \- remote login, execution, and XMODEM file transfer
 ]
 [
 .B -l
-.I remuser
+.I user
 ]
 .RI [ net !] machine
 [
@@ -73,7 +73,7 @@ but instead wait for the remote end to hang up.
 .TP
 .B -l
 with an argument causes
-.I remuser
+.I user
 to be used as the account name on the remote system.
 Without an argument this option disables automatic login
 and a normal login session ensues.
@@ -178,7 +178,7 @@ connection when standard input is closed.
 .TP
 .B \-l
 allows
-.I remuser
+.I user
 to be used on the remote machine if the remote
 is a BSD machine.
 .TP

+ 26 - 0
sys/man/2/9p

@@ -10,6 +10,7 @@ postmountsrv,
 readbuf,
 readstr,
 respond,
+responderror,
 threadpostmountsrv,
 srv \- 9P file service
 .SH SYNOPSIS
@@ -61,8 +62,11 @@ typedef struct Srv {
 int	srv(Srv *s)
 void	postmountsrv(Srv *s, char *name, char *mtpt, int flag)
 void	threadpostmountsrv(Srv *s, char *name, char *mtpt, int flag)
+void	listensrv(Srv *s, char *addr)
+void	threadlistensrv(Srv *s, char *addr)
 int	postfd(char *srvname, int fd)
 void	respond(Req *r, char *error)
+void	responderror(Req*)
 void	readstr(Req *r, char *src)
 void	readbuf(Req *r, void *src, long nsrc)
 typedef int Dirgen(int n, Dir *dir, void *aux)
@@ -217,6 +221,21 @@ this process, the entire process is terminated by calling
 .I sysfatal
 (see
 .IR perror (2)).
+.PP
+.I Listensrv
+and
+.I threadlistensrv
+create a separate process to announce as
+.IR addr .
+The process listens for incoming connections,
+creating a new process to serve each.
+Using these functions results in 
+.I srv
+and the service functions
+being run in multiple processes simultaneously.
+The library locks its own data structures as necessary;
+the client may need to lock data it shares between
+the multiple connections.
 .SS Service functions
 The functions in a 
 .B Srv
@@ -289,6 +308,13 @@ has been called, the
 as well as any pointers it once contained must
 be considered freed and not referenced.
 .PP
+.I Responderror
+calls 
+.I respond
+with the system error string
+(see
+.IR errstr (2)).
+.PP
 If the service loop detects an error in a request
 (e.g., an attempt to reuse an extant fid, an open of
 an already open fid, a read from a fid opened for write, etc.)

+ 1 - 1
sys/src/cmd/5l/obj.c

@@ -819,7 +819,7 @@ loop:
 	bloc += r;
 	c -= r;
 
-	if(p->reg < 0 || p->reg > NREG)
+	if(p->reg > NREG)
 		diag("register out of range %d", p->reg);
 
 	p->link = P;

+ 1 - 1
sys/src/cmd/9660srv/main.c

@@ -181,7 +181,7 @@ io(int srvfd)
 		errno = 0;
 		if(!waserror()){
 			err_msg[0] = 0;
-			if(req->type < 0 || req->type > nelem(fcalls) || !fcalls[req->type])
+			if(req->type >= nelem(fcalls) || !fcalls[req->type])
 				error("bad fcall type");
 			(*fcalls[req->type])();
 			poperror();

+ 6 - 5
sys/src/cmd/aux/consolefs.c

@@ -986,7 +986,7 @@ fsread(Fs *fs, Request *r, Fid *f)
 		return;
 	}
 
-	if(r->f.count < 0){
+	if((int)r->f.count < 0){
 		fsreply(fs, r, Ebadcount);
 		return;
 	}
@@ -1045,7 +1045,7 @@ fswrite(Fs *fs, Request *r, Fid *f)
 		return;
 	}
 
-	if(r->f.count < 0){
+	if((int)r->f.count < 0){
 		fsreply(fs, r, Ebadcount);
 		return;
 	}
@@ -1112,18 +1112,19 @@ fsremove(Fs *fs, Request *r, Fid*)
 void
 fsstat(Fs *fs, Request *r, Fid *f)
 {
-	int i;
+	int i, n;
 	Qid q;
 	Dir d;
 
 	q = parentqid(f->qid);
 	for(i = 0; ; i++){
 		r->f.stat = r->buf+IOHDRSZ;
-		r->f.nstat = fsdirgen(fs, q, i, &d, r->f.stat, messagesize-IOHDRSZ);
-		if(r->f.nstat < 0){
+		n = fsdirgen(fs, q, i, &d, r->f.stat, messagesize-IOHDRSZ);
+		if(n < 0){
 			fsreply(fs, r, Eexist);
 			return;
 		}
+		r->f.nstat = n;
 		if(r->f.nstat > BIT16SZ && d.qid.path == f->qid.path)
 			break;
 	}

+ 1 - 1
sys/src/cmd/aux/depend.c

@@ -828,7 +828,7 @@ fsread(Fs *fs, Request *r, Fid *f)
 		fsreply(fs, r, Enofid);
 		return;
 	}
-	if(r->f.count < 0){
+	if((int)r->f.count < 0){
 		fsreply(fs, r, "bad read count");
 		return;
 	}

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

@@ -44,7 +44,7 @@ main(int argc, char *argv[])
 		ahead = atoi(ARGF());
 		break;
 	default:
-		fprint(2, "usage: calendar [-y] [-d] [files ...]\n");
+		fprint(2, "usage: calendar [-dy] [-p days] [files ...]\n");
 		exits("usage");
 	}ARGEND;
 

+ 3 - 0
sys/src/cmd/cc/cc.h

@@ -57,6 +57,8 @@ struct	Node
 	Type*	type;
 	long	lineno;
 	char	op;
+	char	oldop;
+	char xcast;
 	char	class;
 	char	etype;
 	char	complex;
@@ -497,6 +499,7 @@ extern	char	typeil[];
 extern	char	typeilp[];
 extern	char	typechl[];
 extern	char	typechlv[];
+extern	char	typechlvp[];
 extern	char	typechlp[];
 extern	char	typechlpfd[];
 

+ 9 - 0
sys/src/cmd/cc/cc.y

@@ -656,6 +656,7 @@ xuexpr:
 		$$ = new(OCAST, $5, Z);
 		dodecl(NODECL, CXXX, $2, $3);
 		$$->type = lastdcl;
+		$$->xcast = 1;
 	}
 |	'(' tlist abdecor ')' '{' ilist '}'	/* extension */
 	{
@@ -760,48 +761,56 @@ pexpr:
 		$$ = new(OCONST, Z, Z);
 		$$->type = types[TINT];
 		$$->vconst = $1;
+		$$->cstring = strdup(symb);
 	}
 |	LLCONST
 	{
 		$$ = new(OCONST, Z, Z);
 		$$->type = types[TLONG];
 		$$->vconst = $1;
+		$$->cstring = strdup(symb);
 	}
 |	LUCONST
 	{
 		$$ = new(OCONST, Z, Z);
 		$$->type = types[TUINT];
 		$$->vconst = $1;
+		$$->cstring = strdup(symb);
 	}
 |	LULCONST
 	{
 		$$ = new(OCONST, Z, Z);
 		$$->type = types[TULONG];
 		$$->vconst = $1;
+		$$->cstring = strdup(symb);
 	}
 |	LDCONST
 	{
 		$$ = new(OCONST, Z, Z);
 		$$->type = types[TDOUBLE];
 		$$->fconst = $1;
+		$$->cstring = strdup(symb);
 	}
 |	LFCONST
 	{
 		$$ = new(OCONST, Z, Z);
 		$$->type = types[TFLOAT];
 		$$->fconst = $1;
+		$$->cstring = strdup(symb);
 	}
 |	LVLCONST
 	{
 		$$ = new(OCONST, Z, Z);
 		$$->type = types[TVLONG];
 		$$->vconst = $1;
+		$$->cstring = strdup(symb);
 	}
 |	LUVLCONST
 	{
 		$$ = new(OCONST, Z, Z);
 		$$->type = types[TUVLONG];
 		$$->vconst = $1;
+		$$->cstring = strdup(symb);
 	}
 |	string
 |	lstring

+ 184 - 2
sys/src/cmd/cc/com.c

@@ -1,5 +1,7 @@
 #include "cc.h"
 
+int compar(Node*, int);
+
 void
 complex(Node *n)
 {
@@ -985,6 +987,8 @@ loop:
 	case OHI:
 		ccom(l);
 		ccom(r);
+		if(compar(n, 0) || compar(n, 1))
+			break;
 		relcon(l, r);
 		relcon(r, l);
 		goto common;
@@ -1082,7 +1086,7 @@ loop:
 			*n = *l;
 			break;
 		}
-		goto commun;
+		goto commute;
 
 	case OAND:
 		ccom(l);
@@ -1096,7 +1100,7 @@ loop:
 			break;
 		}
 
-	commun:
+	commute:
 		/* look for commutative constant */
 		if(r->op == OCONST) {
 			if(l->op == n->op) {
@@ -1162,3 +1166,181 @@ loop:
 		evconst(n);
 	}
 }
+
+/*	OEQ, ONE, OLE, OLS, OLT, OLO, OGE, OHS, OGT, OHI */
+static char *cmps[12] = 
+{
+	"==", "!=", "<=", "<=", "<", "<", ">=", ">=", ">", ">",
+};
+
+/* 128-bit numbers */
+typedef struct Big Big;
+struct Big
+{
+	vlong a;
+	uvlong b;
+};
+static int
+cmp(Big x, Big y)
+{
+	if(x.a != y.a){
+		if(x.a < y.a)
+			return -1;
+		return 1;
+	}
+	if(x.b != y.b){
+		if(x.b < y.b)
+			return -1;
+		return 1;
+	}
+	return 0;
+}
+static Big
+add(Big x, int y)
+{
+	uvlong ob;
+	
+	ob = x.b;
+	x.b += y;
+	if(y > 0 && x.b < ob)
+		x.a++;
+	if(y < 0 && x.b > ob)
+		x.a--;
+	return x;
+} 
+
+Big
+big(vlong a, uvlong b)
+{
+	Big x;
+
+	x.a = a;
+	x.b = b;
+	return x;
+}
+
+int
+compar(Node *n, int reverse)
+{
+	Big lo, hi, x;
+	int op;
+	char xbuf[40], cmpbuf[50];
+	Node *l, *r;
+	Type *lt, *rt;
+
+	/*
+	 * The point of this function is to diagnose comparisons 
+	 * that can never be true or that look misleading because
+	 * of the `usual arithmetic conversions'.  As an example 
+	 * of the latter, if x is a ulong, then if(x <= -1) really means
+	 * if(x <= 0xFFFFFFFF), while if(x <= -1LL) really means
+	 * what it says (but 8c compiles it wrong anyway).
+	 */
+
+	if(reverse){
+		r = n->left;
+		l = n->right;
+		op = comrel[relindex(n->op)];
+	}else{
+		l = n->left;
+		r = n->right;
+		op = n->op;
+	}
+
+	/*
+	 * Skip over left casts to find out the original expression range.
+	 */
+	while(l->op == OCAST)
+		l = l->left;
+	if(l->op == OCONST)
+		return 0;
+	lt = l->type;
+	if(l->op == ONAME){
+		lt = l->sym->type;
+		if(lt && lt->etype == TARRAY)
+			lt = lt->link;
+	}
+	if(lt == T)
+		return 0;
+	if(lt->etype == TXXX || lt->etype > TUVLONG)
+		return 0;
+	
+	/*
+	 * Skip over the right casts to find the on-screen value.
+	 */
+	if(r->op != OCONST)
+		return 0;
+	while(r->oldop == OCAST && !r->xcast)
+		r = r->left;
+	rt = r->type;
+	if(rt == T)
+		return 0;
+
+	x.b = r->vconst;
+	x.a = 0;
+	if((rt->etype&1) && r->vconst < 0)	/* signed negative */
+		x.a = ~0ULL;
+
+	if((lt->etype&1)==0){
+		/* unsigned */
+		lo = big(0, 0);
+		if(lt->width == 8)
+			hi = big(0, ~0ULL);
+		else
+			hi = big(0, (1LL<<(l->type->width*8))-1);
+	}else{
+		lo = big(~0ULL, -(1LL<<(l->type->width*8-1)));
+		hi = big(0, (1LL<<(l->type->width*8-1))-1);
+	}
+
+	switch(op){
+	case OLT:
+	case OLO:
+	case OGE:
+	case OHS:
+		if(cmp(x, lo) <= 0)
+			goto useless;
+		if(cmp(x, add(hi, 1)) >= 0)
+			goto useless;
+		break;
+	case OLE:
+	case OLS:
+	case OGT:
+	case OHI:
+		if(cmp(x, add(lo, -1)) <= 0)
+			goto useless;
+		if(cmp(x, hi) >= 0)
+			goto useless;
+		break;
+	case OEQ:
+	case ONE:
+		/*
+		 * Don't warn about comparisons if the expression
+		 * is as wide as the value: the compiler-supplied casts
+		 * will make both outcomes possible.
+		 */
+		if(lt->width >= rt->width && debug['w'] < 2)
+			return 0;
+		if(cmp(x, lo) < 0 || cmp(x, hi) > 0)
+			goto useless;
+		break;
+	}
+	return 0;
+
+useless:
+	if((x.a==0 && x.b<=9) || (x.a==~0LL && x.b >= -9ULL))
+		snprint(xbuf, sizeof xbuf, "%lld", x.b);
+	else if(x.a == 0)
+		snprint(xbuf, sizeof xbuf, "%#llux", x.b);
+	else
+		snprint(xbuf, sizeof xbuf, "%#llx", x.b);
+	if(reverse)
+		snprint(cmpbuf, sizeof cmpbuf, "%s %s %T",
+			xbuf, cmps[relindex(n->op)], lt);
+	else
+		snprint(cmpbuf, sizeof cmpbuf, "%T %s %s",
+			lt, cmps[relindex(n->op)], xbuf);
+	warn(n, "useless or misleading comparison: %s", cmpbuf);
+	return 0;
+}
+

+ 19 - 20
sys/src/cmd/cc/lex.c

@@ -395,7 +395,7 @@ long
 yylex(void)
 {
 	vlong vv;
-	long c, c1;
+	long c, c1, t;
 	char *cp;
 	Rune rune;
 	Sym *s;
@@ -540,8 +540,10 @@ l1:
 		if(yylval.vval != vv)
 			yyerror("overflow in character constant: 0x%lx", c);
 		else
-		if(c & 0x80)
+		if(c & 0x80){
+			nearln = lineno;
 			warn(Z, "sign-extended character constant");
+		}
 		yylval.vval = convvtox(vv, TCHAR);
 		return LCONST;
 
@@ -784,45 +786,42 @@ ncu:
 	if(mpatov(symb, &yylval.vval))
 		yyerror("overflow in constant");
 
+	vv = yylval.vval;
 	if(c1 & Numvlong) {
-		if(c1 & Numuns) {
-			c = LUVLCONST;
-			goto nret;
-		}
-		yylval.vval = convvtox(yylval.vval, TVLONG);
-		if(yylval.vval < 0) {
+		if((c1 & Numuns) || convvtox(vv, TVLONG) < 0) {
 			c = LUVLCONST;
+			t = TUVLONG;
 			goto nret;
 		}
 		c = LVLCONST;
+		t = TVLONG;
 		goto nret;
 	}
 	if(c1 & Numlong) {
-		if(c1 & Numuns) {
-			c = LULCONST;
-			goto nret;
-		}
-		yylval.vval = convvtox(yylval.vval, TLONG);
-		if(yylval.vval < 0) {
+		if((c1 & Numuns) || convvtox(vv, TLONG) < 0) {
 			c = LULCONST;
+			t = TULONG;
 			goto nret;
 		}
 		c = LLCONST;
+		t = TLONG;
 		goto nret;
 	}
-	if(c1 & Numuns) {
-		c = LUCONST;
-		goto nret;
-	}
-	yylval.vval = convvtox(yylval.vval, TINT);
-	if(yylval.vval < 0) {
+	if((c1 & Numuns) || convvtox(vv, TINT) < 0) {
 		c = LUCONST;
+		t = TUINT;
 		goto nret;
 	}
 	c = LCONST;
+	t = TINT;
 	goto nret;
 
 nret:
+	yylval.vval = convvtox(vv, t);
+	if(yylval.vval != vv){
+		nearln = lineno;
+		warn(Z, "truncated constant: %T %s", types[t], symb);
+	}
 	return c;
 
 casedot:

+ 2 - 0
sys/src/cmd/cc/scon.c

@@ -226,6 +226,7 @@ evconst(Node *n)
 	} else {
 		n->vconst = convvtox(v, n->type->etype);
 	}
+	n->oldop = n->op;
 	n->op = OCONST;
 }
 
@@ -375,6 +376,7 @@ acom2(Node *n, Type *t)
 	}
 	c1 = trm[0].mult;
 	if(j == 0) {
+		n->oldop = n->op;
 		n->op = OCONST;
 		n->vconst = c1;
 		return;

+ 5 - 0
sys/src/cmd/cc/sub.c

@@ -1484,6 +1484,7 @@ Init	onamesinit[] =
 	-1,		0,	0,
 };
 
+/*	OEQ, ONE, OLE, OLS, OLT, OLO, OGE, OHS, OGT, OHI */
 char	comrel[12] =
 {
 	ONE, OEQ, OGT, OHI, OGE, OHS, OLT, OLO, OLE, OLS,
@@ -1522,6 +1523,7 @@ int	typeilpinit[] =
 
 char	typechl[NTYPE];
 char	typechlv[NTYPE];
+char typechlvp[NTYPE];
 int	typechlinit[] =
 {
 	TCHAR, TUCHAR, TSHORT, TUSHORT, TINT, TUINT, TLONG, TULONG, -1,
@@ -1868,10 +1870,12 @@ tinit(void)
 		urk("typechl", nelem(typechl), typechlinit[i]);
 		typechl[typechlinit[i]] = 1;
 		typechlv[typechlinit[i]] = 1;
+		typechlvp[typechlinit[i]] = 1;
 	}
 	for(i=0; typechlpinit[i] >= 0; i++) {
 		urk("typechlp", nelem(typechlp), typechlpinit[i]);
 		typechlp[typechlpinit[i]] = 1;
+		typechlvp[typechlinit[i]] = 1;
 	}
 	for(i=0; typechlpfdinit[i] >= 0; i++) {
 		urk("typechlpfd", nelem(typechlpfd), typechlpfdinit[i]);
@@ -1893,6 +1897,7 @@ tinit(void)
 		urk("typev", nelem(typev), typevinit[i]);
 		typev[typevinit[i]] = 1;
 		typechlv[typevinit[i]] = 1;
+		typechlvp[typechlinit[i]] = 1;
 	}
 	for(i=0; typefdinit[i] >= 0; i++) {
 		urk("typefd", nelem(typefd), typefdinit[i]);

+ 3 - 3
sys/src/cmd/cfs/cfs.c

@@ -373,7 +373,7 @@ rwalk(Mfile *mf)
 		return;
 	}
 	if(c.thdr.newfid != c.thdr.fid){
-		if(c.thdr.newfid<0 || Nfid<=c.thdr.newfid)
+		if(c.thdr.newfid >= Nfid)
 			error("clone nfid out of range");
 		nmf = &mfile[c.thdr.newfid];
 		if(nmf->busy)
@@ -477,7 +477,7 @@ rread(Mfile *mf)
 			c.rhdr.count = statlen-off;
 		else
 			c.rhdr.count = cnt;
-		if(c.rhdr.count < 0){
+		if((int)c.rhdr.count < 0){
 			sendreply("eof");
 			return;
 		}
@@ -787,7 +787,7 @@ rcvmsg(P9fs *p, Fcall *f)
 
 	if((rlen = convM2S(datarcv, p->len, f)) != p->len)
 		error("rcvmsg format error, expected length %d, got %d", rlen, p->len);
-	if(f->fid<0 || Nfid<=f->fid){
+	if(f->fid >= Nfid){
 		fprint(2, "<-%s: %d %s on %d\n", p->name, f->type,
 			mname[f->type]? mname[f->type] : "mystery",
 			f->fid);

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

@@ -153,7 +153,7 @@ dformat(Disk *d, int f, char *name, ulong bsize, ulong psize)
 	 *  allocate allocation blocks
 	 */
 	for(i = 0; i < d->nab; i++)
-		if(dalloc(d, &dptr) < 0){
+		if(dalloc(d, &dptr) == Notabno){
 			fprint(2, "can't allocate allocation blocks\n");
 			return -1;
 		}

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

@@ -119,6 +119,6 @@ main(int argc, char *argv[])
 static void
 usage(void)
 {
-	print("Usage: cmp [-lsL] file1 file2 [offset1 [offset2] ]\n");
+	print("usage: cmp [-lLs] file1 file2 [offset1 [offset2] ]\n");
 	exits("usage");
 }

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

@@ -61,7 +61,7 @@ void	simple(char*, char*);
 void
 usage(void)
 {
-	punt("usage: con [-drCvsn] [-b baud] [-l [user]] [-c cmd] net!host[!service]");
+	punt("usage: con [-CdnrRsTv] [-b baud] [-l [user]] [-c cmd] net!host[!service]");
 }
 
 void

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

@@ -921,7 +921,7 @@ notefs(int fd)
 				fprint(2, "read9pmsg(%d) returns %d: %r\n", fd, n);
 			break;
 		}
-		if(convM2S(buf, n, &f) < 0)
+		if(convM2S(buf, n, &f) <= BIT16SZ)
 			break;
 		if(dbg)
 			fprint(2, "->%F\n", &f);

+ 6 - 4
sys/src/cmd/db/format.c

@@ -273,16 +273,18 @@ exform(int fcount, int prt, char *ifp, Map *map, int literal, int firstpass)
 
 		case 'I':
 		case 'i':
-			dotinc = machdata->das(map, dot, modifier, buf, sizeof(buf));
-			if (dotinc < 0)
+			i = machdata->das(map, dot, modifier, buf, sizeof(buf));
+			if (i < 0)
 				error("%r");
+			dotinc = i;
 			dprint("%s\n", buf);
 			break;
 
 		case 'M':
-			dotinc = machdata->hexinst(map, dot, buf, sizeof(buf));
-			if (dotinc < 0)
+			i = machdata->hexinst(map, dot, buf, sizeof(buf));
+			if (i < 0)
 				error("%r");
+			dotinc = i;
 			dprint("%s", buf);
 			if (*fp) {
 				dotinc = 0;

+ 1 - 1
sys/src/cmd/db/runpcs.c

@@ -28,7 +28,7 @@ runpcs(int runmode, int keepnote)
 		rput(cormap, mach->pc, dot);
 	dot = rget(cormap, mach->pc);
 	flush();
-	while (--loopcnt >= 0) {
+	while (loopcnt-- > 0) {
 		if(loopcnt != 0)
 			printpc();
 		if (runmode == SINGLE) {

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

@@ -630,7 +630,7 @@ if(chatty) print("files @%lluX\n", seek(disk->wfd, 0LL, 1));
 			fatal("open %s: %r", *argv);
 		if((d = dirfstat(sysfd)) == nil)
 			fatal("stat %s: %r", *argv);
-		if(d->length > 0xFFFFFFFF)
+		if(d->length > 0xFFFFFFFFU)
 			fatal("file %s too big\n", *argv, d->length);
 		if(commit)
 			print("Adding file %s, length %lld\n", *argv, d->length);

+ 1 - 1
sys/src/cmd/disk/kfs/ofcallfmt.c

@@ -161,7 +161,7 @@ dumpsome(char *ans, char *buf, long count)
 	if(count > DUMPL)
 		count = DUMPL;
 	for(i=0; i<count && printable; i++)
-		if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || buf[i]>127)
+		if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || (uchar)buf[i]>127)
 			printable = 0;
 	p = ans;
 	*p++ = '\'';

+ 1 - 1
sys/src/cmd/ext2srv/ext2subs.c

@@ -1449,7 +1449,7 @@ unlink( Xfile *file )
 	es = getext2(xf, EXT2_SUPER, 0);
 
 	/* get dir inode */
-	if( file->pinbr < 0 || file->pinbr > es.u.sb->s_inodes_count ){
+	if( file->pinbr >= es.u.sb->s_inodes_count ){
     		chat("inode number %d is too big...",  file->pinbr);
 		putext2(es);
 		errno = Eintern;

+ 1 - 1
sys/src/cmd/fossil/9fsys.c

@@ -1222,7 +1222,7 @@ fsysWstat(Fsys *fsys, int argc, char* argv[])
 	}
 	if(strcmp(argv[5], "-") != 0){
 		de.size = strtoull(argv[5], &p, 0);
-		if(argv[5][0] == '\0' || *p != '\0' || de.size < 0){
+		if(argv[5][0] == '\0' || *p != '\0' || (vlong)de.size < 0){
 			vtSetError("console wstat - bad length");
 			goto error;
 		}

+ 0 - 3
sys/src/cmd/iostats/iostats.c

@@ -174,9 +174,6 @@ main(int argc, char **argv)
 		stats->nrpc++;
 		stats->nproto += n;
 
-		if(r->work.fid < 0)
-			fatal("fid out of range");
-
 		DEBUG(2, "%F\n", &r->work);
 
 		type = r->work.type;

+ 1 - 1
sys/src/cmd/ip/ftpd.c

@@ -248,7 +248,7 @@ main(int argc, char **argv)
 		/*
 		 *  get rid of telnet control sequences (we don't need them)
 		 */
-		while(*cmd && *cmd == Iac){
+		while(*cmd && (uchar)*cmd == Iac){
 			cmd++;
 			if(*cmd)
 				cmd++;

+ 0 - 6
sys/src/cmd/ndb/cs.c

@@ -432,8 +432,6 @@ io(void)
 			freejob(job);
 			continue;
 		}
-		if(job->request.fid<0)
-			error("fid out of range");
 		lock(&dblock);
 		mf = newfid(job->request.fid);
 		if(debug)
@@ -563,10 +561,6 @@ rwalk(Job *job, Mfile *mf)
 
 	if(job->request.newfid != job->request.fid){
 		/* clone fid */
-		if(job->request.newfid<0){
-			err = "clone newfid out of range";
-			goto send;
-		}
 		nmf = newfid(job->request.newfid);
 		if(nmf->busy){
 			nmf = nil;

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

@@ -514,10 +514,6 @@ rwalk(Job *job, Mfile *mf)
 
 	if(job->request.newfid != job->request.fid){
 		/* clone fid */
-		if(job->request.newfid<0){
-			err = "clone newfid out of range";
-			goto send;
-		}
 		nmf = copyfid(mf, job->request.newfid);
 		if(nmf == nil){
 			err = "clone bad newfid";

+ 1 - 1
sys/src/cmd/ql/obj.c

@@ -434,7 +434,7 @@ zaddr(uchar *p, Adr *a, Sym *h[])
 	a->name = p[3];
 	c = 4;
 
-	if(a->reg < 0 || a->reg > NREG) {
+	if(a->reg > NREG) {
 		print("register out of range %d\n", a->reg);
 		p[0] = AEND+1;
 		return 0;	/*  force real diagnostic */

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

@@ -1288,7 +1288,7 @@ lookup(char *s, int doreset)
 		if(t == s)
 			goto BadCoords;
 		/* degree sign etc. is optional */
-		if(*t == L'°')
+		if((uchar)*t == L'°')
 			deg = DEG(getra(s));
 		if(doreset)
 			reset();

+ 1 - 1
sys/src/cmd/srvold9p/9p1lib.c

@@ -149,7 +149,7 @@ dumpsome(char *ans, char *buf, long count)
 	if(count > DUMPL)
 		count = DUMPL;
 	for(i=0; i<count && printable; i++)
-		if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || buf[i]>127)
+		if((buf[i]<32 && buf[i] !='\n' && buf[i] !='\t') || (uchar)buf[i]>127)
 			printable = 0;
 	p = ans;
 	*p++ = '\'';

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

@@ -1165,7 +1165,7 @@ void
 cntledit(char *tag)
 {
 	char buf[256];
-	ulong l;
+	long l;
 
 	buttons(Up);
 	if(type(buf, tag) == 0)

+ 3 - 2
sys/src/cmd/vac/vacfs.c

@@ -519,11 +519,12 @@ rwrite(Fid *f)
 	cnt = rhdr.count;
 	if(f->qid.type & QTDIR)
 		return "file is a directory";
-	thdr.count = vfWrite(vf, buf, cnt, off, "none");
-	if(thdr.count < 0) {
+	cnt = vfWrite(vf, buf, cnt, off, "none");
+	if(cnt < 0) {
 fprint(2, "write failed: %s\n", vtGetError());
 		return vtGetError();
 	}
+	thdr.count = cnt;
 	return 0;
 }
 

+ 2 - 6
sys/src/cmd/vnc/devdraw.c

@@ -2081,10 +2081,6 @@ drawactive(int active)
 	if(active){
 		drawblankscreen(0);
 		sdraw.blanktime = 0;
-	}else{
-		if(blanktime && TK2SEC(sdraw.blanktime)/60 >= blanktime)
-			drawblankscreen(1);
-		else
-			sdraw.blanktime++;
-	}
+	}else
+		sdraw.blanktime++;
 }

+ 0 - 83
sys/src/cmd/wikifs/fs.c

@@ -807,89 +807,6 @@ usage(void)
 	exits("usage");
 }
 
-char*
-getremotesys(char *ndir)
-{
-	char buf[128], *serv, *sys;
-	int fd, n;
-
-	snprint(buf, sizeof buf, "%s/remote", ndir);
-	sys = nil;
-	fd = open(buf, OREAD);
-	if(fd >= 0){
-		n = read(fd, buf, sizeof(buf)-1);
-		if(n>0){
-			buf[n-1] = 0;
-			serv = strchr(buf, '!');
-			if(serv)
-				*serv = 0;
-			sys = estrdup(buf);
-		}
-		close(fd);
-	}
-	if(sys == nil)
-		sys = estrdup("unknown");
-	return sys;
-}
-
-void
-listensrv(Srv *os, char *addr)
-{
-	int ctl, data, nctl;
-	char ndir[NETPATHLEN], dir[NETPATHLEN];
-	Srv *s;
-
-	switch(rfork(RFPROC|RFMEM|RFNOWAIT)){
-	case -1:
-		sysfatal("rfork: %r");
-	default:
-		return;
-	case 0:
-		break;
-	}
-
-	ctl = announce(addr, dir);
-	if(ctl < 0){
-		fprint(2, "wikifs announce %s: %r", addr);
-		_exits(0);
-	}
-
-	for(;;){
-		nctl = listen(dir, ndir);
-		if(nctl < 0){
-			fprint(2, "wikifs listen %s: %r", addr);
-			_exits(0);
-		}
-	
-		switch(rfork(RFPROC|RFMEM|RFNOWAIT)){
-		case -1:
-			fprint(2, "rfork answerer: %r\n");
-			continue;
-		default:
-			continue;
-		case 0:
-			break;
-		}
-
-		data = accept(ctl, ndir);
-		close(nctl);
-		if(data < 0){
-			fprint(2, "wikifs accept %s: %r\n", ndir);
-			_exits(nil);
-		}
-
-		s = emalloc(sizeof *s);
-		*s = *os;
-		s->aux = getremotesys(ndir);
-		s->infd = s->outfd = data;
-		srv(s);
-		close(data);
-		free(s->aux);
-		free(s);
-		_exits(nil);
-	}
-}
-
 void
 main(int argc, char **argv)
 {

+ 0 - 77
sys/src/lib9p/_post.c

@@ -1,77 +0,0 @@
-#include <u.h>
-#include <libc.h>
-#include <fcall.h>
-#include <thread.h>
-#include <9p.h>
-#include <auth.h>
-#include "post.h"
-
-Postcrud*
-_post1(Srv *s, char *name, char *mtpt, int flag)
-{
-	Postcrud *p;
-
-	p = emalloc9p(sizeof *p);
-	if(!s->nopipe){
-		if(pipe(p->fd) < 0)
-			sysfatal("pipe: %r");
-		s->infd = s->outfd = p->fd[1];
-		s->srvfd = p->fd[0];
-	}
-	if(name)
-		if(postfd(name, s->srvfd) < 0)
-			sysfatal("postfd %s: %r", name);
-	p->s = s;
-	p->mtpt = mtpt;
-	p->flag = flag;
-	return p;
-}
-
-void
-_post2(void *v)
-{
-	Srv *s;
-
-	s = v;
-	if(!s->leavefdsopen){
-		rfork(RFNOTEG);
-		rendezvous((ulong)s, 0);
-		close(s->srvfd);
-	}
-	srv(s);
-}
-
-void
-_post3(Postcrud *p)
-{
-	/*
-	 * Normally the server is posting as the last thing it does
-	 * before exiting, so the correct thing to do is drop into
-	 * a different fd space and close the 9P server half of the
-	 * pipe before trying to mount the kernel half.  This way,
-	 * if the file server dies, we don't have a ref to the 9P server
-	 * half of the pipe.  Then killing the other procs will drop
-	 * all the refs on the 9P server half, and the mount will fail.
-	 * Otherwise the mount hangs forever.
-	 *
-	 * Libthread in general and acme win in particular make
-	 * it hard to make this fd bookkeeping work out properly,
-	 * so leaveinfdopen is a flag that win sets to opt out of this
-	 * safety net.
-	 */
-	if(!p->s->leavefdsopen){
-		rfork(RFFDG);
-		rendezvous((ulong)p->s, 0);
-		close(p->s->infd);
-		if(p->s->infd != p->s->outfd)
-			close(p->s->outfd);
-	}
-
-	if(p->mtpt){
-		if(amount(p->s->srvfd, p->mtpt, p->flag, "") == -1)
-			sysfatal("mount %s: %r", p->mtpt);
-	}else
-		close(p->s->srvfd);
-	free(p);
-}
-

+ 198 - 0
sys/src/lib9p/auth.c

@@ -0,0 +1,198 @@
+#include <u.h>
+#include <libc.h>
+#include <auth.h>
+#include <fcall.h>
+#include <thread.h>
+#include <9p.h>
+
+typedef struct Afid Afid;
+
+struct Afid
+{
+	AuthRpc *rpc;
+	char *uname;
+	char *aname;
+	int authok;
+	int afd;
+};
+
+static uvlong authgen = 1ULL<<63;
+
+void
+auth9p(Req *r)
+{
+	char *spec;
+	Afid *afid;
+	
+	afid = emalloc9p(sizeof(Afid));
+	afid->afd = open("/mnt/factotum/rpc", ORDWR);
+	if(afid->afd < 0)
+		goto error;
+
+	if((afid->rpc = auth_allocrpc(afid->afd)) == nil)
+		goto error;
+
+	if(r->ifcall.uname[0] == 0)
+		goto error;
+	afid->uname = estrdup9p(r->ifcall.uname);
+	afid->aname = estrdup9p(r->ifcall.aname);
+
+	spec = r->srv->keyspec;
+	if(spec == nil)
+		spec = "proto=p9any role=server";
+
+	if(auth_rpc(afid->rpc, "start", spec, strlen(spec)) != ARok)
+		goto error;
+
+	r->afid->qid.type = QTAUTH;
+	r->afid->qid.path = ++authgen;
+	r->afid->qid.vers = 0;
+	r->afid->omode = ORDWR;
+	r->ofcall.qid = r->afid->qid;
+	r->afid->aux = afid;
+	respond(r, nil);
+	return;
+
+error:
+	if(afid->rpc)
+		auth_freerpc(afid->rpc);
+	if(afid->uname)
+		free(afid->uname);
+	if(afid->aname)
+		free(afid->aname);
+	if(afid->afd >= 0)
+		close(afid->afd);
+	free(afid);
+	responderror(r);
+}
+
+static int
+_authread(Afid *afid, void *data, int count)
+{
+	AuthInfo *ai;
+	
+	switch(auth_rpc(afid->rpc, "read", nil, 0)){
+	case ARdone:
+		ai = auth_getinfo(afid->rpc);
+		if(ai == nil)
+			return -1;
+		auth_freeAI(ai);
+		if(chatty9p)
+			fprint(2, "authenticate %s/%s: ok\n", afid->uname, afid->aname);
+		afid->authok = 1;
+		return 0;
+
+	case ARok:
+		if(count < afid->rpc->narg){
+			werrstr("authread count too small");
+			return -1;
+		}
+		count = afid->rpc->narg;
+		memmove(data, afid->rpc->arg, count);
+		return count;
+	
+	case ARphase:
+	default:
+		werrstr("authrpc botch");
+		return -1;
+	}
+}
+
+void
+authread(Req *r)
+{
+	int n;
+	Afid *afid;
+	Fid *fid;
+	
+	fid = r->fid;
+	afid = fid->aux;
+	if(afid == nil || r->fid->qid.type != QTAUTH){
+		respond(r, "not an auth fid");
+		return;
+	}
+	n = _authread(afid, r->ofcall.data, r->ifcall.count);
+	if(n < 0){
+		responderror(r);
+		return;
+	}
+	r->ofcall.count = n;
+	respond(r, nil);
+}
+
+void
+authwrite(Req *r)
+{
+	Afid *afid;
+	Fid *fid;
+	
+	fid = r->fid;
+	afid = fid->aux;
+	if(afid == nil || r->fid->qid.type != QTAUTH){
+		respond(r, "not an auth fid");
+		return;
+	}
+	if(auth_rpc(afid->rpc, "write", r->ifcall.data, r->ifcall.count) != ARok){
+		responderror(r);
+		return;
+	}
+	r->ofcall.count = r->ifcall.count;
+	respond(r, nil);
+}
+
+void
+authdestroy(Fid *fid)
+{
+	Afid *afid;
+	
+	if((fid->qid.type & QTAUTH) && (afid = fid->aux) != nil){
+		if(afid->rpc)
+			auth_freerpc(afid->rpc);
+		close(afid->afd);
+		free(afid->uname);
+		free(afid->aname);
+		free(afid);
+		fid->aux = nil;
+	}
+}
+
+int
+authattach(Req *r)
+{
+	Afid *afid;
+	char buf[ERRMAX];
+	
+	if(r->afid == nil){
+		respond(r, "not authenticated");
+		return -1;
+	}
+
+	afid = r->afid->aux;
+	if((r->afid->qid.type&QTAUTH) == 0 || afid == nil){
+		respond(r, "not an auth fid");
+		return -1;
+	}
+
+	if(!afid->authok){
+		if(_authread(afid, buf, 0) < 0){
+			responderror(r);
+			return -1;
+		}
+	}
+	
+	if(strcmp(afid->uname, r->ifcall.uname) != 0){
+		snprint(buf, sizeof buf, "auth uname mismatch: %s vs %s", 
+			afid->uname, r->ifcall.uname);
+		respond(r, buf);
+		return -1;
+	}
+
+	if(strcmp(afid->aname, r->ifcall.aname) != 0){
+		snprint(buf, sizeof buf, "auth aname mismatch: %s vs %s", 
+			afid->aname, r->ifcall.aname);
+		respond(r, buf);
+		return -1;
+	}
+	return 0;
+}
+

+ 103 - 0
sys/src/lib9p/listen.c

@@ -0,0 +1,103 @@
+#include <u.h>
+#include <libc.h>
+#include <auth.h>
+#include <fcall.h>
+#include <thread.h>
+#include <9p.h>
+
+static void listenproc(void*);
+static void srvproc(void*);
+static char *getremotesys(char*);
+
+void
+_listensrv(Srv *os, char *addr)
+{
+	Srv *s;
+
+	if(_forker == nil)
+		sysfatal("no forker");
+	s = emalloc9p(sizeof *s);
+	*s = *os;
+	s->addr = estrdup9p(addr);
+	_forker(listenproc, s, 0);
+}
+
+static void
+listenproc(void *v)
+{
+	char ndir[NETPATHLEN], dir[NETPATHLEN];
+	int ctl, data, nctl;
+	Srv *os, *s;
+	
+	os = v;
+	ctl = announce(os->addr, dir);
+	if(ctl < 0){
+		fprint(2, "%s: announce %s: %r", argv0, os->addr);
+		return;
+	}
+
+	for(;;){
+		nctl = listen(dir, ndir);
+		if(nctl < 0){
+			fprint(2, "%s: listen %s: %r", argv0, os->addr);
+			break;
+		}
+		
+		data = accept(ctl, ndir);
+		if(data < 0){
+			fprint(2, "%s: accept %s: %r\n", argv0, ndir);
+			continue;
+		}
+
+		s = emalloc9p(sizeof *s);
+		*s = *os;
+		s->addr = getremotesys(ndir);
+		s->infd = s->outfd = data;
+		s->fpool = nil;
+		s->rpool = nil;
+		s->rbuf = nil;
+		s->wbuf = nil;
+		_forker(srvproc, s, 0);
+	}
+	free(os->addr);
+	free(os);
+}
+
+static void
+srvproc(void *v)
+{
+	int data;
+	Srv *s;
+	
+	s = v;
+	data = s->infd;
+	srv(s);
+	close(data);
+	free(s->addr);
+	free(s);
+}
+
+static char*
+getremotesys(char *ndir)
+{
+	char buf[128], *serv, *sys;
+	int fd, n;
+
+	snprint(buf, sizeof buf, "%s/remote", ndir);
+	sys = nil;
+	fd = open(buf, OREAD);
+	if(fd >= 0){
+		n = read(fd, buf, sizeof(buf)-1);
+		if(n>0){
+			buf[n-1] = 0;
+			serv = strchr(buf, '!');
+			if(serv)
+				*serv = 0;
+			sys = estrdup9p(buf);
+		}
+		close(fd);
+	}
+	if(sys == nil)
+		sys = estrdup9p("unknown");
+	return sys;
+}

+ 5 - 3
sys/src/lib9p/mkfile

@@ -2,21 +2,23 @@
 
 LIB=/$objtype/lib/lib9p.a
 OFILES=\
-	_post.$O\
+	auth.$O\
 	dirread.$O\
 	fid.$O\
 	file.$O\
 	intmap.$O\
+	listen.$O\
 	mem.$O\
 	req.$O\
 	parse.$O\
 	post.$O\
+	rfork.$O\
 	srv.$O\
-	tpost.$O\
+	thread.$O\
 	uid.$O\
 	util.$O\
 
-HFILES=/sys/include/9p.h post.h
+HFILES=/sys/include/9p.h
 
 UPDATE=\
 	mkfile\

+ 60 - 13
sys/src/lib9p/post.c

@@ -3,22 +3,69 @@
 #include <fcall.h>
 #include <thread.h>
 #include <9p.h>
-#include "post.h"
+#include <auth.h>
+
+static void postproc(void*);
 
 void
-postmountsrv(Srv *s, char *name, char *mtpt, int flag)
+_postmountsrv(Srv *s, char *name, char *mtpt, int flag)
 {
-	Postcrud *p;
-
-	p = _post1(s, name, mtpt, flag);
-	switch(rfork(RFPROC|RFNAMEG|RFMEM)){
-	case -1:
-		sysfatal("rfork: %r");
-	case 0:
-		_post2(s);
-		exits(nil);
-	default:
-		_post3(p);
+	int fd[2];
+
+	if(!s->nopipe){
+		if(pipe(fd) < 0)
+			sysfatal("pipe: %r");
+		s->infd = s->outfd = fd[1];
+		s->srvfd = fd[0];
+	}
+	if(name)
+		if(postfd(name, s->srvfd) < 0)
+			sysfatal("postfd %s: %r", name);
+
+	if(_forker == nil)
+		sysfatal("no forker");
+	_forker(postproc, s, RFNAMEG);
+
+	/*
+	 * Normally the server is posting as the last thing it does
+	 * before exiting, so the correct thing to do is drop into
+	 * a different fd space and close the 9P server half of the
+	 * pipe before trying to mount the kernel half.  This way,
+	 * if the file server dies, we don't have a ref to the 9P server
+	 * half of the pipe.  Then killing the other procs will drop
+	 * all the refs on the 9P server half, and the mount will fail.
+	 * Otherwise the mount hangs forever.
+	 *
+	 * Libthread in general and acme win in particular make
+	 * it hard to make this fd bookkeeping work out properly,
+	 * so leaveinfdopen is a flag that win sets to opt out of this
+	 * safety net.
+	 */
+	if(!s->leavefdsopen){
+		rfork(RFFDG);
+		rendezvous(0, 0);
+		close(s->infd);
+		if(s->infd != s->outfd)
+			close(s->outfd);
 	}
+
+	if(mtpt){
+		if(amount(s->srvfd, mtpt, flag, "") == -1)
+			sysfatal("mount %s: %r", mtpt);
+	}else
+		close(s->srvfd);
 }
 
+static void
+postproc(void *v)
+{
+	Srv *s;
+
+	s = v;
+	if(!s->leavefdsopen){
+		rfork(RFNOTEG);
+		rendezvous(0, 0);
+		close(s->srvfd);
+	}
+	srv(s);
+}

+ 0 - 13
sys/src/lib9p/post.h

@@ -1,13 +0,0 @@
-typedef struct Postcrud Postcrud;
-struct Postcrud
-{
-	int fd[2];
-	Srv *s;
-	char *name;
-	char *mtpt;
-	int flag;
-};
-
-Postcrud *_post1(Srv*, char*, char*, int);
-void _post2(void*);
-void _post3(Postcrud*);

+ 10 - 3
sys/src/lib9p/ramfs.c

@@ -129,6 +129,7 @@ usage(void)
 void
 main(int argc, char **argv)
 {
+	char *addr = nil;
 	char *srvname = nil;
 	char *mtpt = nil;
 	Qid q;
@@ -140,6 +141,9 @@ main(int argc, char **argv)
 	case 'D':
 		chatty9p++;
 		break;
+	case 'a':
+		addr = EARGF(usage());
+		break;
 	case 's':
 		srvname = EARGF(usage());
 		break;
@@ -155,9 +159,12 @@ main(int argc, char **argv)
 
 	if(chatty9p)
 		fprint(2, "ramsrv.nopipe %d srvname %s mtpt %s\n", fs.nopipe, srvname, mtpt);
-	if(srvname == nil && mtpt == nil)
-		sysfatal("you should at least specify a -s or -m option");
+	if(addr == nil && srvname == nil && mtpt == nil)
+		sysfatal("must specify -a, -s, or -m option");
+	if(addr)
+		listensrv(&fs, addr);
 
-	postmountsrv(&fs, srvname, mtpt, MREPL|MCREATE);
+	if(srvname || mtpt)
+		postmountsrv(&fs, srvname, mtpt, MREPL|MCREATE);
 	exits(0);
 }

+ 34 - 0
sys/src/lib9p/rfork.c

@@ -0,0 +1,34 @@
+#include <u.h>
+#include <libc.h>
+#include <fcall.h>
+#include <thread.h>
+#include <9p.h>
+
+static void
+rforker(void (*fn)(void*), void *arg, int flag)
+{
+	switch(rfork(RFPROC|RFMEM|RFNOWAIT|flag)){
+	case -1:
+		sysfatal("rfork: %r");
+	default:
+		return;
+	case 0:
+		fn(arg);
+		_exits(0);
+	}
+}
+
+void
+listensrv(Srv *s, char *addr)
+{
+	_forker = rforker;
+	_listensrv(s, addr);
+}
+
+void
+postmountsrv(Srv *s, char *name, char *mtpt, int flag)
+{
+	_forker = rforker;
+	_postmountsrv(s, name, mtpt, flag);
+}
+

+ 15 - 3
sys/src/lib9p/srv.c

<
@@ -5,6 +5,8 @@
 #include <thread.h>
 #include <9p.h>
 
+void (*_forker)(void(*)(void*), void*, int);
+
 static char Ebadattach[] = "unknown specifier in attach";
 static char Ebadoffset[] = "bad offset";
 static char Ebadcount[] = "bad count";
@@ -463,7 +465,7 @@ sread(Srv *srv, Req *r)
 		respond(r, Eunknownfid);
 		return;
 	}
-	if(r->ifcall.count < 0){
+	if((int)r->ifcall.count < 0){
 		respond(r, Ebotch);
 		return;
 	}
@@ -509,7 +511,7 @@ swrite(Srv *srv, Req *r)
 		respond(r, Eunknownfid);
 		return;
 	}
-	if(r->ifcall.count < 0){
+	if((int)r->ifcall.count < 0){
 		respond(r, Ebotch);
 		return;
 	}
@@ -592,6 +594,7 @@ sstat(Srv *srv, Req *r)
 		return;
 	}
 	if(r->fid->file){
+		/* should we rlock the file? */
 		r->d = r->fid->file->Dir;
 		if(r->d.name)
 			r->d.name = estrdup9p(r->d.name);
@@ -630,7 +633,7 @@ rstat(Req *r, char *error)
 	}
 	r->ofcall.nstat = convD2M(&r->d, statbuf, n);