Browse Source

Plan 9 from Bell Labs 2007-03-09

David du Colombier 13 years ago
parent
commit
9e9d4a8c6e

+ 36 - 40
dist/replica/_plan9.db

@@ -340,10 +340,10 @@
 386/bin/ndb - 20000000775 sys sys 985743147 0
 386/bin/ndb/cs - 775 sys sys 1169612028 150911
 386/bin/ndb/csquery - 775 sys sys 1168402337 61702
-386/bin/ndb/dns - 775 sys sys 1173298949 272731
-386/bin/ndb/dnsdebug - 775 sys sys 1173298950 246762
+386/bin/ndb/dns - 775 sys sys 1173385412 273424
+386/bin/ndb/dnsdebug - 775 sys sys 1173385413 247453
 386/bin/ndb/dnsquery - 775 sys sys 1173113879 63870
-386/bin/ndb/dnstcp - 775 sys sys 1173298950 245622
+386/bin/ndb/dnstcp - 775 sys sys 1173385415 246310
 386/bin/ndb/ipquery - 775 sys sys 1169612031 96994
 386/bin/ndb/mkdb - 775 sys sys 1168402340 64211
 386/bin/ndb/mkhash - 775 sys sys 1168402340 84780
@@ -405,7 +405,7 @@
 386/bin/snap - 775 sys sys 1136346852 313627
 386/bin/snapfs - 775 sys sys 1134389876 388292
 386/bin/sniffer - 775 sys sys 1038443185 99028
-386/bin/snoopy - 775 sys sys 1173212580 192338
+386/bin/snoopy - 775 sys sys 1173385415 192339
 386/bin/sort - 775 sys sys 1168402349 82523
 386/bin/spin - 775 sys sys 1134151359 758520
 386/bin/split - 775 sys sys 1168402349 75886
@@ -534,7 +534,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 1070519112 0
 386/lib/ape/lib9.a - 664 sys sys 1135531447 6906
-386/lib/ape/libap.a - 664 sys sys 1173039817 819938
+386/lib/ape/libap.a - 664 sys sys 1173410635 783116
 386/lib/ape/libbsd.a - 664 sys sys 1146156978 183900
 386/lib/ape/libdraw.a - 664 sys sys 1155491760 621772
 386/lib/ape/libfmt.a - 664 sys sys 1146156980 156706
@@ -561,7 +561,7 @@
 386/lib/libhttpd.a - 664 sys sys 1168402367 99458
 386/lib/libip.a - 664 sys sys 1169612032 35672
 386/lib/libl.a - 664 sys sys 1168402367 5372
-386/lib/libmach.a - 664 sys sys 1172203058 785440
+386/lib/libmach.a - 664 sys sys 1173410637 785440
 386/lib/libmemdraw.a - 664 sys sys 1168402369 284092
 386/lib/libmemlayer.a - 664 sys sys 1168402369 47360
 386/lib/libmp.a - 664 sys sys 1170879862 79978
@@ -7519,7 +7519,7 @@ sys/man/2/mouse - 664 sys sys 1140900146 4952
 sys/man/2/mp - 664 sys sys 1140106703 10762
 sys/man/2/muldiv - 664 sys sys 984709633 639
 sys/man/2/nan - 664 sys sys 975084242 937
-sys/man/2/ndb - 664 sys sys 1173239303 9603
+sys/man/2/ndb - 664 sys sys 1173401633 9573
 sys/man/2/notify - 664 sys sys 1032058674 6376
 sys/man/2/object - 664 sys sys 944959695 3864
 sys/man/2/open - 664 sys sys 1015091524 3404
@@ -7746,7 +7746,7 @@ sys/man/8/mkpaqfs - 664 sys sys 1018386778 892
 sys/man/8/mksacfs - 664 sys sys 964886843 710
 sys/man/8/mouse - 664 sys sys 971455511 2476
 sys/man/8/na - 664 sys sys 958527089 859
-sys/man/8/ndb - 664 sys sys 1173120870 10642
+sys/man/8/ndb - 664 sys sys 1173401577 10952
 sys/man/8/newuser - 664 sys sys 1116954242 2418
 sys/man/8/nfsserver - 664 sys sys 1163208425 3587
 sys/man/8/pcmcia - 664 sys sys 944959679 408
@@ -7794,7 +7794,7 @@ sys/src/9 - 20000000775 sys sys 1063857477 0
 sys/src/9/alphapc - 20000000775 sys sys 1137179966 0
 sys/src/9/alphapc/apc - 664 sys sys 1131289706 630
 sys/src/9/alphapc/apccpu - 664 sys sys 1142958706 532
-sys/src/9/alphapc/arch164.c - 664 sys sys 1015012783 6100
+sys/src/9/alphapc/arch164.c - 664 sys sys 1173386682 6082
 sys/src/9/alphapc/audio.h - 664 sys sys 1015012783 349
 sys/src/9/alphapc/axp.h - 664 sys sys 1015012783 1090
 sys/src/9/alphapc/cga.c - 664 sys sys 1015012783 1814
@@ -7815,12 +7815,12 @@ sys/src/9/alphapc/initcode - 664 sys sys 1039753419 779
 sys/src/9/alphapc/io.h - 664 sys sys 1137179966 4618
 sys/src/9/alphapc/kbd.c - 664 sys sys 1015012785 8676
 sys/src/9/alphapc/l.s - 664 sys sys 1143129848 9367
-sys/src/9/alphapc/main.c - 664 sys sys 1143129763 13748
+sys/src/9/alphapc/main.c - 664 sys sys 1173386681 13753
 sys/src/9/alphapc/mem.h - 664 sys sys 1137179967 2312
 sys/src/9/alphapc/memmove.s - 664 sys sys 1015012786 2936
 sys/src/9/alphapc/memset.s - 664 sys sys 1015012786 844
-sys/src/9/alphapc/mkfile - 664 sys sys 1109218102 1682
-sys/src/9/alphapc/mmu.c - 664 sys sys 1169491834 5189
+sys/src/9/alphapc/mkfile - 664 sys sys 1173412020 1973
+sys/src/9/alphapc/mmu.c - 664 sys sys 1173386681 5219
 sys/src/9/alphapc/osf1pal.h - 664 sys sys 1137179966 1471
 sys/src/9/alphapc/pci.c - 664 sys sys 1039753420 7868
 sys/src/9/alphapc/screen.h - 664 sys sys 1147108286 3923
@@ -7855,7 +7855,7 @@ sys/src/9/bitsy/l.s - 664 sys sys 1055700934 18211
 sys/src/9/bitsy/main.c - 664 sys sys 1143129874 8951
 sys/src/9/bitsy/map - 664 sys sys 1017695515 236
 sys/src/9/bitsy/mem.h - 664 sys sys 1055700932 8049
-sys/src/9/bitsy/mkfile - 664 sys sys 1131289775 2459
+sys/src/9/bitsy/mkfile - 664 sys sys 1173368204 2832
 sys/src/9/bitsy/mmu.c - 664 sys sys 1171761416 11656
 sys/src/9/bitsy/mouse.c - 664 sys sys 1017695516 962
 sys/src/9/bitsy/paqfiles - 20000000775 sys sys 1039727524 0
@@ -7872,7 +7872,7 @@ sys/src/9/bitsy/sa1110dma.h - 664 sys sys 1017695520 381
 sys/src/9/bitsy/screen.c - 664 sys sys 1053340962 10145
 sys/src/9/bitsy/screen.h - 664 sys sys 1147023548 284
 sys/src/9/bitsy/sd.h - 664 sys sys 1037029038 0
-sys/src/9/bitsy/sdata.c - 664 sys sys 1171761416 44377
+sys/src/9/bitsy/sdata.c - 664 sys sys 1173368216 44377
 sys/src/9/bitsy/tar.c - 664 sys sys 1017695521 1375
 sys/src/9/bitsy/trap.c - 664 sys sys 1105030166 19484
 sys/src/9/bitsy/uartsa1110.c - 664 sys sys 1142741102 8537
@@ -8157,7 +8157,7 @@ sys/src/9/port/pgrp.c - 664 sys sys 1138458260 4760
 sys/src/9/port/portclock.c - 664 sys sys 1146746630 4276
 sys/src/9/port/portdat.h - 664 sys sys 1155995676 22703
 sys/src/9/port/portfns.h - 664 sys sys 1146746630 11059
-sys/src/9/port/portmkfile - 664 sys sys 1131907975 2062
+sys/src/9/port/portmkfile - 664 sys sys 1173368230 1387
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
 sys/src/9/port/proc.c - 664 sys sys 1166244036 28770
 sys/src/9/port/qio.c - 664 sys sys 1070287837 23562
@@ -8833,7 +8833,8 @@ sys/src/ape/lib/ap/stdio/vprintf.c - 664 sys sys 1014921983 134
 sys/src/ape/lib/ap/stdio/vsnprintf.c - 664 sys sys 1134052382 267
 sys/src/ape/lib/ap/stdio/vsprintf.c - 664 sys sys 1134052382 254
 sys/src/ape/lib/ap/syscall - 20000000775 sys sys 1039727535 0
-sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1139690286 2667
+sys/src/ape/lib/ap/syscall/geninstall - 775 sys sys 1173384418 425
+sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173384418 164
 sys/src/ape/lib/bsd - 20000000775 sys sys 1063858406 0
 sys/src/ape/lib/bsd/_sock_ingetaddr.c - 664 sys sys 1014921994 836
 sys/src/ape/lib/bsd/_sock_ipattr.c - 664 sys sys 1014921994 577
@@ -12665,21 +12666,21 @@ sys/src/cmd/mug.c - 664 sys sys 1157143847 24888
 sys/src/cmd/mv.c - 664 sys sys 1163029439 4682
 sys/src/cmd/ndb - 20000000775 sys sys 1080135004 0
 sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1173059857 6856
-sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1173161431 10636
+sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1173335487 10645
 sys/src/cmd/ndb/cs.c - 664 sys sys 1163208617 33080
-sys/src/cmd/ndb/csquery.c - 664 sys sys 1014926159 1062
-sys/src/cmd/ndb/dblookup.c - 664 sys sys 1173238983 18199
+sys/src/cmd/ndb/csquery.c - 664 sys sys 1173401775 1073
+sys/src/cmd/ndb/dblookup.c - 664 sys sys 1173335538 18207
 sys/src/cmd/ndb/dn.c - 664 sys sys 1173239201 32107
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1173059947 2517
 sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1173238959 3158
-sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173300735 20768
-sys/src/cmd/ndb/dns.c - 664 sys sys 1173300607 15708
-sys/src/cmd/ndb/dns.h - 664 sys sys 1173300569 9985
-sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173300569 8640
-sys/src/cmd/ndb/dnserver.c - 664 sys sys 1173060400 4449
-sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1120564714 2198
-sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173300569 7709
-sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1173239157 5693
+sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173401935 22144
+sys/src/cmd/ndb/dns.c - 664 sys sys 1173401831 15957
+sys/src/cmd/ndb/dns.h - 664 sys sys 1173335529 9992
+sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173401872 8650
+sys/src/cmd/ndb/dnserver.c - 664 sys sys 1173335425 4431
+sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1173401783 2199
+sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173401840 7704
+sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1173335517 5678
 sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711426 773
 sys/src/cmd/ndb/mkdb.c - 664 sys sys 957402054 2886
 sys/src/cmd/ndb/mkfile - 664 sys sys 1173059600 1984
@@ -12801,7 +12802,7 @@ sys/src/cmd/postscript/common/common.c - 664 sys sys 1015090116 6737
 sys/src/cmd/postscript/common/common.h - 664 sys sys 944961054 780
 sys/src/cmd/postscript/common/ext.h - 664 sys sys 944961054 1089
 sys/src/cmd/postscript/common/gen.h - 664 sys sys 944961053 1135
-sys/src/cmd/postscript/common/getopt.c - 664 sys sys 944961053 1101
+sys/src/cmd/postscript/common/getopt.c - 664 sys sys 1173377512 1098
 sys/src/cmd/postscript/common/glob.c - 664 sys sys 944961053 821
 sys/src/cmd/postscript/common/misc.c - 664 sys sys 944961053 3979
 sys/src/cmd/postscript/common/mkfile - 664 sys sys 953344625 261
@@ -14097,8 +14098,8 @@ sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1067722781 1111
 sys/src/cmd/upas/smtp/smtpd.y - 664 sys sys 1143670612 6961
 sys/src/cmd/upas/smtp/spam.c - 664 sys sys 1139699502 10238
 sys/src/cmd/upas/unesc - 20000000775 sys sys 1075080255 0
-sys/src/cmd/upas/unesc/mkfile - 664 sys sys 1075080255 164
-sys/src/cmd/upas/unesc/unesc.c - 664 sys sys 1075080255 789
+sys/src/cmd/upas/unesc/mkfile - 664 sys sys 1173383407 142
+sys/src/cmd/upas/unesc/unesc.c - 664 sys sys 1173383408 969
 sys/src/cmd/upas/vf - 20000000775 sys sys 1064589607 0
 sys/src/cmd/upas/vf/mkfile - 664 sys sys 1064393881 241
 sys/src/cmd/upas/vf/vf.c - 664 sys sys 1143759341 20030
@@ -14827,7 +14828,7 @@ sys/src/libc/9sys/werrstr.c - 664 sys sys 1014927340 196
 sys/src/libc/9sys/write.c - 664 sys sys 1014927340 110
 sys/src/libc/9sys/writev.c - 664 sys sys 1014927340 577
 sys/src/libc/9syscall - 20000000775 sys sys 1062619381 0
-sys/src/libc/9syscall/mkfile - 664 sys sys 1130424755 2625
+sys/src/libc/9syscall/mkfile - 664 sys sys 1173374403 2891
 sys/src/libc/9syscall/sys.h - 664 sys sys 1143129935 927
 sys/src/libc/alpha - 20000000775 sys sys 1067718982 0
 sys/src/libc/alpha/_seek.c - 664 sys sys 1130424714 180
@@ -15252,7 +15253,7 @@ sys/src/libmach/0.c - 664 sys sys 1143834577 4167
 sys/src/libmach/2.c - 664 sys sys 1138471014 2085
 sys/src/libmach/2db.c - 664 sys sys 1143696097 61333
 sys/src/libmach/2obj.c - 664 sys sys 1148106911 2393
-sys/src/libmach/5.c - 664 sys sys 1138471013 1564
+sys/src/libmach/5.c - 664 sys sys 1173387335 1564
 sys/src/libmach/5db.c - 664 sys sys 1143696172 21599
 sys/src/libmach/5obj.c - 664 sys sys 1148106911 2267
 sys/src/libmach/6.c - 664 sys sys 1138471019 3482
@@ -15681,11 +15682,6 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
-386/bin/ndb/dns - 775 sys sys 1173326548 272738
-386/bin/ndb/dnsdebug - 775 sys sys 1173326549 246795
-386/bin/ndb/dnstcp - 775 sys sys 1173326549 245655
-sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173326868 20749
-sys/src/cmd/ndb/dns.c - 664 sys sys 1173326858 15802
-sys/src/cmd/ndb/dns.h - 664 sys sys 1173326777 9948
-sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173326777 8617
-sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173326777 7686
+sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173413221 383
+sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173413222 351
+sys/src/ape/lib/ap/syscall/geninstall xxx REMOVED xxx xxx 0 0

+ 33 - 32
dist/replica/plan9.db

@@ -340,10 +340,10 @@
 386/bin/ndb - 20000000775 sys sys 985743147 0
 386/bin/ndb/cs - 775 sys sys 1169612028 150911
 386/bin/ndb/csquery - 775 sys sys 1168402337 61702
-386/bin/ndb/dns - 775 sys sys 1173326548 272738
-386/bin/ndb/dnsdebug - 775 sys sys 1173326549 246795
+386/bin/ndb/dns - 775 sys sys 1173385412 273424
+386/bin/ndb/dnsdebug - 775 sys sys 1173385413 247453
 386/bin/ndb/dnsquery - 775 sys sys 1173113879 63870
-386/bin/ndb/dnstcp - 775 sys sys 1173326549 245655
+386/bin/ndb/dnstcp - 775 sys sys 1173385415 246310
 386/bin/ndb/ipquery - 775 sys sys 1169612031 96994
 386/bin/ndb/mkdb - 775 sys sys 1168402340 64211
 386/bin/ndb/mkhash - 775 sys sys 1168402340 84780
@@ -405,7 +405,7 @@
 386/bin/snap - 775 sys sys 1136346852 313627
 386/bin/snapfs - 775 sys sys 1134389876 388292
 386/bin/sniffer - 775 sys sys 1038443185 99028
-386/bin/snoopy - 775 sys sys 1173212580 192338
+386/bin/snoopy - 775 sys sys 1173385415 192339
 386/bin/sort - 775 sys sys 1168402349 82523
 386/bin/spin - 775 sys sys 1134151359 758520
 386/bin/split - 775 sys sys 1168402349 75886
@@ -534,7 +534,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 1070519112 0
 386/lib/ape/lib9.a - 664 sys sys 1135531447 6906
-386/lib/ape/libap.a - 664 sys sys 1173039817 819938
+386/lib/ape/libap.a - 664 sys sys 1173410635 783116
 386/lib/ape/libbsd.a - 664 sys sys 1146156978 183900
 386/lib/ape/libdraw.a - 664 sys sys 1155491760 621772
 386/lib/ape/libfmt.a - 664 sys sys 1146156980 156706
@@ -561,7 +561,7 @@
 386/lib/libhttpd.a - 664 sys sys 1168402367 99458
 386/lib/libip.a - 664 sys sys 1169612032 35672
 386/lib/libl.a - 664 sys sys 1168402367 5372
-386/lib/libmach.a - 664 sys sys 1172203058 785440
+386/lib/libmach.a - 664 sys sys 1173410637 785440
 386/lib/libmemdraw.a - 664 sys sys 1168402369 284092
 386/lib/libmemlayer.a - 664 sys sys 1168402369 47360
 386/lib/libmp.a - 664 sys sys 1170879862 79978
@@ -7519,7 +7519,7 @@ sys/man/2/mouse - 664 sys sys 1140900146 4952
 sys/man/2/mp - 664 sys sys 1140106703 10762
 sys/man/2/muldiv - 664 sys sys 984709633 639
 sys/man/2/nan - 664 sys sys 975084242 937
-sys/man/2/ndb - 664 sys sys 1173239303 9603
+sys/man/2/ndb - 664 sys sys 1173401633 9573
 sys/man/2/notify - 664 sys sys 1032058674 6376
 sys/man/2/object - 664 sys sys 944959695 3864
 sys/man/2/open - 664 sys sys 1015091524 3404
@@ -7746,7 +7746,7 @@ sys/man/8/mkpaqfs - 664 sys sys 1018386778 892
 sys/man/8/mksacfs - 664 sys sys 964886843 710
 sys/man/8/mouse - 664 sys sys 971455511 2476
 sys/man/8/na - 664 sys sys 958527089 859
-sys/man/8/ndb - 664 sys sys 1173120870 10642
+sys/man/8/ndb - 664 sys sys 1173401577 10952
 sys/man/8/newuser - 664 sys sys 1116954242 2418
 sys/man/8/nfsserver - 664 sys sys 1163208425 3587
 sys/man/8/pcmcia - 664 sys sys 944959679 408
@@ -7794,7 +7794,7 @@ sys/src/9 - 20000000775 sys sys 1063857477 0
 sys/src/9/alphapc - 20000000775 sys sys 1137179966 0
 sys/src/9/alphapc/apc - 664 sys sys 1131289706 630
 sys/src/9/alphapc/apccpu - 664 sys sys 1142958706 532
-sys/src/9/alphapc/arch164.c - 664 sys sys 1015012783 6100
+sys/src/9/alphapc/arch164.c - 664 sys sys 1173386682 6082
 sys/src/9/alphapc/audio.h - 664 sys sys 1015012783 349
 sys/src/9/alphapc/axp.h - 664 sys sys 1015012783 1090
 sys/src/9/alphapc/cga.c - 664 sys sys 1015012783 1814
@@ -7815,12 +7815,12 @@ sys/src/9/alphapc/initcode - 664 sys sys 1039753419 779
 sys/src/9/alphapc/io.h - 664 sys sys 1137179966 4618
 sys/src/9/alphapc/kbd.c - 664 sys sys 1015012785 8676
 sys/src/9/alphapc/l.s - 664 sys sys 1143129848 9367
-sys/src/9/alphapc/main.c - 664 sys sys 1143129763 13748
+sys/src/9/alphapc/main.c - 664 sys sys 1173386681 13753
 sys/src/9/alphapc/mem.h - 664 sys sys 1137179967 2312
 sys/src/9/alphapc/memmove.s - 664 sys sys 1015012786 2936
 sys/src/9/alphapc/memset.s - 664 sys sys 1015012786 844
-sys/src/9/alphapc/mkfile - 664 sys sys 1109218102 1682
-sys/src/9/alphapc/mmu.c - 664 sys sys 1169491834 5189
+sys/src/9/alphapc/mkfile - 664 sys sys 1173412020 1973
+sys/src/9/alphapc/mmu.c - 664 sys sys 1173386681 5219
 sys/src/9/alphapc/osf1pal.h - 664 sys sys 1137179966 1471
 sys/src/9/alphapc/pci.c - 664 sys sys 1039753420 7868
 sys/src/9/alphapc/screen.h - 664 sys sys 1147108286 3923
@@ -7855,7 +7855,7 @@ sys/src/9/bitsy/l.s - 664 sys sys 1055700934 18211
 sys/src/9/bitsy/main.c - 664 sys sys 1143129874 8951
 sys/src/9/bitsy/map - 664 sys sys 1017695515 236
 sys/src/9/bitsy/mem.h - 664 sys sys 1055700932 8049
-sys/src/9/bitsy/mkfile - 664 sys sys 1131289775 2459
+sys/src/9/bitsy/mkfile - 664 sys sys 1173368204 2832
 sys/src/9/bitsy/mmu.c - 664 sys sys 1171761416 11656
 sys/src/9/bitsy/mouse.c - 664 sys sys 1017695516 962
 sys/src/9/bitsy/paqfiles - 20000000775 sys sys 1039727524 0
@@ -7872,7 +7872,7 @@ sys/src/9/bitsy/sa1110dma.h - 664 sys sys 1017695520 381
 sys/src/9/bitsy/screen.c - 664 sys sys 1053340962 10145
 sys/src/9/bitsy/screen.h - 664 sys sys 1147023548 284
 sys/src/9/bitsy/sd.h - 664 sys sys 1037029038 0
-sys/src/9/bitsy/sdata.c - 664 sys sys 1171761416 44377
+sys/src/9/bitsy/sdata.c - 664 sys sys 1173368216 44377
 sys/src/9/bitsy/tar.c - 664 sys sys 1017695521 1375
 sys/src/9/bitsy/trap.c - 664 sys sys 1105030166 19484
 sys/src/9/bitsy/uartsa1110.c - 664 sys sys 1142741102 8537
@@ -8157,7 +8157,7 @@ sys/src/9/port/pgrp.c - 664 sys sys 1138458260 4760
 sys/src/9/port/portclock.c - 664 sys sys 1146746630 4276
 sys/src/9/port/portdat.h - 664 sys sys 1155995676 22703
 sys/src/9/port/portfns.h - 664 sys sys 1146746630 11059
-sys/src/9/port/portmkfile - 664 sys sys 1131907975 2062
+sys/src/9/port/portmkfile - 664 sys sys 1173368230 1387
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
 sys/src/9/port/proc.c - 664 sys sys 1166244036 28770
 sys/src/9/port/qio.c - 664 sys sys 1070287837 23562
@@ -8833,7 +8833,8 @@ sys/src/ape/lib/ap/stdio/vprintf.c - 664 sys sys 1014921983 134
 sys/src/ape/lib/ap/stdio/vsnprintf.c - 664 sys sys 1134052382 267
 sys/src/ape/lib/ap/stdio/vsprintf.c - 664 sys sys 1134052382 254
 sys/src/ape/lib/ap/syscall - 20000000775 sys sys 1039727535 0
-sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1139690286 2667
+sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173413221 383
+sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173413222 351
 sys/src/ape/lib/bsd - 20000000775 sys sys 1063858406 0
 sys/src/ape/lib/bsd/_sock_ingetaddr.c - 664 sys sys 1014921994 836
 sys/src/ape/lib/bsd/_sock_ipattr.c - 664 sys sys 1014921994 577
@@ -12665,21 +12666,21 @@ sys/src/cmd/mug.c - 664 sys sys 1157143847 24888
 sys/src/cmd/mv.c - 664 sys sys 1163029439 4682
 sys/src/cmd/ndb - 20000000775 sys sys 1080135004 0
 sys/src/cmd/ndb/convDNS2M.c - 664 sys sys 1173059857 6856
-sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1173161431 10636
+sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1173335487 10645
 sys/src/cmd/ndb/cs.c - 664 sys sys 1163208617 33080
-sys/src/cmd/ndb/csquery.c - 664 sys sys 1014926159 1062
-sys/src/cmd/ndb/dblookup.c - 664 sys sys 1173238983 18199
+sys/src/cmd/ndb/csquery.c - 664 sys sys 1173401775 1073
+sys/src/cmd/ndb/dblookup.c - 664 sys sys 1173335538 18207
 sys/src/cmd/ndb/dn.c - 664 sys sys 1173239201 32107
 sys/src/cmd/ndb/dnarea.c - 664 sys sys 1173059947 2517
 sys/src/cmd/ndb/dnnotify.c - 664 sys sys 1173238959 3158
-sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173326868 20749
-sys/src/cmd/ndb/dns.c - 664 sys sys 1173326858 15802
-sys/src/cmd/ndb/dns.h - 664 sys sys 1173326777 9948
-sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173326777 8617
-sys/src/cmd/ndb/dnserver.c - 664 sys sys 1173060400 4449
-sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1120564714 2198
-sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173326777 7686
-sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1173239157 5693
+sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173401935 22144
+sys/src/cmd/ndb/dns.c - 664 sys sys 1173401831 15957
+sys/src/cmd/ndb/dns.h - 664 sys sys 1173335529 9992
+sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173401872 8650
+sys/src/cmd/ndb/dnserver.c - 664 sys sys 1173335425 4431
+sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1173401783 2199
+sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173401840 7704
+sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1173335517 5678
 sys/src/cmd/ndb/ipquery.c - 664 sys sys 1124711426 773
 sys/src/cmd/ndb/mkdb.c - 664 sys sys 957402054 2886
 sys/src/cmd/ndb/mkfile - 664 sys sys 1173059600 1984
@@ -12801,7 +12802,7 @@ sys/src/cmd/postscript/common/common.c - 664 sys sys 1015090116 6737
 sys/src/cmd/postscript/common/common.h - 664 sys sys 944961054 780
 sys/src/cmd/postscript/common/ext.h - 664 sys sys 944961054 1089
 sys/src/cmd/postscript/common/gen.h - 664 sys sys 944961053 1135
-sys/src/cmd/postscript/common/getopt.c - 664 sys sys 944961053 1101
+sys/src/cmd/postscript/common/getopt.c - 664 sys sys 1173377512 1098
 sys/src/cmd/postscript/common/glob.c - 664 sys sys 944961053 821
 sys/src/cmd/postscript/common/misc.c - 664 sys sys 944961053 3979
 sys/src/cmd/postscript/common/mkfile - 664 sys sys 953344625 261
@@ -14097,8 +14098,8 @@ sys/src/cmd/upas/smtp/smtpd.h - 664 sys sys 1067722781 1111
 sys/src/cmd/upas/smtp/smtpd.y - 664 sys sys 1143670612 6961
 sys/src/cmd/upas/smtp/spam.c - 664 sys sys 1139699502 10238
 sys/src/cmd/upas/unesc - 20000000775 sys sys 1075080255 0
-sys/src/cmd/upas/unesc/mkfile - 664 sys sys 1075080255 164
-sys/src/cmd/upas/unesc/unesc.c - 664 sys sys 1075080255 789
+sys/src/cmd/upas/unesc/mkfile - 664 sys sys 1173383407 142
+sys/src/cmd/upas/unesc/unesc.c - 664 sys sys 1173383408 969
 sys/src/cmd/upas/vf - 20000000775 sys sys 1064589607 0
 sys/src/cmd/upas/vf/mkfile - 664 sys sys 1064393881 241
 sys/src/cmd/upas/vf/vf.c - 664 sys sys 1143759341 20030
@@ -14827,7 +14828,7 @@ sys/src/libc/9sys/werrstr.c - 664 sys sys 1014927340 196
 sys/src/libc/9sys/write.c - 664 sys sys 1014927340 110
 sys/src/libc/9sys/writev.c - 664 sys sys 1014927340 577
 sys/src/libc/9syscall - 20000000775 sys sys 1062619381 0
-sys/src/libc/9syscall/mkfile - 664 sys sys 1130424755 2625
+sys/src/libc/9syscall/mkfile - 664 sys sys 1173374403 2891
 sys/src/libc/9syscall/sys.h - 664 sys sys 1143129935 927
 sys/src/libc/alpha - 20000000775 sys sys 1067718982 0
 sys/src/libc/alpha/_seek.c - 664 sys sys 1130424714 180
@@ -15252,7 +15253,7 @@ sys/src/libmach/0.c - 664 sys sys 1143834577 4167
 sys/src/libmach/2.c - 664 sys sys 1138471014 2085
 sys/src/libmach/2db.c - 664 sys sys 1143696097 61333
 sys/src/libmach/2obj.c - 664 sys sys 1148106911 2393
-sys/src/libmach/5.c - 664 sys sys 1138471013 1564
+sys/src/libmach/5.c - 664 sys sys 1173387335 1564
 sys/src/libmach/5db.c - 664 sys sys 1143696172 21599
 sys/src/libmach/5obj.c - 664 sys sys 1148106911 2267
 sys/src/libmach/6.c - 664 sys sys 1138471019 3482

+ 41 - 0
dist/replica/plan9.log

@@ -47765,3 +47765,44 @@
 1173328206 5 c sys/src/cmd/ndb/dns.h - 664 sys sys 1173326777 9948
 1173328206 6 c sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173326777 8617
 1173328206 7 c sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173326777 7686
+1173335406 0 c sys/src/cmd/ndb/dnserver.c - 664 sys sys 1173335425 4431
+1173335406 1 c sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173335439 7671
+1173337207 0 c sys/src/cmd/ndb/convM2DNS.c - 664 sys sys 1173335487 10645
+1173337207 1 c sys/src/cmd/ndb/dblookup.c - 664 sys sys 1173335538 18207
+1173337207 2 c sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173335508 20779
+1173337207 3 c sys/src/cmd/ndb/dns.h - 664 sys sys 1173335529 9992
+1173337207 4 c sys/src/cmd/ndb/dnudpserver.c - 664 sys sys 1173335517 5678
+1173369605 0 c sys/src/9/bitsy/mkfile - 664 sys sys 1173368204 2832
+1173369605 1 c sys/src/9/bitsy/sdata.c - 664 sys sys 1173368216 44377
+1173369605 2 c sys/src/9/port/portmkfile - 664 sys sys 1173368230 1387
+1173375006 0 c sys/src/libc/9syscall/mkfile - 664 sys sys 1173374403 2891
+1173376806 0 c sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173376682 2783
+1173378606 0 c sys/src/cmd/postscript/common/getopt.c - 664 sys sys 1173377512 1098
+1173382207 0 c sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173381679 2784
+1173384006 0 c sys/src/cmd/upas/unesc/mkfile - 664 sys sys 1173383407 142
+1173384006 1 c sys/src/cmd/upas/unesc/unesc.c - 664 sys sys 1173383408 969
+1173385806 0 c 386/bin/snoopy - 775 sys sys 1173385415 192339
+1173385806 1 c 386/bin/ndb/dns - 775 sys sys 1173385412 273424
+1173385806 2 c 386/bin/ndb/dnsdebug - 775 sys sys 1173385413 247453
+1173385806 3 c 386/bin/ndb/dnstcp - 775 sys sys 1173385415 246310
+1173385806 4 a sys/src/ape/lib/ap/syscall/geninstall - 775 sys sys 1173384418 425
+1173385806 5 c sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173384418 164
+1173387607 0 c sys/src/9/alphapc/arch164.c - 664 sys sys 1173386682 6082
+1173387607 1 c sys/src/9/alphapc/main.c - 664 sys sys 1173386681 13753
+1173387607 2 c sys/src/9/alphapc/mkfile - 664 sys sys 1173386681 2104
+1173387607 3 c sys/src/9/alphapc/mmu.c - 664 sys sys 1173386681 5219
+1173387607 4 c sys/src/libmach/5.c - 664 sys sys 1173387335 1564
+1173402006 0 c sys/man/2/ndb - 664 sys sys 1173401633 9573
+1173402006 1 c sys/man/8/ndb - 664 sys sys 1173401577 10952
+1173402006 2 c sys/src/cmd/ndb/csquery.c - 664 sys sys 1173401775 1073
+1173402006 3 c sys/src/cmd/ndb/dnresolve.c - 664 sys sys 1173401935 22144
+1173402006 4 c sys/src/cmd/ndb/dns.c - 664 sys sys 1173401831 15957
+1173402006 5 c sys/src/cmd/ndb/dnsdebug.c - 664 sys sys 1173401872 8650
+1173402006 6 c sys/src/cmd/ndb/dnsquery.c - 664 sys sys 1173401783 2199
+1173402006 7 c sys/src/cmd/ndb/dnstcp.c - 664 sys sys 1173401840 7704
+1173411005 0 c 386/lib/ape/libap.a - 664 sys sys 1173410635 783116
+1173411005 1 c 386/lib/libmach.a - 664 sys sys 1173410637 785440
+1173412806 0 c sys/src/9/alphapc/mkfile - 664 sys sys 1173412020 1973
+1173414606 0 a sys/src/ape/lib/ap/syscall/genall - 775 sys sys 1173413221 383
+1173414606 1 c sys/src/ape/lib/ap/syscall/mkfile - 664 sys sys 1173413222 351
+1173414606 2 d sys/src/ape/lib/ap/syscall/geninstall - 775 sys sys 1173384418 0

+ 5 - 6
sys/man/2/ndb

@@ -18,7 +18,7 @@ Ndb*	ndbopen(char *file)
 Ndb*	ndbcat(Ndb *db1, Ndb *db2)
 .PP
 .B
-Ndb*	ndbchanged(Ndb *db)
+int	ndbchanged(Ndb *db)
 .PP
 .B
 int	ndbreopen(Ndb *db)
@@ -105,14 +105,13 @@ If
 is zero, all network database files are opened.
 .PP
 .I Ndbcat
-concatenates two open databases.  Either argument may be
-nil.
+concatenates two open databases.  Either argument may be nil.
 .PP
 .I Ndbreopen
-checks if the database files associated with
+throws out any cached information
+for the database files associated with
 .I db
-have changed and if so throws out any cached information and reopens
-the files.
+and reopens the files.
 .PP
 .I Ndbclose
 closes any database files associated with

+ 23 - 11
sys/man/8/ndb

@@ -52,7 +52,7 @@ query, ipquery, mkhash, mkdb, mkhosts, cs, csquery, dns, dnsquery, dnsdebug \- n
 .br
 .B ndb/dns
 [
-.B -nrRs
+.B -norRs
 ] [
 .B -a
 .I maxage
@@ -174,8 +174,7 @@ It finds out what networks are configured
 by looking for
 .B /net/*/clone
 when it starts.
-It can also be told about networks by writing
-to
+It can also be told about networks by writing to
 .B /net/cs
 a message of the form:
 .IP
@@ -186,6 +185,7 @@ also sets the system name in
 .B /dev/sysname
 if it can figure it out.
 The options are:
+.TF -n
 .TP
 .B -f
 supplies the name of the data base file to use,
@@ -198,6 +198,7 @@ causes cs to do nothing but set the system name.
 .B -x
 specifies the mount point of the
 network.
+.PD
 .PP
 .I Ndb/csquery
 can be used to query
@@ -231,7 +232,14 @@ By default
 .I dns
 serves only requests written to
 .BR /net/dns .
+Programs must
+.I seek
+to offset 0 before reading or writing
+.B /net/dns
+or
+.BR /net/cs .
 The options are:
+.TF -n
 .TP
 .B -a
 sets the maximum time in seconds that an unreferenced
@@ -314,10 +322,9 @@ The last three lines provide a mapping for the
 server names to their ip addresses.  This is only
 a hint and will be superseded from whatever is learned
 from servers owning the domain.
-.PP
+.SS "Authoritative Name Servers"
 You can also serve a subtree of the domain name space from the local
-database.  You indicate subtrees that you'ld like to serve by
-adding an
+database.  You indicate subtrees that you would like to serve by adding an
 .B soa=
 attribute to the root entry.
 For example, the Bell Labs CS research domain is:
@@ -355,7 +362,7 @@ when the domain changes.  The notification also requires
 the
 .B -n
 flag.
-.PP
+.SS "Reverse Domains"
 You can also serve reverse lookups (returning the name that
 goes with an IP address) by adding an
 .B soa=
@@ -388,7 +395,7 @@ will automatically create both forward and reverse entries for
 .B ns1.cs.bell-labs.com .
 Unlike other DNS servers, there's no way to generate
 inconsistent forward and reverse entries.
-.PP
+.SS "Delegating Name Service Authority"
 Delegation of a further subtree to another set of name servers
 is indicated by an
 .B soa=delegated
@@ -405,7 +412,7 @@ Nameservers within the delegated domain (as in this example)
 must have their IP addresses listed elsewhere in
 .I ndb
 files.
-.PP
+.SS "Wildcards, MX and CNAME records"
 Wild-carded domain names can also be used.
 For example, to specify a mail forwarder for all Bell Labs research systems:
 .IP
@@ -426,9 +433,14 @@ the aliases may have no other attributes than
 and are daily further restricted in their use by new RFCs.
 .IP
 .EX
-cname=anna.cs.research.bell-labs.com dom=www.cs.research.bell-labs.com
+cname=anna.cs.bell-labs.com dom=www.cs.bell-labs.com
 .EE
-.LP
+.PP
+makes
+.BI www. ...
+a synonym for the canonical name
+.BI anna. ... .
+.SS "DNS Queries and Debugging"
 .I Ndb/dnsquery
 can be used to query
 .I ndb/dns

+ 0 - 1
sys/src/9/alphapc/arch164.c

@@ -9,7 +9,6 @@
 #include	"dat.h"
 #include	"fns.h"
 #include	"io.h"
-#include	"ureg.h"
 
 static ulong *core;
 static ulong *wind;

+ 4 - 4
sys/src/9/alphapc/main.c

@@ -417,10 +417,10 @@ exit(int ispanic)
 		firmware();
 
 	// on PC is just:
-	if (0) {
-		shutdown(ispanic);
-		// arch->reset();
-	}
+	//if (0) {
+	//	shutdown(ispanic);
+	//	arch->reset();
+	//}
 }
 
 void

+ 10 - 3
sys/src/9/alphapc/mkfile

@@ -90,9 +90,16 @@ init.h:	initcode /sys/src/libc/9syscall/sys.h
 		sed -e 's/^[0-9a-f]+ //' -e 's/ ([0-9a-f][0-9a-f])/0x\1,/g'
 	 echo '};'} > init.h
 
-clock.$O faultalpha.$O:	/$objtype/include/ureg.h
-main.$O: 		/sys/src/boot/alphapc/conf.h
-sd53c8xx.$O:	sd53c8xx.i
+clock.$O:	/$objtype/include/ureg.h axp.h
+devarch.$O:	axp.h
+faultalpha.$O:	/$objtype/include/ureg.h
+fptrap.$O:	/$objtype/include/ureg.h
+kbd.$O:		/$objtype/include/ureg.h
+l.$O:		osf1pal.h
+main.$O: 	/$objtype/include/ureg.h errstr.h init.h
+mmu.$O:		/sys/src/boot/alphapc/conf.h
+sd53c8xx.$O:	/$objtype/include/ureg.h ../port/sd.h sd53c8xx.i
+trap.$O:	/$objtype/include/ureg.h ../port/error.h ../port/systab.h
 
 sd53c8xx.i:	../pc/sd53c8xx.n
 	aux/na $prereq > $target

+ 5 - 2
sys/src/9/alphapc/mmu.c

@@ -290,8 +290,11 @@ countpagerefs(ulong*, int)
 ulong
 cankaddr(ulong pa)
 {
-	if(pa >= -KZERO)
+	ulong kzero;
+
+	kzero = -KZERO;
+	if(pa >= kzero)
 		return 0;
-	return -KZERO - pa;
+	return kzero - pa;
 }
 

+ 14 - 9
sys/src/9/bitsy/mkfile

@@ -109,15 +109,20 @@ init.h:	../port/initcode.c init9.s
 	 echo '};'} > init.h
 
 clock.$O:	/$objtype/include/ureg.h
-
-devether.$O: ../port/netif.h
-wavelan.$O: wavelan.c wavelan.h ../pc/wavelan.h
-
-fpi.$O: fpi.h
-fpiarm.$O: fpi.h
-fpimem.$O: fpi.h
-
-screen.$O: gamma.h
+devether.$O:	/$objtype/include/ureg.h ../port/netif.h
+devpcmcia.$O:	/$objtype/include/ureg.h
+fpi.$O:		fpi.h
+fpiarm.$O:	/$objtype/include/ureg.h fpi.h
+fpimem.$O:	fpi.h
+main.$O:	/$objtype/include/ureg.h errstr.h init.h
+mmu.$O:		/$objtype/include/ureg.h
+power.$O:	/$objtype/include/ureg.h
+scu.$O:		/$objtype/include/ureg.h
+sa1110dma.$O:	/$objtype/include/ureg.h
+screen.$O:	gamma.h
+sdata.$O:	/$objtype/include/ureg.h
+trap$O:		/$objtype/include/ureg.h
+wavelan.$O:	/$objtype/include/ureg.h wavelan.c wavelan.h ../pc/wavelan.h
 
 paqdisk:V:
 	rm -fr armpaq

+ 1 - 1
sys/src/9/bitsy/sdata.c

@@ -1457,7 +1457,7 @@ retry:
 
 
 static void
-atainterrupt(Ureg*, void*arg )
+atainterrupt(Ureg*, void* arg)
 {
 	Ctlr *ctlr;
 	Drive *drive;

+ 1 - 24
sys/src/9/port/portmkfile

@@ -35,9 +35,7 @@ clean:V:
 		mk $i.clean
 
 %.clean:V:
-	rm -f $stem.c [9bz]$stem [9bz]$stem.gz boot$stem.*
-
-%.$O:	/$objtype/include/u.h ../port/lib.h mem.h dat.h fns.h io.h ../port/error.h ../port/portdat.h ../port/portfns.h
+	rm -f $stem.c [9bz]$stem [9bz]$stem.gz boot$stem.* *.acid
 
 ../port/systab.h:	/sys/src/libc/9syscall/sys.h ../port/mksystab
 	rc ../port/mksystab > ../port/systab.h
@@ -57,27 +55,6 @@ errstr.h:	../port/mkerrstr ../port/error.h
 %.db:		main.$O
 	$CC -s$stem main.c | dbfmt > $stem.db
 
-alloc.$O:	/sys/include/pool.h
-devmnt.$O:	/sys/include/fcall.h
-proc.$O:	errstr.h
-devroot.$O:	errstr.h
-trap.$O:	/$objtype/include/ureg.h
-devproc.$O:	/$objtype/include/ureg.h
-main.$O:	init.h
-trap.$O:	../port/systab.h
-devpipe.$O:	../port/netif.h
-netif.$O:	../port/netif.h
-devuart.$O:	../port/netif.h
-devmouse.$O:	screen.h
-devdraw.$O:	screen.h
-screen.$O:	screen.h
-latin1.$O:	../port/latin1.h
-thwack.$O:	../port/thwack.h
-unthwack.$O:	../port/thwack.h
-devsdp.$O:	../port/thwack.h
-devproc.$O sysproc.$O:	/sys/include/tos.h
-devproc.$O edf.$O proc.$O: /sys/include/trace.h
-
 boot$CONF.out: $CONF print.$O $BOOTDIR/boot.c $BOOTLIB
 	$BOOTDIR/mkboot $CONF > boot$CONF.c
 	$CC $CFLAGS boot$CONF.c

+ 14 - 0
sys/src/ape/lib/ap/syscall/genall

@@ -0,0 +1,14 @@
+#!/bin/rc
+# genall - generate the APE versions of the system call C interfaces.
+#	must be invoked by mk so that the right env variables are set.
+rfork e
+SYSH=/sys/src/libc/9syscall/sys.h
+
+SYS=`{sed '/^#define._/d; s/#define.([A-Z0-9_]*).*/\1/' $SYSH}
+for(I in $SYS) {
+	i=_^$I
+	n=`{sed -n '/[ 	]'$I'[ 	]/s/.*	//p' $SYSH}
+	gencall
+}
+ar vu /$objtype/lib/ape/libap.a *.$O
+rm -f *.$O *.s

+ 12 - 129
sys/src/ape/lib/ap/syscall/mkfile

@@ -1,138 +1,21 @@
 NPROC=1
 </$objtype/mkfile
-SYSH=/sys/src/libc/9syscall/sys.h
 
-all:V: install
+install:V: genall gencall
+	genall
 
-install:V:
-	SYS=`{sed '/^#define._/d; s/#define.([A-Z0-9_]*).*/\1/' $SYSH}
-	for(I in $SYS) {
-		i=$I
-		i=_^$i
-		n=`{sed -n '/[ 	]'$I'[ 	]/s/.*	//p' $SYSH}
-		{switch($objtype){
-		case 68000
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVL '$'$n, R0
-			echo TRAP '$0'
-			echo RTS
-		case 68020
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVL '$'$n, R0
-			echo TRAP '$0'
-			echo RTS
-		case mips
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVW R1, '0(FP)'
-			echo MOVW '$'$n, R1
-			echo SYSCALL
-			if(~ $i _SEEK) {
-				echo 'MOVW $-1,R5
-				BNE R1,R5,4(PC)
-				MOVW a+0(FP),R5
-				MOVW R1,0(R5)
-				MOVW R1,4(R5)'
-			}
-			echo RET
-		case mips2
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVW R1, '0(FP)'
-			echo MOVW '$'$n, R1
-			echo ADD '$4',R29
-			echo SYSCALL
-			echo ADD '$-4',R29
-			echo RET
-		case spim
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVW R1, '0(FP)'
-			echo MOVW '$'$n, R1
-			echo ADD '$4',R29
-			echo SYSCALL
-			echo ADD '$-4',R29
-			echo RET
-		case 386
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVL '$'$n, AX
-			echo INT '$'64
-			if(~ $i _SEEK) {
-				echo 'CMPL AX,$-1
-				JNE 4(PC)
-				MOVL a+0(FP),CX
-				MOVL AX,0(CX)
-				MOVL AX,4(CX)'
-			}
-			echo RET
-		case amd64
-			if(~ $i _SEEK)
-				echo TEXT __SEEK'(SB)', 1, '$0'
-			if not
-				echo TEXT $i'(SB)', 1, '$0'
-			echo MOVQ RARG, 'a0+0(FP)'
-			echo MOVQ '$'$n, RARG
-			echo SYSCALL
-			echo RET
-		case sparc sparc64
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVW R7, '0(FP)'
-			echo MOVW '$'$n, R7
-			echo TA R0
-			if(~ $i _SEEK) {
-				echo 'CMP R7,$-1
-				BNE 4(PC)
-				MOVW a+0(FP),R8
-				MOVW R7,0(R8)
-				MOVW R7,4(R8)'
-			}
-			echo RETURN
-		case 3210
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVW R3, '0(FP)'
-			echo MOVW '$'$n, R3
-			echo WORD '$0x06000000'
-			echo RETURN
-		case 29000
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVL R69, '0(FP)'
-			echo MOVL '$'$n, R69
-			echo EMULATE 0
-			echo RET
-		case arm
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVW R0, '0(FP)'
-			echo MOVW '$'$n, R0
-			echo SWI 0
-			echo RET
-		case power
-			echo TEXT $i'(SB)', 1, '$0'
-			echo MOVW R3, '0(FP)'
-			echo MOVW '$'$n, R3
-			echo SYSCALL
-			if(~ $i _SEEK) {
-				echo 'CMP R3,$-1
-				BNE 4(PC)
-				MOVW a+0(FP),R8
-				MOVW R3,0(R8)
-				MOVW R3,4(R8)'
-			}
-			echo RETURN
-		case alpha
-			j=$i
-		# /sys/src/libc/9syscall/mkfile uses:
-		#	if(~ $i seek) j=_seek
-			if(~ $i _SEEK) j=__SEEK
-			echo TEXT $j'(SB)', 1, '$0'
-			echo MOVL R0, '0(FP)'
-			echo MOVQ '$'$n, R0
-			echo CALL_PAL '$'0x83
-			echo RET
-		}} > $i.s
-		$AS $i.s
-	}
-	ar vu /$objtype/lib/ape/libap.a *.$O
-	rm -f *.$O *.s
+gencall:D: /sys/src/libc/9syscall/mkfile
+	{
+		echo '#!/bin/rc'
+		sed -n -e 's/seek/_SEEK/g' -e '/switch/,/\$AS /p' $prereq
+	} >$target
+	chmod +x $target
 
 nuke clean:V:
-	rm -f *.[$OS]
+	rm -f *.[$OS] *.s gencall
 
 installall:V:
 	for(objtype in $CPUS) mk install
+
+update:V:
+	update $UPDATEFLAGS mkfile sys.h

+ 16 - 16
sys/src/cmd/ndb/convM2DNS.c

@@ -12,7 +12,7 @@ struct Scan
 
 	char	*err;
 	char	errbuf[256];	/* hold a formatted error sometimes */
-	int	errflags;	/* outgoing reply flags */
+	int	rcode;		/* outgoing response codes (reply flags) */
 };
 
 #define NAME(x)		gname(x, rp, sp)
@@ -290,8 +290,8 @@ mstypehack(Scan *sp, int type, char *where)
 		syslog(0, "dns",
 			"%s: byte-swapped type field in ptr rr from win2k",
 			where);
-		if (sp->errflags == 0)
-			sp->errflags = Rformat;
+		if (sp->rcode == 0)
+			sp->rcode = Rformat;
 	}
 }
 
@@ -335,7 +335,7 @@ retry:
 			sp->base, sp->p, sp->ep, len);	/* DEBUG */
 		errtoolong(rp, sp, sp->ep - sp->p, len, "convM2RR");
 	}
-	if(sp->err || sp->errflags){
+	if(sp->err || sp->rcode){
 		rrfree(rp);
 		return 0;
 	}
@@ -464,7 +464,7 @@ convM2Q(Scan *sp)
 	NAME(dname);
 	USHORT(type);
 	USHORT(class);
-	if(sp->err || sp->errflags)
+	if(sp->err || sp->rcode)
 		return 0;
 
 	mstypehack(sp, type, "convM2Q");
@@ -480,7 +480,7 @@ rrloop(Scan *sp, char *what, int count, int quest)
 	int i;
 	RR *first, *rp, **l;
 
-	if(sp->err || sp->errflags)
+	if(sp->err || sp->rcode)
 		return 0;
 	l = &first;
 	first = 0;
@@ -488,7 +488,7 @@ rrloop(Scan *sp, char *what, int count, int quest)
 		rp = quest ? convM2Q(sp) : convM2RR(sp, what);
 		if(rp == nil)
 			break;
-		if(sp->err || sp->errflags){
+		if(sp->err || sp->rcode){
 			rrfree(rp);
 			break;
 		}
@@ -500,27 +500,27 @@ rrloop(Scan *sp, char *what, int count, int quest)
 
 /*
  *  convert the next DNS from a message stream.
- *  if there are formatting errors or the like during parsing
- *  of the message, set *errp to the outgoing DNS flags (e.g., Rformat),
- *  which will abort processing and reply immediately with the outgoing flags.
+ *  if there are formatting errors or the like during parsing of the message,
+ *  set *codep to the outgoing response code (e.g., Rformat), which will
+ *  abort processing and reply immediately with the outgoing response code.
  */
 char*
-convM2DNS(uchar *buf, int len, DNSmsg *m, int *errp)
+convM2DNS(uchar *buf, int len, DNSmsg *m, int *codep)
 {
 	Scan scan;
 	Scan *sp;
 	char *err;
 	RR *rp = nil;
 
-	if (errp)
-		*errp = 0;
+	if (codep)
+		*codep = 0;
 	assert(len >= 0);
 	scan.base = buf;
 	scan.p = buf;
 	scan.ep = buf + len;
 	scan.err = nil;
 	scan.errbuf[0] = '\0';
-	scan.errflags = 0;
+	scan.rcode = 0;
 	sp = &scan;
 
 	memset(m, 0, sizeof *m);
@@ -536,7 +536,7 @@ convM2DNS(uchar *buf, int len, DNSmsg *m, int *errp)
 	m->ns = rrloop(sp, "nameservers",m->nscount, 0);
 	err = scan.err;				/* live with bad ar's */
 	m->ar = rrloop(sp, "hints",	m->arcount, 0);
-	if (errp)
-		*errp = scan.errflags;
+	if (codep)
+		*codep = scan.rcode;
 	return err;
 }

+ 1 - 1
sys/src/cmd/ndb/csquery.c

@@ -22,7 +22,7 @@ query(char *addr)
 	fd = open(server, ORDWR);
 	if(fd < 0)
 		sysfatal("cannot open %s: %r", server);
-	if(write(fd, addr, strlen(addr)) <= 0){
+	if(write(fd, addr, strlen(addr)) != strlen(addr)){
 		if(!statusonly)
 			fprint(2, "translating %s: %r\n", addr);
 		status = "errors";

+ 4 - 3
sys/src/cmd/ndb/dblookup.c

@@ -68,7 +68,8 @@ opendatabase(void)
  *  shared state there.
  *
  *  e.g. for x.research.bell-labs.com, first look for a match against
- *       the x.research.bell-labs.com.  If nothing matches, try *.research.bell-labs.com.
+ *       the x.research.bell-labs.com.  If nothing matches,
+ *	 try *.research.bell-labs.com.
  */
 RR*
 dblookup(char *name, int class, int type, int auth, int ttl)
@@ -141,10 +142,10 @@ out:
 		for(tp = rp; tp; tp = tp->next)
 			tp->owner = dp;
 	else {
-		/* don't call it non-existent if it's not ours */
+		/* don't call it non-existent (etc.) if it's not ours */
 		if(err == Rname && !inmyarea(name))
 			err = Rserver;
-		dp->nonexistent = err;
+		dp->respcode = err;
 	}
 
 	unlock(&dblock);

+ 97 - 37
sys/src/cmd/ndb/dnresolve.c

@@ -97,8 +97,8 @@ dnresolve(char *name, int class, int type, Request *req, RR **cn, int depth,
 
 	/* try it as a canonical name if we weren't told the name didn't exist */
 	dp = dnlookup(name, class, 0);
-	if(type != Tptr && dp->nonexistent != Rname)
-		for(loops=0; rp == nil && loops < 32; loops++){
+	if(type != Tptr && dp->respcode != Rname)
+		for(loops = 0; rp == nil && loops < 32; loops++){
 			rp = dnresolve1(name, class, Tcname, req, depth, recurse);
 			if(rp == nil)
 				break;
@@ -119,8 +119,8 @@ dnresolve(char *name, int class, int type, Request *req, RR **cn, int depth,
 		}
 
 	/* distinction between not found and not good */
-	if(rp == nil && status != nil && dp->nonexistent != 0)
-		*status = dp->nonexistent;
+	if(rp == nil && status != nil && dp->respcode != 0)
+		*status = dp->respcode;
 
 	procsetname(procname);
 	free(procname);
@@ -459,7 +459,7 @@ struct Dest
 	uchar	a[IPaddrlen];	/* ip address */
 	DN	*s;		/* name server */
 	int	nx;		/* number of transmissions */
-	int	code;
+	int	code;		/* response code; used to clear dp->respcode */
 };
 
 
@@ -479,40 +479,59 @@ ipisbm(uchar *ip)
 	return 0;
 }
 
+static Ndb *db;
 static Ndbtuple *indoms, *innmsrvs, *outnmsrvs;
-static QLock readlock;
+static QLock ndblock;
+
+static void
+loaddomsrvs(Ndb *db)
+{
+	Ndbs s;
+
+	if (indoms == nil) {
+		free(ndbgetvalue(db, &s, "sys", "inside-dom", "dom", &indoms));
+		free(ndbgetvalue(db, &s, "sys", "inside-ns", "ip", &innmsrvs));
+		free(ndbgetvalue(db, &s, "sys", "outside-ns", "ip", &outnmsrvs));
+		syslog(0, LOG, "reloaded inside-dom, inside-ns, outside-ns");
+	}
+}
 
 /*
  * is this domain (or DOMAIN or Domain or dOMAIN)
  * internal to our organisation (behind our firewall)?
+ * only inside straddling servers care, everybody else gets told `yes',
+ * so they'll use mntpt for their queries.
  */
 static int
 insideaddr(char *dom)
 {
-	int domlen, vallen;
-	Ndb *db;
-	Ndbs s;
+	int domlen, vallen, rv;
 	Ndbtuple *t;
 
-	if (straddle && indoms == nil) {
-		db = ndbopen("/lib/ndb/local");
-		if (db != nil) {
-			qlock(&readlock);
-			if (indoms == nil) {	/* retest under lock */
-				free(ndbgetvalue(db, &s, "sys", "inside-dom",
-					"dom", &indoms));
-				free(ndbgetvalue(db, &s, "sys", "inside-ns",
-					"ip", &innmsrvs));
-				free(ndbgetvalue(db, &s, "sys", "outside-ns",
-					"ip", &outnmsrvs));
-			}
-			qunlock(&readlock);
-			ndbclose(db);	/* destroys *indoms, *innmsrvs? */
-		}
+	if (!inside || !straddle || !serve)
+		return 1;
+
+	qlock(&ndblock);
+	if (indoms == nil) {
+		db = ndbopen(nil);
+		if (db != nil)
+			loaddomsrvs(db);
+		/* leave db open so we can quickly test for changes */
+	} else if (ndbchanged(db)) {
+		ndbfree(indoms);
+		ndbfree(innmsrvs);
+		ndbfree(outnmsrvs);
+		indoms = innmsrvs = outnmsrvs = nil;
+		ndbreopen(db);
+		loaddomsrvs(db);
 	}
-	if (indoms == nil)
+
+	if (indoms == nil) {
+		qunlock(&ndblock);
 		return 1;	/* no "inside" sys, try inside nameservers */
+	}
 
+	rv = 0;
 	domlen = strlen(dom);
 	for (t = indoms; t != nil; t = t->entry) {
 		if (strcmp(t->attr, "dom") != 0)
@@ -521,10 +540,13 @@ insideaddr(char *dom)
 		if (cistrcmp(dom, t->val) == 0 ||
 		    domlen > vallen &&
 		     cistrcmp(dom + domlen - vallen, t->val) == 0 &&
-		     dom[domlen - vallen - 1] == '.')
-			return 1;
+		     dom[domlen - vallen - 1] == '.') {
+			rv = 1;
+			break;
+		}
 	}
-	return 0;
+	qunlock(&ndblock);
+	return rv;
 }
 
 static int
@@ -830,9 +852,9 @@ syslog(0, LOG, "netquery1: no servers for %s", dp->name);	// DEBUG
 			 */
 			if(m.an != nil || (m.flags & Fauth)){
 				if(m.an == nil && (m.flags & Rmask) == Rname)
-					dp->nonexistent = Rname;
+					dp->respcode = Rname;
 				else
-					dp->nonexistent = 0;
+					dp->respcode = 0;
 
 				/*
 				 *  cache any negative responses, free soarr
@@ -872,14 +894,39 @@ syslog(0, LOG, "netquery1: no servers for %s", dp->name);	// DEBUG
 	}
 
 	/* if all servers returned failure, propagate it */
-	dp->nonexistent = Rserver;
+	dp->respcode = Rserver;
 	for(p = dest; p < l; p++)
 		if(p->code != Rserver)
-			dp->nonexistent = 0;
+			dp->respcode = 0;
 
 	return 0;
 }
 
+/*
+ *  run a command with a supplied fd as standard input
+ */
+char *
+system(int fd, char *cmd)
+{
+	int pid, p, i;
+	static Waitmsg msg;
+
+	if((pid = fork()) == -1)
+		sysfatal("fork failed: %r");
+	else if(pid == 0){
+		dup(fd, 0);
+		close(fd);
+		for (i = 3; i < 200; i++)
+			close(i);		/* don't leak fds */
+		execl("/bin/rc", "rc", "-c", cmd, nil);
+		sysfatal("exec rc: %r");
+	}
+	for(p = waitpid(); p >= 0; p = waitpid())
+		if(p == pid)
+			return msg.msg;	
+	return "lost child";
+}
+
 enum { Hurry, Patient, };
 enum { Outns, Inns, };
 
@@ -888,6 +935,7 @@ udpquery(char *mntpt, DN *dp, int type, RR *nsrp, Request *reqp, int depth,
 	int patient, int inns)
 {
 	int fd, rv = 0;
+	char *msg;
 	uchar *obuf, *ibuf;
 
 	/* use alloced buffers rather than ones from the stack */
@@ -895,6 +943,17 @@ udpquery(char *mntpt, DN *dp, int type, RR *nsrp, Request *reqp, int depth,
 	obuf = emalloc(Maxudp+OUdphdrsize);
 
 	fd = udpport(mntpt);
+	if (fd < 0 && straddle && strcmp(mntpt, "/net.alt") == 0) {
+		/* HACK: remount /net.alt */
+		syslog(0, LOG, "remounting /net.alt");
+		unmount(nil, "/net.alt");
+		msg = system(open("/dev/null", ORDWR), "outside");
+		if (msg && *msg) {
+			syslog(0, LOG, "can't remount /net.alt: %s", msg);
+			sleep(2000);		/* don't spin wildly */
+		} else
+			fd = udpport(mntpt);
+	}
 	if(fd >= 0) {
 		reqp->aborttime = time(0) + (patient? Maxreqtm: Maxreqtm/2);
 		rv = netquery1(fd, dp, type, nsrp, reqp, depth,
@@ -940,18 +999,19 @@ netquery(DN *dp, int type, RR *nsrp, Request *reqp, int depth)
 	rv = 0;				/* pessimism */
 	triedin = 0;
 	/*
-	 * don't bother to query the (broken) inside nameservers for outside
-	 * addresses unless we're just a client.  if we're a server, we'd
-	 * better have a working /net.alt.
+	 * normal resolvers and servers will just use mntpt for all addresses,
+	 * even on the outside.  straddling servers will use mntpt (/net)
+	 * for inside addresses and /net.alt for outside addresses,
+	 * thus bypassing other inside nameservers.
 	 */
-	if (!serve || !inside || insideaddr(dp->name)) {
+	if (!straddle || insideaddr(dp->name)) {
 		rv = udpquery(mntpt, dp, type, nsrp, reqp, depth, Hurry,
 			(inside? Inns: Outns));
 		triedin = 1;
 	}
 
 	/*
-	 * if we're still looking and have an outside address,
+	 * if we're still looking, are inside, and have an outside domain,
 	 * try it on our outside interface, if any.
 	 */
 	if (rv == 0 && inside && !insideaddr(dp->name)) {

+ 29 - 17
sys/src/cmd/ndb/dns.c

@@ -178,7 +178,8 @@ main(int argc, char *argv[])
 	if(myipaddr(ipaddr, mntpt) < 0)
 		sysfatal("can't read my ip address");
 
-	syslog(0, logfile, "starting dns on %I's %s", ipaddr, mntpt);
+	syslog(0, logfile, "starting %sdns on %I's %s",
+		(straddle? "straddling ": ""), ipaddr, mntpt);
 
 	opendatabase();
 
@@ -597,17 +598,20 @@ rcreate(Job *job, Mfile *mf)
 void
 rread(Job *job, Mfile *mf)
 {
-	int i, n, cnt;
+	int i, n;
 	long clock;
+	ulong cnt;
 	vlong off;
 	char *err;
 	uchar buf[Maxfdata];
 	Dir dir;
 
 	n = 0;
-	err = 0;
+	err = nil;
 	off = job->request.offset;
 	cnt = job->request.count;
+	*buf = '\0';
+	job->reply.data = (char*)buf;
 	if(mf->qid.type & QTDIR){
 		clock = time(0);
 		if(off == 0){
@@ -618,11 +622,13 @@ rread(Job *job, Mfile *mf)
 			dir.mode = 0666;
 			dir.length = 0;
 			dir.uid = dir.gid = dir.muid = mf->user;
-			dir.atime = dir.mtime = clock;	/* wrong */
+			dir.atime = dir.mtime = clock;		/* wrong */
 			n = convD2M(&dir, buf, sizeof buf);
 		}
-		job->reply.data = (char*)buf;
-	} else {
+	} else if (off < 0)
+		err = "negative read offset";
+	else {
+		/* first offset will always be zero */
 		for(i = 1; i <= mf->nrr; i++)
 			if(mf->rr[i] > off)
 				break;
@@ -631,6 +637,7 @@ rread(Job *job, Mfile *mf)
 				n = mf->rr[i] - off;
 			else
 				n = cnt;
+			assert(n >= 0);
 			job->reply.data = mf->reply + off;
 		}
 	}
@@ -641,17 +648,22 @@ rread(Job *job, Mfile *mf)
 void
 rwrite(Job *job, Mfile *mf, Request *req)
 {
-	int cnt, rooted, status, wantsav;
+	int rooted, status, wantsav;
 	long n;
+	ulong cnt;
 	char *err, *p, *atype;
 	RR *rp, *tp, *neg;
 
-	err = 0;
+	err = nil;
 	cnt = job->request.count;
 	if(mf->qid.type & QTDIR){
 		err = "can't write directory";
 		goto send;
 	}
+	if (job->request.offset != 0) {
+		err = "writing at non-zero offset";
+		goto send;
+	}
 	if(cnt >= Maxrequest){
 		err = "request too long";
 		goto send;
@@ -663,20 +675,16 @@ rwrite(Job *job, Mfile *mf, Request *req)
 	/*
 	 *  special commands
 	 */
-	if(strncmp(job->request.data, "debug", 5)==0 &&
-	    job->request.data[5] == 0){
+	if(strcmp(job->request.data, "debug")==0){
 		debug ^= 1;
 		goto send;
-	} else if(strncmp(job->request.data, "dump", 4)==0 &&
-	    job->request.data[4] == 0){
+	} else if(strcmp(job->request.data, "dump")==0){
 		dndump("/lib/ndb/dnsdump");
 		goto send;
-	} else if(strncmp(job->request.data, "refresh", 7)==0 &&
-	    job->request.data[7] == 0){
+	} else if(strcmp(job->request.data, "refresh")==0){
 		needrefresh = 1;
 		goto send;
-	} else if(strncmp(job->request.data, "poolcheck", 9)==0 &&
-	    job->request.data[9] == 0){
+	} else if(strcmp(job->request.data, "poolcheck")==0){
 		poolcheck(mainmem);
 		goto send;
 	}
@@ -710,6 +718,7 @@ rwrite(Job *job, Mfile *mf, Request *req)
 		goto send;
 	}
 
+	/* normal request: domain [type] */
 	mf->type = rrtype(atype);
 	if(mf->type < 0){
 		err = "unknown type";
@@ -729,15 +738,18 @@ rwrite(Job *job, Mfile *mf, Request *req)
 		p++;
 	} else
 		wantsav = 0;
+
 	dncheck(0, 1);
 	rp = dnresolve(p, Cin, mf->type, req, 0, 0, Recurse, rooted, &status);
+
 	dncheck(0, 1);
 	neg = rrremneg(&rp);
 	if(neg){
 		status = neg->negrcode;
 		rrfreelist(neg);
 	}
-	if(rp == 0)
+
+	if(rp == nil)
 		switch(status){
 		case Rname:
 			err = "name does not exist";

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

@@ -186,7 +186,8 @@ struct DN
 	ulong	lookuptime;	/* last time we tried to get a better value */
 	ushort	class;		/* RR class */
 	char	refs;		/* for mark and sweep */
-	char	nonexistent;	/* true if we get an authoritative nx for this domain */
+	uchar	respcode;	/* response code */
+/* was:	char	nonexistent; /* true if we get an authoritative nx for this domain */
 	ulong	ordinal;
 	QLock	querylck;	/* permit only 1 query per domain name at a time */
 };

+ 3 - 0
sys/src/cmd/ndb/dnsdebug.c

@@ -10,6 +10,8 @@ enum {
 	Maxrequest=		128,
 };
 
+extern int inside;
+
 static char *servername;
 static RR *serverrr;
 static RR *serveraddrs;
@@ -52,6 +54,7 @@ main(int argc, char *argv[])
 	char *f[4];
 
 	strcpy(mntpt, "/net");
+	inside = 1;
 
 	ARGBEGIN{
 	case 'f':

+ 9 - 9
sys/src/cmd/ndb/dnserver.c

@@ -15,7 +15,7 @@ int	norecursion;		/* don't allow recursive requests */
  *  answer a dns request
  */
 void
-dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int errflags)
+dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int rcode)
 {
 	int recursionflag;
 	char *cp, *errmsg;
@@ -37,14 +37,14 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int errflags)
 	tp->next = 0;
 	repp->qd = tp;
 
-	if (errflags) {
+	if (rcode) {
 		errmsg = "";
-		if (errflags >= 0 && errflags < nrname)
-			errmsg = rname[errflags];
-		syslog(0, logfile, "server: error flags 0%o (%s), req from %I",
-			errflags, errmsg, srcip);
+		if (rcode >= 0 && rcode < nrname)
+			errmsg = rname[rcode];
+		syslog(0, logfile, "server: response code 0%o (%s), req from %I",
+			rcode, errmsg, srcip);
 		/* provide feedback to clients who send us trash */
-		repp->flags = (errflags&Rmask) | Fresp | Fcanrec | Oquery;
+		repp->flags = (rcode&Rmask) | Fresp | Fcanrec | Oquery;
 		return;
 	}
 	if(!rrsupported(repp->qd->type)){
@@ -94,9 +94,9 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int errflags)
 	/* pass on error codes */
 	if(repp->an == 0){
 		dp = dnlookup(repp->qd->owner->name, repp->qd->owner->class, 0);
-		if(dp->rr == 0)
+		if(dp->rr == nil)
 			if(reqp->flags & Frecurse)
-				repp->flags |= dp->nonexistent|Fauth;
+				repp->flags |= dp->respcode | Fauth;
 	}
 
 	if(myarea == nil)

+ 1 - 1
sys/src/cmd/ndb/dnsquery.c

@@ -106,7 +106,7 @@ main(int argc, char *argv[])
 		}
 
 		seek(fd, 0, 0);
-		if(write(fd, line, n) < 0) {
+		if(write(fd, line, n) != n) {
 			print("!%r\n");
 			continue;
 		}

+ 8 - 5
sys/src/cmd/ndb/dnstcp.c

@@ -6,6 +6,8 @@
 #include <ip.h>
 #include "dns.h"
 
+extern int inside;
+
 char	*LOG;
 int	cachedb = 1;
 char	*caller = "";
@@ -38,7 +40,7 @@ usage(void)
 void
 main(int argc, char *argv[])
 {
-	int len, errflags;
+	int len, rcode;
 	uchar buf[512];
 	char tname[32];
 	char *err, *ext = "";
@@ -72,6 +74,7 @@ main(int argc, char *argv[])
 	if(argc > 0)
 		getcaller(argv[0]);
 
+	inside = 1;
 	dninit();
 
 	snprint(mntpt, sizeof mntpt, "/net%s", ext);
@@ -97,16 +100,16 @@ main(int argc, char *argv[])
 			break;
 		getactivity(&req, 0);
 		req.aborttime = now + 15*Min;
-		errflags = 0;
+		rcode = 0;
 		memset(&reqmsg, 0, sizeof reqmsg);
-		err = convM2DNS(buf, len, &reqmsg, &errflags);
+		err = convM2DNS(buf, len, &reqmsg, &rcode);
 		if(err){
 			/* first bytes in buf are source IP addr */
 			syslog(0, logfile, "server: input error: %s from %I",
 				err, buf);
 			break;
 		}
-		if (errflags == 0)
+		if (rcode == 0)
 			if(reqmsg.qdcount < 1){
 				syslog(0, logfile,
 					"server: no questions from %I", buf);
@@ -132,7 +135,7 @@ main(int argc, char *argv[])
 			if(reqmsg.qd->type == Taxfr)
 				dnzone(&reqmsg, &repmsg, &req);
 			else {
-				dnserver(&reqmsg, &repmsg, &req, buf, errflags);
+				dnserver(&reqmsg, &repmsg, &req, buf, rcode);
 				reply(1, &repmsg, &req);
 				rrfreelist(repmsg.qd);
 				rrfreelist(repmsg.an);

+ 5 - 5
sys/src/cmd/ndb/dnudpserver.c

@@ -70,7 +70,7 @@ clientrxmit(DNSmsg *req, uchar *buf)
 void
 dnudpserver(char *mntpt)
 {
-	int fd, len, op, errflags;
+	int fd, len, op, rcode;
 	uchar buf[OUdphdrsize + Maxudp + 1024];
 	char *err;
 	char tname[32];
@@ -121,15 +121,15 @@ restart:
 		//	((OUdphdr*)buf)->raddr, ((OUdphdr*)buf)->laddr);
 		getactivity(&req, 0);
 		req.aborttime = now + Maxreqtm;
-		errflags = 0;
-		err = convM2DNS(&buf[OUdphdrsize], len, &reqmsg, &errflags);
+		rcode = 0;
+		err = convM2DNS(&buf[OUdphdrsize], len, &reqmsg, &rcode);
 		if(err){
 			/* first bytes in buf are source IP addr */
 			syslog(0, logfile, "server: input error: %s from %I",
 				err, buf);
 			continue;
 		}
-		if (errflags == 0)
+		if (rcode == 0)
 			if(reqmsg.qdcount < 1){
 				syslog(0, logfile,
 					"server: no questions from %I", buf);
@@ -166,7 +166,7 @@ restart:
 			memset(&repmsg, 0, sizeof repmsg);
 			switch(op){
 			case Oquery:
-				dnserver(&reqmsg, &repmsg, &req, buf, errflags);
+				dnserver(&reqmsg, &repmsg, &req, buf, rcode);
 				break;
 			case Onotify:
 				dnnotify(&reqmsg, &repmsg, &req);

+ 1 - 1
sys/src/cmd/postscript/common/getopt.c

@@ -22,7 +22,7 @@ char **argv, *opts;
 		if (optind >= argc ||
 		   argv[optind][0] != '-' || argv[optind][1] == '\0')
 			return EOF;
-		else if (strcmp(argv[optind], "--") == NULL) {
+		else if (strcmp(argv[optind], "--") == 0) {
 			optind++;
 			return EOF;
 		}

+ 0 - 4
sys/src/cmd/upas/unesc/mkfile

@@ -1,14 +1,10 @@
 </$objtype/mkfile
 
 TARG=unesc
-
 OFILES=unesc.$O\
 
 BIN=/$objtype/bin/upas
 
-CC=pcc -c
-CFLAGS=-B
-
 UPDATE=\
 	mkfile\
 	$HFILES\

+ 31 - 27
sys/src/cmd/upas/unesc/unesc.c

@@ -1,48 +1,52 @@
 /*
  *	upas/unesc - interpret =?foo?bar?=char?= escapes
  */
-
-#include <stdio.h>
-#include <stdlib.h>
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
 
 int
 hex(int c)
 {
 	if('0' <= c && c <= '9')
 		return c - '0';
-	if('A' <= c && c <= 'F')
-		return c - 'A' + 10;
 	if('a' <= c && c <= 'f')
 		return c - 'a' + 10;
+	if('A' <= c && c <= 'F')
+		return c - 'A' + 10;
 	return 0;
 }
 
 void
-main(int argc, char **argv)
+main(void)
 {
 	int c;
+	Biobuf bin, bout;
 
-	while((c=getchar()) != EOF){
-		if(c == '='){
-			if((c=getchar()) == '?'){
-				while((c=getchar()) != EOF && c != '?')
-					continue;
-				while((c=getchar()) != EOF && c != '?')
-					continue;
-				while((c=getchar()) != EOF && c != '?'){
-					if(c == '='){
-						c = hex(getchar()) << 4;
-						c |= hex(getchar());
-					}
-					putchar(c);
+	Binit(&bin,  0, OREAD);
+	Binit(&bout, 1, OWRITE);
+	while((c = Bgetc(&bin)) != Beof)
+		if(c != '=')
+			Bputc(&bout, c);
+		else if((c = Bgetc(&bin)) != '?'){
+			Bputc(&bout, '=');
+			Bputc(&bout, c);
+		} else {
+			while((c = Bgetc(&bin)) != Beof && c != '?')
+				continue;		/* consume foo */
+			while((c = Bgetc(&bin)) != Beof && c != '?')
+				continue;		/* consume bar */
+			while((c = Bgetc(&bin)) != Beof && c != '?'){
+				if(c == '='){
+					c  = hex(Bgetc(&bin)) << 4;
+					c |= hex(Bgetc(&bin));
 				}
-				(void) getchar();	/* consume '=' */
-			}else{
-				putchar('=');
-				putchar(c);
+				Bputc(&bout, c);
 			}
-		}else
-			putchar(c);
-	}
-	exit(0);
+			c = Bgetc(&bin);		/* consume '=' */
+			if (c != '=')	
+				Bungetc(&bin);
+		}
+	Bterm(&bout);
+	exits(0);
 }

+ 14 - 0
sys/src/libc/9syscall/mkfile

@@ -46,6 +46,13 @@ install:V:
 			echo ADD '$4',R29
 			echo SYSCALL
 			echo ADD '$-4',R29
+			if(~ $i seek) {		# untested so far - geoff
+				echo 'MOVW $-1,R5
+				BNE R1,R5,4(PC)
+				MOVW a+0(FP),R5
+				MOVW R1,0(R5)
+				MOVW R1,4(R5)'
+			}
 			echo RET
 		case 386
 			echo TEXT $i'(SB)', 1, '$0'
@@ -98,6 +105,13 @@ install:V:
 			echo MOVW R0, '0(FP)'
 			echo MOVW '$'$n, R0
 			echo SWI 0
+			if(~ $i seek) {
+				echo 'CMP $-1,R0
+				BNE 4(PC)
+				MOVW a+0(FP),R1
+				MOVW R0,0(R1)
+				MOVW R0,4(R1)'
+			}
 			echo RET
 		case power
 			echo TEXT $i'(SB)', 1, '$0'

+ 1 - 1
sys/src/libmach/5.c

@@ -55,7 +55,7 @@ Mach marm =
 	0x1000,		/* page size */
 	0xC0000000ULL,	/* kernel base */
 	0xC0000000ULL,	/* kernel text mask */
-	0x7FFFFFFFULL,	/* user stack top */
+	0x3FFFFFFFULL,	/* user stack top */
 	4,		/* quantization of pc */
 	4,		/* szaddr */
 	4,		/* szreg */