Browse Source

Plan 9 from Bell Labs 2007-03-04

David du Colombier 14 years ago
parent
commit
d5be51b616

+ 19 - 21
dist/replica/_plan9.db

@@ -5768,7 +5768,7 @@ sys/games - 20000000775 sys sys 1117225532 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1172125060 263335
+sys/games/lib/fortunes - 664 sys sys 1172959612 263699
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -7287,7 +7287,7 @@ 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 1134330265 1294
 sys/man/1/cat - 664 sys sys 1113743325 1338
-sys/man/1/cb - 664 sys sys 1134330484 785
+sys/man/1/cb - 664 sys sys 1172959600 786
 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
@@ -7507,7 +7507,7 @@ sys/man/2/iounit - 664 sys sys 1015091523 1001
 sys/man/2/ip - 664 sys sys 1162102153 7209
 sys/man/2/isalpharune - 664 sys sys 1015091523 1059
 sys/man/2/keyboard - 664 sys sys 950892860 2065
-sys/man/2/lock - 664 sys sys 1048643958 4692
+sys/man/2/lock - 664 sys sys 1172959628 4693
 sys/man/2/mach - 664 sys sys 1080179298 7995
 sys/man/2/malloc - 664 sys sys 1102093069 4763
 sys/man/2/matrix - 664 sys sys 950892861 6090
@@ -7725,12 +7725,12 @@ sys/man/8/boot - 664 sys sys 1165623055 8357
 sys/man/8/booting - 664 sys sys 1015024984 4136
 sys/man/8/cpurc - 664 sys sys 971455510 1275
 sys/man/8/cron - 664 sys sys 1063858596 1867
-sys/man/8/dhcpd - 664 sys sys 1160071627 5460
+sys/man/8/dhcpd - 664 sys sys 1172959497 5572
 sys/man/8/disksim - 664 sys sys 1144150487 1476
 sys/man/8/drawterm - 664 sys sys 1135901219 1741
 sys/man/8/fossilcons - 664 sys sys 1155362671 18291
-sys/man/8/fs - 664 sys sys 1055701170 15029
-sys/man/8/fsconfig - 664 sys sys 1142906116 8281
+sys/man/8/fs - 664 sys sys 1172956177 15086
+sys/man/8/fsconfig - 664 sys sys 1172956534 8878
 sys/man/8/getflags - 664 sys sys 1159419702 1713
 sys/man/8/gpsfs - 664 sys sys 1165623047 4918
 sys/man/8/httpd - 664 sys sys 1165623004 6865
@@ -8507,19 +8507,16 @@ sys/src/ape/lib/ap/arm/getfcr.s - 664 sys sys 1014921992 164
 sys/src/ape/lib/ap/arm/lock.c - 664 sys sys 1014921992 255
 sys/src/ape/lib/ap/arm/main9.s - 664 sys sys 1014921991 262
 sys/src/ape/lib/ap/arm/main9p.s - 664 sys sys 1014921991 544
-sys/src/ape/lib/ap/arm/memchr.c - 664 sys sys 1014921992 163
-sys/src/ape/lib/ap/arm/memcmp.c - 664 sys sys 1014921992 262
 sys/src/ape/lib/ap/arm/memmove.s - 664 sys sys 1014921992 4391
-sys/src/ape/lib/ap/arm/memset.s - 664 sys sys 1014921992 1119
-sys/src/ape/lib/ap/arm/mkfile - 664 sys sys 1014921992 344
+sys/src/ape/lib/ap/arm/memset.s - 664 sys sys 1172956011 1057
+sys/src/ape/lib/ap/arm/mkfile - 664 sys sys 1172955903 308
 sys/src/ape/lib/ap/arm/notetramp.c - 664 sys sys 1014921992 1342
-sys/src/ape/lib/ap/arm/setjmp.s - 664 sys sys 1014921992 587
-sys/src/ape/lib/ap/arm/strcat.c - 664 sys sys 1014921992 105
-sys/src/ape/lib/ap/arm/strchr.s - 664 sys sys 1014921992 745
-sys/src/ape/lib/ap/arm/strcpy.s - 664 sys sys 1014921992 1215
-sys/src/ape/lib/ap/arm/strlen.c - 664 sys sys 1014921992 81
+sys/src/ape/lib/ap/arm/setjmp.s - 664 sys sys 1172955904 587
+sys/src/ape/lib/ap/arm/strchr.s - 664 sys sys 1172955904 841
+sys/src/ape/lib/ap/arm/strcmp.s - 664 sys sys 1172956230 1010
+sys/src/ape/lib/ap/arm/strcpy.s - 664 sys sys 1172955904 885
 sys/src/ape/lib/ap/arm/tas.s - 664 sys sys 1014921992 61
-sys/src/ape/lib/ap/arm/vlop.s - 664 sys sys 1014921992 543
+sys/src/ape/lib/ap/arm/vlop.s - 664 sys sys 1172955903 262
 sys/src/ape/lib/ap/arm/vlrt.c - 664 sys sys 1014921992 8983
 sys/src/ape/lib/ap/extraobjs - 775 sys sys 1014921988 1356
 sys/src/ape/lib/ap/gen - 20000000775 sys sys 1048644320 0
@@ -12329,10 +12326,10 @@ sys/src/cmd/ip/dhcpclient.c - 664 sys sys 1050714660 11978
 sys/src/cmd/ip/dhcpd - 20000000775 sys sys 1063897571 0
 sys/src/cmd/ip/dhcpd/dat.h - 664 sys sys 1084471353 2522
 sys/src/cmd/ip/dhcpd/db.c - 664 sys sys 1143670612 7466
-sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1161483751 33248
+sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1172959216 33339
 sys/src/cmd/ip/dhcpd/dhcpleases.c - 664 sys sys 1032655001 779
 sys/src/cmd/ip/dhcpd/mkfile - 664 sys sys 1169162185 443
-sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1084471375 6063
+sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1172959226 6235
 sys/src/cmd/ip/dhcpd/ping.c - 664 sys sys 1169162185 1163
 sys/src/cmd/ip/dhcpd/testlook.c - 664 sys sys 950389140 4640
 sys/src/cmd/ip/dhcpd/testlookup.c - 664 sys sys 950389140 3195
@@ -12542,7 +12539,7 @@ sys/src/cmd/kl/l.h - 664 sys sys 1020311762 5250
 sys/src/cmd/kl/list.c - 664 sys sys 1014925965 4502
 sys/src/cmd/kl/mkfile - 664 sys sys 944961015 258
 sys/src/cmd/kl/noop.c - 664 sys sys 1045503968 11140
-sys/src/cmd/kl/obj.c - 664 sys sys 1089299170 21649
+sys/src/cmd/kl/obj.c - 664 sys sys 1172957404 21751
 sys/src/cmd/kl/optab.c - 664 sys sys 1105798985 7369
 sys/src/cmd/kl/pass.c - 664 sys sys 1132451576 9340
 sys/src/cmd/kl/sched.c - 664 sys sys 1089299170 10796
@@ -13090,7 +13087,7 @@ sys/src/cmd/ql/asmout.c - 664 sys sys 1137459145 35737
 sys/src/cmd/ql/cnam.c - 664 sys sys 1089299167 335
 sys/src/cmd/ql/compat.c - 664 sys sys 944961082 445
 sys/src/cmd/ql/cputime.c - 664 sys sys 944961081 336
-sys/src/cmd/ql/l.h - 664 sys sys 1141144912 5936
+sys/src/cmd/ql/l.h - 664 sys sys 1172956269 5938
 sys/src/cmd/ql/list.c - 664 sys sys 1141144912 5663
 sys/src/cmd/ql/mkcname - 664 sys sys 944961082 143
 sys/src/cmd/ql/mkfile - 664 sys sys 1089299166 304
@@ -14108,7 +14105,7 @@ sys/src/cmd/upas/vf/mkfile - 664 sys sys 1064393881 241
 sys/src/cmd/upas/vf/vf.c - 664 sys sys 1143759341 20030
 sys/src/cmd/usb - 20000000775 sys sys 1091205029 0
 sys/src/cmd/usb/audio - 20000000775 sys sys 1091204980 0
-sys/src/cmd/usb/audio/audiofs.c - 664 sys sys 1172764045 18191
+sys/src/cmd/usb/audio/audiofs.c - 664 sys sys 1172903208 18518
 sys/src/cmd/usb/audio/audiosub.c - 664 sys sys 1172764044 8275
 sys/src/cmd/usb/audio/mkfile - 664 sys sys 1091204980 349
 sys/src/cmd/usb/audio/usbaudio.c - 664 sys sys 1172764045 10358
@@ -15685,3 +15682,4 @@ 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/ip/dhcpd - 775 sys sys 1172980949 151301

+ 19 - 22
dist/replica/plan9.db

@@ -285,7 +285,7 @@
 386/bin/iostats - 775 sys sys 1168402317 100378
 386/bin/ip - 20000000775 sys sys 1016920851 0
 386/bin/ip/dhcpclient - 775 sys sys 1168402317 94377
-386/bin/ip/dhcpd - 775 sys sys 1169612024 151139
+386/bin/ip/dhcpd - 775 sys sys 1172980949 151301
 386/bin/ip/dhcpleases - 775 sys sys 1169612024 86533
 386/bin/ip/ftpd - 775 sys sys 1169612025 170706
 386/bin/ip/gizzard - 775 sys sys 1081480408 101521
@@ -5768,7 +5768,7 @@ sys/games - 20000000775 sys sys 1117225532 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1172125060 263335
+sys/games/lib/fortunes - 664 sys sys 1172959612 263699
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -7287,7 +7287,7 @@ 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 1134330265 1294
 sys/man/1/cat - 664 sys sys 1113743325 1338
-sys/man/1/cb - 664 sys sys 1134330484 785
+sys/man/1/cb - 664 sys sys 1172959600 786
 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
@@ -7507,7 +7507,7 @@ sys/man/2/iounit - 664 sys sys 1015091523 1001
 sys/man/2/ip - 664 sys sys 1162102153 7209
 sys/man/2/isalpharune - 664 sys sys 1015091523 1059
 sys/man/2/keyboard - 664 sys sys 950892860 2065
-sys/man/2/lock - 664 sys sys 1048643958 4692
+sys/man/2/lock - 664 sys sys 1172959628 4693
 sys/man/2/mach - 664 sys sys 1080179298 7995
 sys/man/2/malloc - 664 sys sys 1102093069 4763
 sys/man/2/matrix - 664 sys sys 950892861 6090
@@ -7725,12 +7725,12 @@ sys/man/8/boot - 664 sys sys 1165623055 8357
 sys/man/8/booting - 664 sys sys 1015024984 4136
 sys/man/8/cpurc - 664 sys sys 971455510 1275
 sys/man/8/cron - 664 sys sys 1063858596 1867
-sys/man/8/dhcpd - 664 sys sys 1160071627 5460
+sys/man/8/dhcpd - 664 sys sys 1172959497 5572
 sys/man/8/disksim - 664 sys sys 1144150487 1476
 sys/man/8/drawterm - 664 sys sys 1135901219 1741
 sys/man/8/fossilcons - 664 sys sys 1155362671 18291
-sys/man/8/fs - 664 sys sys 1055701170 15029
-sys/man/8/fsconfig - 664 sys sys 1142906116 8281
+sys/man/8/fs - 664 sys sys 1172956177 15086
+sys/man/8/fsconfig - 664 sys sys 1172956534 8878
 sys/man/8/getflags - 664 sys sys 1159419702 1713
 sys/man/8/gpsfs - 664 sys sys 1165623047 4918
 sys/man/8/httpd - 664 sys sys 1165623004 6865
@@ -8507,19 +8507,16 @@ sys/src/ape/lib/ap/arm/getfcr.s - 664 sys sys 1014921992 164
 sys/src/ape/lib/ap/arm/lock.c - 664 sys sys 1014921992 255
 sys/src/ape/lib/ap/arm/main9.s - 664 sys sys 1014921991 262
 sys/src/ape/lib/ap/arm/main9p.s - 664 sys sys 1014921991 544
-sys/src/ape/lib/ap/arm/memchr.c - 664 sys sys 1014921992 163
-sys/src/ape/lib/ap/arm/memcmp.c - 664 sys sys 1014921992 262
 sys/src/ape/lib/ap/arm/memmove.s - 664 sys sys 1014921992 4391
-sys/src/ape/lib/ap/arm/memset.s - 664 sys sys 1014921992 1119
-sys/src/ape/lib/ap/arm/mkfile - 664 sys sys 1014921992 344
+sys/src/ape/lib/ap/arm/memset.s - 664 sys sys 1172956011 1057
+sys/src/ape/lib/ap/arm/mkfile - 664 sys sys 1172955903 308
 sys/src/ape/lib/ap/arm/notetramp.c - 664 sys sys 1014921992 1342
-sys/src/ape/lib/ap/arm/setjmp.s - 664 sys sys 1014921992 587
-sys/src/ape/lib/ap/arm/strcat.c - 664 sys sys 1014921992 105
-sys/src/ape/lib/ap/arm/strchr.s - 664 sys sys 1014921992 745
-sys/src/ape/lib/ap/arm/strcpy.s - 664 sys sys 1014921992 1215
-sys/src/ape/lib/ap/arm/strlen.c - 664 sys sys 1014921992 81
+sys/src/ape/lib/ap/arm/setjmp.s - 664 sys sys 1172955904 587
+sys/src/ape/lib/ap/arm/strchr.s - 664 sys sys 1172955904 841
+sys/src/ape/lib/ap/arm/strcmp.s - 664 sys sys 1172956230 1010
+sys/src/ape/lib/ap/arm/strcpy.s - 664 sys sys 1172955904 885
 sys/src/ape/lib/ap/arm/tas.s - 664 sys sys 1014921992 61
-sys/src/ape/lib/ap/arm/vlop.s - 664 sys sys 1014921992 543
+sys/src/ape/lib/ap/arm/vlop.s - 664 sys sys 1172955903 262
 sys/src/ape/lib/ap/arm/vlrt.c - 664 sys sys 1014921992 8983
 sys/src/ape/lib/ap/extraobjs - 775 sys sys 1014921988 1356
 sys/src/ape/lib/ap/gen - 20000000775 sys sys 1048644320 0
@@ -12329,10 +12326,10 @@ sys/src/cmd/ip/dhcpclient.c - 664 sys sys 1050714660 11978
 sys/src/cmd/ip/dhcpd - 20000000775 sys sys 1063897571 0
 sys/src/cmd/ip/dhcpd/dat.h - 664 sys sys 1084471353 2522
 sys/src/cmd/ip/dhcpd/db.c - 664 sys sys 1143670612 7466
-sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1161483751 33248
+sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1172959216 33339
 sys/src/cmd/ip/dhcpd/dhcpleases.c - 664 sys sys 1032655001 779
 sys/src/cmd/ip/dhcpd/mkfile - 664 sys sys 1169162185 443
-sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1084471375 6063
+sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1172959226 6235
 sys/src/cmd/ip/dhcpd/ping.c - 664 sys sys 1169162185 1163
 sys/src/cmd/ip/dhcpd/testlook.c - 664 sys sys 950389140 4640
 sys/src/cmd/ip/dhcpd/testlookup.c - 664 sys sys 950389140 3195
@@ -12542,7 +12539,7 @@ sys/src/cmd/kl/l.h - 664 sys sys 1020311762 5250
 sys/src/cmd/kl/list.c - 664 sys sys 1014925965 4502
 sys/src/cmd/kl/mkfile - 664 sys sys 944961015 258
 sys/src/cmd/kl/noop.c - 664 sys sys 1045503968 11140
-sys/src/cmd/kl/obj.c - 664 sys sys 1089299170 21649
+sys/src/cmd/kl/obj.c - 664 sys sys 1172957404 21751
 sys/src/cmd/kl/optab.c - 664 sys sys 1105798985 7369
 sys/src/cmd/kl/pass.c - 664 sys sys 1132451576 9340
 sys/src/cmd/kl/sched.c - 664 sys sys 1089299170 10796
@@ -13090,7 +13087,7 @@ sys/src/cmd/ql/asmout.c - 664 sys sys 1137459145 35737
 sys/src/cmd/ql/cnam.c - 664 sys sys 1089299167 335
 sys/src/cmd/ql/compat.c - 664 sys sys 944961082 445
 sys/src/cmd/ql/cputime.c - 664 sys sys 944961081 336
-sys/src/cmd/ql/l.h - 664 sys sys 1141144912 5936
+sys/src/cmd/ql/l.h - 664 sys sys 1172956269 5938
 sys/src/cmd/ql/list.c - 664 sys sys 1141144912 5663
 sys/src/cmd/ql/mkcname - 664 sys sys 944961082 143
 sys/src/cmd/ql/mkfile - 664 sys sys 1089299166 304
@@ -14108,7 +14105,7 @@ sys/src/cmd/upas/vf/mkfile - 664 sys sys 1064393881 241
 sys/src/cmd/upas/vf/vf.c - 664 sys sys 1143759341 20030
 sys/src/cmd/usb - 20000000775 sys sys 1091205029 0
 sys/src/cmd/usb/audio - 20000000775 sys sys 1091204980 0
-sys/src/cmd/usb/audio/audiofs.c - 664 sys sys 1172764045 18191
+sys/src/cmd/usb/audio/audiofs.c - 664 sys sys 1172903208 18518
 sys/src/cmd/usb/audio/audiosub.c - 664 sys sys 1172764044 8275
 sys/src/cmd/usb/audio/mkfile - 664 sys sys 1091204980 349
 sys/src/cmd/usb/audio/usbaudio.c - 664 sys sys 1172764045 10358

+ 23 - 0
dist/replica/plan9.log

@@ -47609,3 +47609,26 @@
 1172809806 3 c 386/bin/auth/authsrv - 775 sys sys 1172808056 166692
 1172809806 4 c 386/bin/auth/guard.srv - 775 sys sys 1172808056 145120
 1172809806 5 c 386/bin/auth/secstored - 775 sys sys 1172808057 198043
+1172903406 0 c sys/src/cmd/usb/audio/audiofs.c - 664 sys sys 1172903208 18518
+1172957406 0 c sys/man/8/fs - 664 sys sys 1172956177 15086
+1172957406 1 c sys/man/8/fsconfig - 664 sys sys 1172956534 8878
+1172957406 2 c sys/src/ape/lib/ap/arm/memset.s - 664 sys sys 1172956011 1057
+1172957406 3 c sys/src/ape/lib/ap/arm/mkfile - 664 sys sys 1172955903 308
+1172957406 4 c sys/src/ape/lib/ap/arm/setjmp.s - 664 sys sys 1172955904 587
+1172957406 5 c sys/src/ape/lib/ap/arm/strchr.s - 664 sys sys 1172955904 841
+1172957406 6 a sys/src/ape/lib/ap/arm/strcmp.s - 664 sys sys 1172956230 1010
+1172957406 7 c sys/src/ape/lib/ap/arm/strcpy.s - 664 sys sys 1172955904 885
+1172957406 8 c sys/src/ape/lib/ap/arm/vlop.s - 664 sys sys 1172955903 262
+1172957406 9 c sys/src/cmd/kl/obj.c - 664 sys sys 1172957404 21751
+1172957406 10 c sys/src/cmd/ql/l.h - 664 sys sys 1172956269 5938
+1172957406 11 d sys/src/ape/lib/ap/arm/strlen.c - 664 sys sys 1014921992 0
+1172957406 12 d sys/src/ape/lib/ap/arm/strcat.c - 664 sys sys 1014921992 0
+1172957406 13 d sys/src/ape/lib/ap/arm/memcmp.c - 664 sys sys 1014921992 0
+1172957406 14 d sys/src/ape/lib/ap/arm/memchr.c - 664 sys sys 1014921992 0
+1172959206 0 c sys/src/cmd/ip/dhcpd/dhcpd.c - 664 sys sys 1172959216 33339
+1172959206 1 c sys/src/cmd/ip/dhcpd/ndb.c - 664 sys sys 1172959226 6235
+1172961006 0 c sys/games/lib/fortunes - 664 sys sys 1172959612 263699
+1172961006 1 c sys/man/1/cb - 664 sys sys 1172959600 786
+1172961006 2 c sys/man/2/lock - 664 sys sys 1172959628 4693
+1172961006 3 c sys/man/8/dhcpd - 664 sys sys 1172959497 5572
+1172982606 0 c 386/bin/ip/dhcpd - 775 sys sys 1172980949 151301

+ 2 - 0
sys/games/lib/fortunes

@@ -4167,3 +4167,5 @@ Linux is neither Unix nor Windows — it's the worst of both worlds -- jmk
 Did you ever try to write poetry in a committee meeting? It's like a bunch of fat construction guys trying to write an opera while sitting on the couch watching Baywatch. The more fat construction guys you add to the couch, the less likely you are to get opera out of it.  - Joel Spolsky
 Don't interrupt!  Let me finish! - Rae McLellan
 bool x = "false";  // valid C++ [sets x to true]
+# The below line not be changed otherwise we refuse to work
+having read AF_UNIX(7) i'm still don't see the point.  portable programs should not do this.  portable programs should not do that.  the details of this varies from implementation to implementation.  none of the following socket things ... are implemented.  the name is limited to 107 bytes.   - forsyth

+ 2 - 2
sys/man/1/cb

@@ -18,9 +18,9 @@ cb \- C program beautifier
 .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.
+with a more visually pleasing spacing and indentation.
 .I Cb
-understands no C++ syntax bar newline terminated comments;
+understands no C++ syntax bar newline-terminated comments;
 and by default all user new-lines are preserved in the output.
 .PP
 The options are:

+ 1 - 1
sys/man/2/lock

@@ -4,7 +4,7 @@ lock, canlock, unlock,
 qlock, canqlock, qunlock,
 rlock, canrlock, runlock,
 wlock, canwlock, wunlock,
-rsleep, rwakeup, rwakeupall
+rsleep, rwakeup, rwakeupall,
 incref, decref
 \- spin locks, queueing rendezvous locks, reader-writer locks, rendezvous points, and reference counts
 .SH SYNOPSIS

+ 21 - 15
sys/man/8/dhcpd

@@ -4,12 +4,14 @@ dhcpd, dhcpleases, rarpd, tftpd \- Internet booting
 .SH SYNOPSIS
 .PP
 .B ip/dhcpd
-.RB [ -mdsSnpr ]
+.RB [ -dmnprsSZ ]
 .RB [ -f
 .IR ndb-file ]
+.RB [ -M
+.IR secs ]
 .RB [ -x
 .IR netmtpt ]
-.RB [ -M
+.RB [ -Z
 .IR secs ]
 [
 .I address
@@ -165,23 +167,20 @@ The options are:
 .B d
 Print debugging to standard output.
 .TP
-.B m
-Mute: don't reply to requests, just log them and what
-.I dhcpd
-would have done.
-.TP
 .B f
 Specify a file other than
 .B /lib/ndb/local
 as the network database.
 .TP
-.B s
-Sleep 2 seconds before answering requests for static addresses.
-This is used to make a server
-be a backup only.
+.B m
+Mute: don't reply to requests, just log them and what
+.I dhcpd
+would have done.
 .TP
-.B S
-Sleep 2 seconds before answering requests for dynamic addresses.
+.B M
+Use
+.I secs
+as the minimum lease time for dynamic addresses.
 .TP
 .B n
 Don't answer
@@ -201,16 +200,23 @@ just log them and what
 .I dhcpd
 would have done.
 .TP
+.B s
+Sleep 2 seconds before answering requests for static addresses.
+This is used to make a server be a backup only.
+.TP
+.B S
+Sleep 2 seconds before answering requests for dynamic addresses.
+.TP
 .B x
 The IP stack to use is mounted at 
 .IR netmtpt .
 The default is
 .BR /net .
 .TP
-.B M
+.B Z
 Use
 .I secs
-as the minimum lease time.
+as the minimum lease time for static addresses.
 .PD
 .PP
 .I Dhcpleases

+ 5 - 1
sys/man/8/fs

@@ -93,7 +93,7 @@ fs, exsort \- file server maintenance
 .PP
 .B "sntp kick"
 .PP
-.BR stat [ adesw ]
+.BR stat [ admiesw ]
 .PP
 .B stats
 .RB [[ - ]
@@ -678,6 +678,10 @@ last character of the name:
 SCSI targets;
 .BR e ,
 Ethernet controllers;
+.BR i ,
+IDE/ATA targets;
+.BR m ,
+Marvell SATA targets;
 .BR w ,
 cached WORM.
 The

+ 22 - 1
sys/man/8/fsconfig

@@ -127,6 +127,26 @@ is equivalent to
 .B h1.0.0
 (second IDE controller, master drive).
 .TP
+.BI m n1 . n2 . n3
+.I M
+is similar to
+.IR h ,
+but for SATA drives connected to Marvell 
+88SX[56]0[48][01] controllers.
+There is no need to specify the controllers in 
+.B plan9.ini
+as they are autodiscovered.
+Hot-swapping drives is not currently supported.
+Similar target naming rules apply as for IDE controllers.
+However the controller-number is multiplied by the number of 
+drives the controller supports rather than 2.
+Thus
+.B m9
+is equivalent to
+.B m1.1.0
+(second controller, second drive),
+if the first controller supports 8 drives.
+.TP
 .BI l n1 . n2 . n3
 .TP
 .BI r n1 . n2 . n3
@@ -167,7 +187,8 @@ One might think of this as RAID 1,
 and
 .B [
 .B ]
-as RAID 0.
+as RAID 0,
+though neither includes any fancy recovery mechanisms.
 Each block is written to all the devices,
 starting with the rightmost in the list and working leftward.
 A block is read from the first device that provides it without error,

+ 0 - 15
sys/src/ape/lib/ap/arm/memchr.c

@@ -1,15 +0,0 @@
-#include	<string.h>
-
-void*
-memchr(const void *ap, int c, size_t n)
-{
-	char *sp;
-
-	sp = ap;
-	while(n > 0) {
-		if(*sp++ == c)
-			return sp-1;
-		n--;
-	}
-	return 0;
-}

+ 0 - 22
sys/src/ape/lib/ap/arm/memcmp.c

@@ -1,22 +0,0 @@
-#include	<string.h>
-
-int
-memcmp(const void *a1, const void *a2, size_t n)
-{
-	char *s1, *s2;
-	unsigned c1, c2;
-
-	s1 = a1;
-	s2 = a2;
-	while(n > 0) {
-		c1 = *s1++;
-		c2 = *s2++;
-		if(c1 != c2) {
-			if(c1 > c2)
-				return 1;
-			return -1;
-		}
-		n--;
-	}
-	return 0;
-}

+ 3 - 5
sys/src/ape/lib/ap/arm/memset.s

@@ -13,11 +13,9 @@ TEXT memset(SB), $0
 	CMP	$4, R(N)		/* need at least 4 bytes to copy */
 	BLT	_1tail
 
-	AND	$0xFF, R(4)		/* it's a byte */
-	SLL	$8, R(4), R(TMP)	/* replicate to a word */
-	ORR	R(TMP), R(4)
-	SLL	$16, R(4), R(TMP)
-	ORR	R(TMP), R(4)
+	AND	$0xFF, R(4)
+	ORR	R(4)<<8, R(4)
+	ORR	R(4)<<16, R(4)		/* replicate to word */
 
 _4align:				/* align on 4 */
 	AND.S	$3, R(TO), R(TMP)

+ 1 - 4
sys/src/ape/lib/ap/arm/mkfile

@@ -7,16 +7,13 @@ OFILES=\
 	lock.$O\
 	main9.$O\
 	main9p.$O\
-	memchr.$O\
-	memcmp.$O\
 	memmove.$O\
 	memset.$O\
 	notetramp.$O\
 	setjmp.$O\
-	strcat.$O\
 	strchr.$O\
+	strcmp.$O\
 	strcpy.$O\
-	strlen.$O\
 	tas.$O\
 	vlop.$O\
 	vlrt.$O\

+ 1 - 1
sys/src/ape/lib/ap/arm/setjmp.s

@@ -5,7 +5,7 @@ sp=13
 TEXT	setjmp(SB), 1, $-4
 	MOVW	R(sp), (R(arg+0))
 	MOVW	R(link), 4(R(arg+0))
-	MOVW	$0, R1
+	MOVW	$0, R0
 	RET
 
 TEXT	sigsetjmp(SB), 1, $-4

+ 0 - 9
sys/src/ape/lib/ap/arm/strcat.c

@@ -1,9 +0,0 @@
-#include <string.h>
-
-char*
-strcat(char *s1, const char *s2)
-{
-
-	strcpy(strchr(s1, 0), s2);
-	return s1;
-}

+ 6 - 2
sys/src/ape/lib/ap/arm/strchr.s

@@ -30,13 +30,17 @@ _aligned:
 _loop:
 	MOVW.P	4(R0), R4		/* 4 at a time */
 	TST	R4, R3			/* AND.S R2, R3, Rx */
+	TST.NE	R4>>8, R3
+	TST.NE	R4>>16, R3
+	TST.NE	R4>>24, R3
+	BNE	_loop
+
+	TST	R4, R3			/* its somewhere, find it and correct */
 	BEQ	_sub4
 	TST	R4>>8, R3
 	BEQ	_sub3
 	TST	R4>>16, R3
 	BEQ	_sub2
-	TST	R4>>24, R3
-	BNE	_loop
 
 _sub1:					/* compensate for pointer increment */
 	SUB	$1, R0

+ 67 - 0
sys/src/ape/lib/ap/arm/strcmp.s

@@ -0,0 +1,67 @@
+TEXT strcmp(SB), $-4
+	MOVW	R0, R1
+	MOVW	s2+4(FP), R2
+
+	MOVW	$0xFF, R3		/* mask */
+
+_align:					/* align s1 on 4 */
+	TST	$3, R1
+	BEQ	_aligned
+
+	MOVBU.P	1(R1), R4		/* implicit write back */
+	MOVBU.P	1(R2), R8		/* implicit write back */
+	SUB.S	R8, R4, R0
+	BNE	_return
+	CMP	$0, R4
+	BEQ	_return
+	B	_align
+
+_aligned:				/* is s2 now aligned? */
+	TST	$3, R2
+	BNE	_unaligned
+
+_aloop:
+	MOVW.P	4(R1), R5		/* 4 at a time */
+	MOVW.P	4(R2), R9
+
+	AND	R5, R3, R4
+	AND	R9, R3, R8
+	SUB.S	R8, R4, R0
+	BNE	_return
+	CMP	$0, R4
+	BEQ	_return
+
+	AND	R5>>8, R3, R4
+	AND	R9>>8, R3, R8
+	SUB.S	R8, R4, R0
+	BNE	_return
+	CMP	$0, R4
+	BEQ	_return
+
+	AND	R5>>16, R3, R4
+	AND	R9>>16, R3, R8
+	SUB.S	R8, R4, R0
+	BNE	_return
+	CMP	$0, R4
+	BEQ	_return
+
+	AND	R5>>24, R3, R4
+	AND	R9>>24, R3, R8
+	SUB.S	R8, R4, R0
+	BNE	_return
+	CMP	$0, R4
+	BEQ	_return
+
+	B	_aloop
+
+_return:
+	RET
+
+_unaligned:
+	MOVBU.P	1(R1), R4		/* implicit write back */
+	MOVBU.P	1(R2), R8		/* implicit write back */
+	SUB.S	R8, R4, R0
+	BNE	_return
+	CMP	$0, R4
+	BEQ	_return
+	B	_unaligned

+ 20 - 36
sys/src/ape/lib/ap/arm/strcpy.s

@@ -1,62 +1,46 @@
 TEXT strcpy(SB), $-4
 	MOVW		R0, to+0(FP)	/* need to save for return value */
 	MOVW		from+4(FP), R1
-
 	MOVW		$0xFF, R2	/* mask */
 
-_align:					/* align source on 4 */
+salign:					/* align source on 4 */
 	AND.S		$3, R1, R3
-	BEQ		_aligned
-
+	BEQ		dalign
 	MOVBU.P		1(R1), R3	/* implicit write back */
 	TST		R3, R2
 	MOVBU.P		R3, 1(R0)	/* implicit write back */
-	BEQ		_return
-	B		_align
+	BNE		salign
+	B		return
 
-_aligned:				/* is destination now aligned? */
+dalign:				/* is destination now aligned? */
 	AND.S		$3, R0, R3
-	BNE		_unaligned
+	BNE		uloop
 
-_aloop:
-	MOVW.P		4(R1), R4	/* 4 at a time */
+aloop:
+	MOVW.P		4(R1), R4	/* read 4, write 4 */
 	TST		R4, R2		/* AND.S R3, R2, Rx */
 	TST.NE		R4>>8, R2
 	TST.NE		R4>>16, R2
 	TST.NE		R4>>24, R2
-	BEQ		_tail
-
+	BEQ		tail
 	MOVW.P		R4, 4(R0)
-	B		_aloop
-
-_tail:
-	AND.S		R4, R2, R3
-	MOVBU.P		R3, 1(R0)	/* implicit write back */
-	BEQ		_return
-	AND.S		R4>>8, R2, R3
-	MOVBU.P		R3, 1(R0)	/* implicit write back */
-	BEQ		_return
-	AND.S		R4>>16, R2, R3
-	MOVBU.P		R3, 1(R0)	/* implicit write back */
-	BEQ		_return
-	AND.S		R4>>24, R2, R3
-	MOVBU.P		R3, 1(R0)	/* implicit write back */
+	B		aloop
 
-_return:
-	MOVW		to+0(FP), R0
-	RET
-
-_unaligned:
-	MOVW.P		4(R1), R4	/* 4 at a time */
+uloop:
+	MOVW.P		4(R1), R4	/* read 4, write 1,1,1,1 */
 
+tail:
 	AND.S		R4, R2, R3
-	MOVBU.P		R3, 1(R0)
+	MOVBU.NE.P	R3, 1(R0)
 	AND.NE.S	R4>>8, R2, R3
 	MOVBU.NE.P	R3, 1(R0)
 	AND.NE.S	R4>>16, R2, R3
 	MOVBU.NE.P	R3, 1(R0)
 	AND.NE.S	R4>>24, R2, R3
-	MOVBU.NE.P	R3, 1(R0)
-	BEQ		_return
+	MOVBU.P		R3, 1(R0)
+	BNE		uloop
+	B		return
 
-	B		_unaligned
+return:
+	MOVW		to+0(FP), R0
+	RET

+ 0 - 8
sys/src/ape/lib/ap/arm/strlen.c

@@ -1,8 +0,0 @@
-#include <string.h>
-
-size_t
-strlen(const char *s)
-{
-
-	return strchr(s, 0) - s;
-}

+ 11 - 16
sys/src/ape/lib/ap/arm/vlop.s

@@ -1,18 +1,13 @@
-#define	UMULL(Rs,Rm,Rhi,Rlo,S)	WORD	$((14<<28)|(4<<21)|(S<<20)|(Rhi<<16)|(Rlo<<12)|(Rs<<8)|(9<<4)|Rm)
-#define UMLAL(Rs,Rm,Rhi,Rlo,S)	WORD	$((14<<28)|(5<<21)|(S<<20)|(Rhi<<16)|(Rlo<<12)|(Rs<<8)|(9<<4)|Rm)
-#define	MUL(Rs,Rm,Rd,S)	WORD	$((14<<28)|(0<<21)|(S<<20)|(Rd<<16)|(Rs<<8)|(9<<4)|Rm)
-arg=0
-
 TEXT	_mulv(SB), $0
-	MOVW	8(FP), R9	/* l0 */
-	MOVW	4(FP), R10	/* h0 */
-	MOVW	16(FP), R4	/* l1 */
-	MOVW	12(FP), R5	/* h1 */
-	UMULL(4, 9, 7, 6, 0)
-	MUL(10, 4, 8, 0)
-	ADD	R8, R7
-	MUL(9, 5, 8, 0)
-	ADD	R8, R7
-	MOVW	R6, 4(R(arg))
-	MOVW	R7, 0(R(arg))
+	MOVW	4(FP),R9	/* l0 */
+	MOVW	8(FP),R10	/* h0 */
+	MOVW	12(FP),R4	/* l1 */
+	MOVW	16(FP),R5	/* h1 */
+	MULLU	R9,R4,(R6, R7)	/* l0*l1 */
+	MUL	R9,R5,R5	/* l0*h1 */
+	MUL	R10,R4,R4	/* h0*l1 */
+	ADD	R4,R6
+	ADD	R5,R6
+	MOVW	R6,4(R0)
+	MOVW	R7,0(R0)
 	RET

+ 49 - 48
sys/src/cmd/ip/dhcpd/dhcpd.c

@@ -5,9 +5,9 @@
 #include <ndb.h>
 #include "dat.h"
 
-//
-//	ala rfc2131
-//
+/*
+ *	ala rfc2131
+ */
 
 typedef struct Req Req;
 struct Req
@@ -24,8 +24,8 @@ struct Req
 	uchar	giaddr[IPaddrlen];
 
 	/* parsed options */
-	int	p9request;		/* true if this is a bootp with plan9 options */
-	int	genrequest;		/* true if this is a bootp with generic options */
+	int	p9request;		/* flag: this is a bootp with plan9 options */
+	int	genrequest;		/* flag: this is a bootp with generic options */
 	int	dhcptype;		/* dhcp message type */
 	int	leasetime;		/* dhcp lease */
 	uchar	ip[IPaddrlen];		/* requested address */
@@ -45,6 +45,7 @@ struct Req
 };
 
 #define TFTP "/lib/tftpd"
+
 char	*blog = "ipboot";
 char	mysysname[64];
 Ipifc	*ipifcs;
@@ -54,9 +55,10 @@ long	now;
 int	slowstat, slowdyn;
 char	net[256];
 
-int	pptponly;	// only answer request that came from the pptp server
+int	pptponly;	/* only answer request that came from the pptp server */
 int	mute, mutestat;
 int	minlease = MinLease;
+int	staticlease = StaticLease;
 
 ulong	start;
 
@@ -162,6 +164,8 @@ void	byteopt(Req*, int, uchar);
 void	dhcp(Req*);
 void	fatal(int, char*, ...);
 void	hexopt(Req*, int, char*);
+void	logdhcp(Req*);
+void	logdhcpout(Req *, char *);
 void	longopt(Req*, int, long);
 void	maskopt(Req*, int, uchar*);
 void	miscoptions(Req*, uchar*);
@@ -173,6 +177,7 @@ void	rcvdiscover(Req*);
 void	rcvinform(Req*);
 void	rcvrelease(Req*);
 void	rcvrequest(Req*);
+int	readlast(int, uchar*, int);
 char*	readsysname(void);
 void	remrequested(Req*, int);
 void	sendack(Req*, uchar*, int, int);
@@ -183,9 +188,6 @@ void	termopt(Req*);
 int	validip(uchar*);
 void	vectoropt(Req*, int, uchar*, int);
 void	warning(int, char*, ...);
-void	logdhcp(Req*);
-void	logdhcpout(Req *, char *);
-int	readlast(int, uchar*, int);
 
 void
 timestamp(char *tag)
@@ -199,7 +201,8 @@ timestamp(char *tag)
 void
 usage(void)
 {
-	fprint(2, "usage: dhcp [-dmsnp] [-f directory] [-x netmtpt] [-M minlease] addr n [addr n ...]\n");
+	fprint(2, "usage: dhcp [-dmnprsSZ] [-f directory] [-M minlease] "
+		"[-x netmtpt] [-Z staticlease] addr n [addr n] ...\n");
 	exits("usage");
 }
 
@@ -207,34 +210,29 @@ void
 main(int argc, char **argv)
 {
 	int i, n, fd;
-	char *p;
 	uchar ip[IPaddrlen];
 	Req r;
 
-	setnetmtpt(net, sizeof(net), nil);
+	setnetmtpt(net, sizeof net, nil);
 
 	fmtinstall('E', eipfmt);
 	fmtinstall('I', eipfmt);
 	fmtinstall('V', eipfmt);
 	fmtinstall('M', eipfmt);
 	ARGBEGIN {
-	case 'm':
-		mute = 1;
-		break;
 	case 'd':
 		debug = 1;
 		break;
 	case 'f':
-		p = ARGF();
-		if(p == nil)
-			usage();
-		ndbfile = p;
+		ndbfile = EARGF(usage());
 		break;
-	case 's':
-		slowstat = 1;
+	case 'm':
+		mute = 1;
 		break;
-	case 'S':
-		slowdyn = 1;
+	case 'M':
+		minlease = atoi(EARGF(usage()));
+		if(minlease <= 0)
+			minlease = MinLease;
 		break;
 	case 'n':
 		nobootp = 1;
@@ -245,19 +243,22 @@ main(int argc, char **argv)
 	case 'r':
 		mutestat = 1;
 		break;
+	case 's':
+		slowstat = 1;
+		break;
+	case 'S':
+		slowdyn = 1;
+		break;
 	case 'x':
-		p = ARGF();
-		if(p == nil)
-			usage();
-		setnetmtpt(net, sizeof(net), p);
+		setnetmtpt(net, sizeof net, EARGF(usage()));
 		break;
-	case 'M':
-		p = ARGF();
-		if(p == nil)
-			usage();
-		minlease = atoi(p);
-		if(minlease <= 0)
-			minlease = MinLease;
+	case 'Z':
+		staticlease = atoi(EARGF(usage()));
+		if(staticlease <= 0)
+			staticlease = StaticLease;
+		break;
+	default:
+		usage();
 		break;
 	} ARGEND;
 
@@ -279,8 +280,7 @@ main(int argc, char **argv)
 			optname[i] = smprint("%d", i);
 
 	/* what is my name? */
-	p = readsysname();
-	strcpy(mysysname, p);
+	strcpy(mysysname, readsysname());
 
 	/* put process in background */
 	if(!debug) switch(rfork(RFNOTEG|RFPROC|RFFDG)) {
@@ -428,7 +428,7 @@ rcvdiscover(Req *rp)
 	Binding *b, *nb;
 
 	if(rp->staticbinding){
-		sendoffer(rp, rp->ii.ipaddr, (StaticLease > minlease ? StaticLease : minlease));
+		sendoffer(rp, rp->ii.ipaddr, (staticlease > minlease? staticlease: minlease));
 		return;
 	}
 
@@ -486,7 +486,7 @@ rcvrequest(Req *rp)
 		/* check for hard assignment */
 		if(rp->staticbinding){
 			if(forme(rp->server))
-				sendack(rp, rp->ii.ipaddr, (StaticLease > minlease ? StaticLease : minlease), 1);
+				sendack(rp, rp->ii.ipaddr, (staticlease > minlease? staticlease: minlease), 1);
 			else
 				warning(0, "!Request(%s via %I): for server %I not me",
 					rp->id, rp->gii.ipaddr, rp->server);
@@ -543,7 +543,7 @@ rcvrequest(Req *rp)
 					rp->id, rp->gii.ipaddr, rp->ip, rp->bp->chaddr);
 				sendnak(rp, "not valid");
 			}
-			sendack(rp, rp->ii.ipaddr, (StaticLease > minlease ? StaticLease : minlease), 1);
+			sendack(rp, rp->ii.ipaddr, (staticlease > minlease? staticlease: minlease), 1);
 			return;
 		}
 
@@ -585,7 +585,7 @@ rcvrequest(Req *rp)
 					rp->id, rp->gii.ipaddr, rp->ciaddr);
 				sendnak(rp, "not valid");
 			}
-			sendack(rp, rp->ii.ipaddr, (StaticLease > minlease ? StaticLease : minlease), 1);
+			sendack(rp, rp->ii.ipaddr, (staticlease > minlease? staticlease: minlease), 1);
 			return;
 		}
 
@@ -887,7 +887,7 @@ bootp(Req *rp)
 	Info *iip;
 
 	warning(0, "bootp %s %I->%I from %s via %I, file %s",
-		rp->genrequest ? "generic" : (rp->p9request ? "p9" : ""),
+		rp->genrequest? "generic": (rp->p9request? "p9": ""),
 		rp->up->raddr, rp->up->laddr,
 		rp->id, rp->gii.ipaddr,
 		rp->bp->file);
@@ -1131,8 +1131,10 @@ miscoptions(Req *rp, uchar *ip)
 		addropt(rp, OBrouter, rp->giaddr);
 	}
 
-	// OBhostname for the HP4000M switches
-	// (this causes NT to log infinite errors - tough shit )
+	/*
+	 * OBhostname for the HP4000M switches
+	 * (this causes NT to log infinite errors - tough shit)
+	 */
 	if(*rp->ii.domain){
 		remrequested(rp, OBhostname);
 		stringopt(rp, OBhostname, rp->ii.domain);
@@ -1236,10 +1238,10 @@ miscoptions(Req *rp, uchar *ip)
 			break;
 		}
 
-	// add plan9 specific options
+	/* add plan9 specific options */
 	if(strncmp((char*)rp->vendorclass, "plan9_", 6) == 0
 	|| strncmp((char*)rp->vendorclass, "p9-", 3) == 0){
-		// point to temporary area
+	/* point to temporary area */
 		op = rp->p;
 		omax = rp->max;
 		rp->p = vopts;
@@ -1250,7 +1252,7 @@ miscoptions(Req *rp, uchar *ip)
 		j = lookupserver("auth", addrs, t);
 		addrsopt(rp, OP9auth, addrs, j);
 
-		// point back
+	/* point back */
 		j = rp->p - vopts;
 		rp->p = op;
 		rp->max = omax;
@@ -1264,8 +1266,7 @@ int
 openlisten(char *net)
 {
 	int fd, cfd;
-	char data[128];
-	char devdir[40];
+	char data[128], devdir[40];
 
 	sprint(data, "%s/udp!*!bootp", net);
 	cfd = announce(data, devdir);

+ 5 - 0
sys/src/cmd/ip/dhcpd/ndb.c

@@ -127,6 +127,11 @@ lookupip(uchar *ipaddr, Info *iip, int gate)
 			setipaddr(iip->gwip, nt->val);
 		else
 		if(strcmp(nt->attr, "ether") == 0){
+			/*
+			 * this is probably wrong for machines with multiple
+			 * ethers.  bootp or dhcp requests could come from any
+			 * of the ethers listed in the ndb entry.
+			 */
 			if(memcmp(iip->etheraddr, noetheraddr, 6) == 0)
 				parseether(iip->etheraddr, nt->val);
 			iip->indb = 1;

+ 10 - 3
sys/src/cmd/kl/obj.c

@@ -979,16 +979,23 @@ void
 gethunk(void)
 {
 	char *h;
+	long nh;
 
-	h = mysbrk((int)NHUNK);
+	nh = NHUNK;
+	if(tothunk >= 5L*NHUNK) {
+		nh = 5L*NHUNK;
+		if(tothunk >= 25L*NHUNK)
+			nh = 25L*NHUNK;
+	}
+	h = mysbrk(nh);
 	if(h == (char *)-1) {
 		diag("out of memory");
 		errorexit();
 	}
 
 	hunk = h;
-	nhunk = NHUNK;
-	tothunk += NHUNK;
+	nhunk = nh;
+	tothunk += nh;
 }
 
 void

+ 2 - 2
sys/src/cmd/ql/l.h

@@ -50,7 +50,7 @@ struct	Prog
 	short	line;
 	short	mark;
 	short	optab;		/* could be uchar */
-	uchar	as;
+	ushort	as;
 	char	reg;
 };
 struct	Sym
@@ -75,7 +75,7 @@ struct	Autom
 };
 struct	Optab
 {
-	uchar	as;
+	ushort	as;
 	char	a1;
 	char	a2;
 	char	a3;

+ 143 - 99
sys/src/cmd/usb/audio/audiofs.c

@@ -14,7 +14,7 @@ int attachok;
 
 enum
 {
-	OPERM	= 0x3,		// mask of all permission types in open mode
+	OPERM	= 0x3,	/* mask of all permission types in open mode */
 };
 
 typedef struct Fid Fid;
@@ -23,41 +23,41 @@ typedef struct Worker Worker;
 
 struct Audioctldata
 {
-	long		offoff;			// offset of the offset for audioctl
-	long		values[2][Ncontrol][8];	// last values transmitted
-	char	*	s;
-	int		ns;
+	long	offoff;			/* offset of the offset for audioctl */
+	long	values[2][Ncontrol][8];	/* last values transmitted */
+	char	*s;
+	int	ns;
 };
 
 enum {
 	Busy =	0x01,
 	Open =	0x02,
-	Eof =		0x04,
+	Eof =	0x04,
 };
 
 struct Fid
 {
 	QLock;
-	int		fid;
-	Dir	*	dir;
+	int	fid;
+	Dir	*dir;
 	ushort	flags;
 	short	readers;
-	void	*	fiddata;		// file specific per-fid data (used for audioctl)
-	Fid	*	next;
+	void	*fiddata;  /* file specific per-fid data (used for audioctl) */
+	Fid	*next;
 };
 
 struct Worker
 {
-	Fid		*fid;
+	Fid	*fid;
 	ushort	tag;
-	Fcall		*rhdr;
-	Dir		*dir;
+	Fcall	*rhdr;
+	Dir	*dir;
 	Channel	*eventc;
 	Worker	*next;
 };
 
 enum {
-	// Event channel messages for worker
+	/* Event channel messages for worker */
 	Work =	0x01,
 	Check =	0x02,
 	Flush =	0x03,
@@ -75,12 +75,12 @@ enum {
 
 Dir dirs[] = {
 	/* Note: Qaudio{in} used as mount point for /dev/usb/%d/ep%ddata only */
-[Qdir] =		{0,0,{Qdir, 0,QTDIR},0555|DMDIR,0,0,0,	".",		nil,nil,nil},
-[Qvolume] =	{0,0,{Qvolume, 0,QTFILE},0666,0,0,0,	"volume",	nil,nil,nil},
+[Qdir] =	{0,0,{Qdir,      0,QTDIR},0555|DMDIR,0,0,0, ".",  nil,nil,nil},
+[Qvolume] =	{0,0,{Qvolume,   0,QTFILE},0666,0,0,0,	"volume", nil,nil,nil},
 [Qaudioctl] =	{0,0,{Qaudioctl, 0,QTFILE},0666,0,0,0,	"audioctl",nil,nil,nil},
-[Qaudiostat] =	{0,0,{Qaudiostat, 0,QTFILE},0666,0,0,0,	"audiostat",nil,nil,nil},
-[Qaudio] =	{0,0,{Qaudio, 0,QTFILE},0222,0,0,0,		"audio",	nil,nil,nil},
-[Qaudioin] =	{0,0,{Qaudioin, 0,QTFILE},0444,0,0,0,	"audioin",	nil,nil,nil},
+[Qaudiostat] =	{0,0,{Qaudiostat,0,QTFILE},0666,0,0,0,	"audiostat",nil,nil,nil},
+[Qaudio] =	{0,0,{Qaudio,    0,QTFILE},0222,0,0,0, "audio",   nil,nil,nil},
+[Qaudioin] =	{0,0,{Qaudioin,  0,QTFILE},0444,0,0,0, "audioin", nil,nil,nil},
 };
 
 int	messagesize = 4*1024+IOHDRSZ;
@@ -115,30 +115,30 @@ char	*rflush(Fid*), *rauth(Fid*),
 	*rversion(Fid*);
 
 char 	*(*fcalls[])(Fid*) = {
-	[Tflush]		rflush,
-	[Tversion]		rversion,
+	[Tflush]	rflush,
+	[Tversion]	rversion,
 	[Tauth]		rauth,
-	[Tattach]		rattach,
+	[Tattach]	rattach,
 	[Twalk]		rwalk,
 	[Topen]		ropen,
-	[Tcreate]		rcreate,
+	[Tcreate]	rcreate,
 	[Tread]		rread,
-	[Twrite]		rwrite,
-	[Tclunk]		rclunk,
+	[Twrite]	rwrite,
+	[Tclunk]	rclunk,
 	[Tremove]	rremove,
 	[Tstat]		rstat,
-	[Twstat]		rwstat,
+	[Twstat]	rwstat,
 };
 
-char	Eperm[] =		"permission denied";
+char	Eperm[] =	"permission denied";
 char	Enotdir[] =	"not a directory";
 char	Enoauth[] =	"no authentication in ramfs";
 char	Enotexist[] =	"file does not exist";
-char	Einuse[] =		"file in use";
-char	Eexist[] =		"file exists";
+char	Einuse[] =	"file in use";
+char	Eexist[] =	"file exists";
 char	Enotowner[] =	"not owner";
 char	Eisopen[] = 	"file already open for I/O";
-char	Excl[] = 		"exclusive use file already open";
+char	Excl[] = 	"exclusive use file already open";
 char	Ename[] = 	"illegal name";
 char	Ebadctl[] =	"unknown control message";
 
@@ -206,13 +206,15 @@ serve(void *)
 	if(mount(p[1], -1, mntpt, MBEFORE, "") < 0)
 		sysfatal("mount failed");
 	if (endpt[Play] >= 0){
-		sprint(epdata, "#U/usb%d/%d/ep%ddata", ad->ctlrno, ad->id, endpt[Play]);
+		sprint(epdata, "#U/usb%d/%d/ep%ddata", ad->ctlrno, ad->id,
+			 endpt[Play]);
 		sprint(audiofile, "%s/audio", mntpt);
 		if(bind(epdata, audiofile, MREPL) < 0)
 			sysfatal("bind failed");
 	}
 	if (endpt[Record] >= 0){
-		sprint(epdata, "#U/usb%d/%d/ep%ddata", ad->ctlrno, ad->id, endpt[Record]);
+		sprint(epdata, "#U/usb%d/%d/ep%ddata", ad->ctlrno, ad->id,
+			endpt[Record]);
 		sprint(audiofile, "%s/audioin", mntpt);
 		if(bind(epdata, audiofile, MREPL) < 0)
 			sysfatal("bind failed");
@@ -376,7 +378,7 @@ allocaudioctldata(void)
 	for (i = 0; i < 2; i++)
 		for(j=0; j < Ncontrol; j++)
 			for(k=0; k < 8; k++)
-			a->values[i][j][k] = Undef;
+				a->values[i][j][k] = Undef;
 	return a;
 }
 
@@ -431,44 +433,50 @@ readtopdir(Fid*, uchar *buf, long off, int cnt, int blen)
 	return n;
 }
 
+enum { Chunk = 1024, };
+
 int
 makeaudioctldata(Fid *f)
 {
-	int rec, ctl, i, different;
+	int rec, ctl, i, diff;
+	long *actls;		/* 8 of them */
 	char *p, *e;
 	Audiocontrol *c;
 	Audioctldata *a;
 
 	if ((a = f->fiddata) == nil)
 		sysfatal("fiddata");
-	if ((p = a->s) == nil){
-		p = emalloc(1024);
-		a->s = p;
-	}
-	e = p + 1024;
+	if ((p = a->s) == nil)
+		a->s = p = emalloc(Chunk);
+	e = p + Chunk - 1;	/* e must point *at* last byte, not *after* */
 	for (rec = 0; rec < 2; rec++)
 		for (ctl = 0; ctl < Ncontrol; ctl++) {
 			c = &controls[rec][ctl];
-			different = 0;
+			actls = a->values[rec][ctl];
+			diff = 0;
 			if (c->chans){
 				for (i = 1; i < 8; i++)
-					if ((c->chans & 1<<i) && c->value[i] != a->values[rec][ctl][i])
-						different = 1;
+					if ((c->chans & 1<<i) &&
+					    c->value[i] != actls[i])
+						diff = 1;
 			}else
-				if (c->value[0] != a->values[rec][ctl][0])
-					different = 1;
-			if (different){
-				p = seprint(p, e, "%s %s %A", c->name, rec?"in":"out", c);
-				memmove(a->values[rec][ctl], c->value, sizeof c->value);
+				if (c->value[0] != actls[0])
+					diff = 1;
+			if (diff){
+				p = seprint(p, e, "%s %s %A", c->name,
+					rec? "in": "out", c);
+				memmove(actls, c->value, sizeof c->value);
 				if (c->min != Undef){
-					p = seprint(p, e, " %ld %ld", c->min, c->max);
+					p = seprint(p, e, " %ld %ld", c->min,
+						c->max);
 					if (c->step != Undef)
-						p = seprint(p, e, " %ld", c->step);
+						p = seprint(p, e, " %ld",
+							c->step);
 				}
 				p = seprint(p, e, "\n");
 			}
 		}
-	assert(strlen(a->s) < 1024);
+	assert(strlen(a->s) < Chunk);
 	a->ns = p - a->s;
 	return a->ns;
 }
@@ -476,14 +484,14 @@ makeaudioctldata(Fid *f)
 void
 readproc(void *x)
 {
-	Fcall *rhdr;
+	int n, cnt;
+	ulong event;
+	vlong off;
+	uchar *mdata;
 	Audioctldata *a;
+	Fcall *rhdr;
 	Fid *f;
-	uchar *mdata;
-	int n, cnt;
-	long off;
 	Worker *w;
-	ulong event;
 
 	w = x;
 	mdata = emalloc(8*1024+IOHDRSZ);
@@ -502,7 +510,8 @@ readproc(void *x)
 			event = recvul(w->eventc);
 			qlock(f);
 			if (debug & Dbgproc)
-				fprint(2, "readproc unblocked fid %d %lld\n", f->fid, f->dir->qid.path);
+				fprint(2, "readproc unblocked fid %d %lld\n",
+					f->fid, f->dir->qid.path);
 			switch (event & 0xffff) {
 			case Work:
 				sysfatal("readproc phase error");
@@ -513,7 +522,8 @@ readproc(void *x)
 			case Flush:
 				if ((event >> 16) == rhdr->tag) {
 					if (debug & Dbgproc)
-						fprint(2, "readproc flushing fid %d, tag %d\n", f->fid, rhdr->tag);
+						fprint(2, "readproc flushing fid %d, tag %d\n",
+							f->fid, rhdr->tag);
 					goto flush;
 				}
 				continue;
@@ -549,13 +559,13 @@ flush:
 char*
 rread(Fid *f)
 {
-	long off;
 	int i, n, cnt, rec;
+	vlong off;
 	char *p;
-	static char buf[1024];
 	Audiocontrol *c;
 	Audioctldata *a;
 	Worker *w;
+	static char buf[1024];
 
 	rhdr.count = 0;
 	off = thdr.offset;
@@ -578,26 +588,37 @@ rread(Fid *f)
 		for (rec = 0; rec < 2; rec++){
 			c = &controls[rec][Volume_control];
 			if (c->readable){
-				i = snprint(p, n, "audio %s %ld\n", rec?"in":"out", (c->min != Undef) ?
-					100*(c->value[0]-c->min)/(c->max-c->min) : c->value[0]);
-				p+=i; n-=i;
+				i = snprint(p, n, "audio %s %ld\n",
+					rec? "in": "out", (c->min != Undef?
+					100*(c->value[0]-c->min)/(c->max-c->min):
+					c->value[0]));
+				p += i;
+				n -= i;
 			}
 			c = &controls[rec][Treble_control];
 			if (c->readable){
-				i = snprint(p, n, "treb %s %ld\n", rec?"in":"out", (c->min != Undef) ?
-					100*(c->value[0]-c->min)/(c->max-c->min) : c->value[0]);
-				p+=i; n-=i;
+				i = snprint(p, n, "treb %s %ld\n",
+					rec? "in": "out", (c->min != Undef?
+					100*(c->value[0]-c->min)/(c->max-c->min):
+					c->value[0]));
+				p += i;
+				n -= i;
 			}
 			c = &controls[rec][Bass_control];
 			if (c->readable){
-				i = snprint(p, n, "bass %s %ld\n", rec?"in":"out", (c->min != Undef) ?
-					100*(c->value[0]-c->min)/(c->max-c->min) : c->value[0]);
-				p+=i; n-=i;
+				i = snprint(p, n, "bass %s %ld\n",
+					rec? "in": "out", (c->min != Undef?
+					100*(c->value[0]-c->min)/(c->max-c->min):
+					c->value[0]));
+				p += i;
+				n -= i;
 			}
 			c = &controls[rec][Speed_control];
 			if (c->readable){
-				i = snprint(p, n, "speed %s %ld\n", rec?"in":"out", c->value[0]);
-				p+=i; n-=i;
+				i = snprint(p, n, "speed %s %ld\n",
+					rec? "in": "out", c->value[0]);
+				p += i;
+				n -= i;
 			}
 		}
 		n = sizeof buf - n;
@@ -689,27 +710,32 @@ rwrite(Fid *f)
 		thdr.data[cnt] = '\0';
 		nlines = getfields(thdr.data, lines, 2*Ncontrol, 1, "\n");
 		for(i = 0; i < nlines; i++){
-			if (debug) fprint(2, "line: %s\n", lines[i]);
+			if (debug)
+				 fprint(2, "line: %s\n", lines[i]);
 			nf = tokenize(lines[i], fields, 4);
 			if (nf == 0)
 				continue;
-			if (nf == 3){
-				if (strcmp(fields[1], "in") == 0 || strcmp(fields[1], "record") == 0)
+			if (nf == 3)
+				if (strcmp(fields[1], "in") == 0 ||
+				    strcmp(fields[1], "record") == 0)
 					rec = 1;
-				else if (strcmp(fields[1], "out") == 0 || strcmp(fields[1], "playback") == 0)
+				else if (strcmp(fields[1], "out") == 0 ||
+				    strcmp(fields[1], "playback") == 0)
 					rec = 0;
 				else {
-					if (debug) fprint(2, "bad1\n");
+					if (debug)
+						fprint(2, "bad1\n");
 					return Ebadctl;
 				}
-			}else if (nf == 2)
+			else if (nf == 2)
 				rec = 0;
 			else {
-				if (debug) fprint(2, "bad2 %d\n", nf);
+				if (debug)
+					fprint(2, "bad2 %d\n", nf);
 				return Ebadctl;
 			}
 			c = nil;
-			if (strcmp(fields[0], "audio") == 0)	/* special case */
+			if (strcmp(fields[0], "audio") == 0) /* special case */
 				fields[0] = "volume";
 			for (ctl = 0; ctl < Ncontrol; ctl++){
 				c = &controls[rec][ctl];
@@ -717,38 +743,55 @@ rwrite(Fid *f)
 					break;
 			}
 			if (ctl == Ncontrol){
-				if (debug) fprint(2, "bad3\n");
+				if (debug)
+					fprint(2, "bad3\n");
 				return Ebadctl;
 			}
-			if (f->dir == &dirs[Qvolume] && ctl != Speed_control && c->min != Undef && c->max != Undef){
-				nnf = tokenize(fields[nf-1], subfields, nelem(subfields));
+			if (f->dir == &dirs[Qvolume] && ctl != Speed_control &&
+			    c->min != Undef && c->max != Undef){
+				nnf = tokenize(fields[nf-1], subfields,
+					nelem(subfields));
 				if (nnf <= 0 || nnf > 8){
-					if (debug) fprint(2, "bad4\n");
+					if (debug)
+						fprint(2, "bad4\n");
 					return Ebadctl;
 				}
 				p = buf;
 				for (i = 0; i < nnf; i++){
 					value = strtol(subfields[i], nil, 0);
-					value = ((100 - value) * c->min + value * c->max) / 100;
-					if (debug) {
+					value = ((100 - value)*c->min +
+						value*c->max) / 100;
+					if (debug)
 						if (p == buf)
 							fprint(2, "rwrite: %s %s '%ld",
-								c->name, rec?"record":"playback", value);
+								c->name, rec?
+								"record":
+								"playback",
+								value);
 						else
 							fprint(2, " %ld", value);
-					}
 					if (p == buf)
-						p = seprint(p, buf+sizeof buf, "0x%p %s %s '%ld",
-							replchan, c->name, rec?"record":"playback", value);
+						p = seprint(p, buf+sizeof buf,
+							"0x%p %s %s '%ld",
+							replchan, c->name, rec?
+							"record": "playback",
+							value);
 					else
-						p = seprint(p, buf+sizeof buf, " %ld", value);
+						p = seprint(p, buf+sizeof buf,
+							" %ld", value);
 				}
-				if (debug) fprint(2, "'\n");
-				seprint(p, buf+sizeof buf, "'");
+				if (debug)
+					fprint(2, "'\n");
+				seprint(p, buf+sizeof buf-1, "'");
 				chanprint(controlchan, buf);
 			} else {
-				if (debug) fprint(2, "rwrite: %s %s %q", c->name, rec?"record":"playback", fields[nf-1]);
-				chanprint(controlchan, "0x%p %s %s %q", replchan, c->name, rec?"record":"playback", fields[nf-1]);
+				if (debug)
+					fprint(2, "rwrite: %s %s %q", c->name,
+						rec? "record": "playback",
+						fields[nf-1]);
+				chanprint(controlchan, "0x%p %s %s %q",
+					replchan, c->name, rec? "record":
+					"playback", fields[nf-1]);
 			}
 			p = recvp(replchan);
 			if (p){
@@ -775,7 +818,7 @@ rclunk(Fid *f)
 
 	qlock(f);
 	f->flags &= ~(Open|Busy);
-	assert (f->readers ==0);
+	assert(f->readers ==0);
 	if (f->fiddata){
 		a = f->fiddata;
 		if (a->s)
@@ -799,9 +842,9 @@ rstat(Fid *f)
 	Audioctldata *a;
 
 	if (f->dir == &dirs[Qaudio] && endpt[Play] < 0)
-			return Enotexist;
+		return Enotexist;
 	if (f->dir == &dirs[Qaudioin] && endpt[Record] < 0)
-			return Enotexist;
+		return Enotexist;
 	if (f->dir == &dirs[Qaudioctl]){
 		qlock(f);
 		if (f->fiddata == nil)
@@ -830,9 +873,9 @@ newfid(int fid)
 
 	ff = nil;
 	for(f = fids; f; f = f->next)
-		if(f->fid == fid){
+		if(f->fid == fid)
 			return f;
-		}else if(ff == nil && (f->flags & Busy) == 0)
+		else if(ff == nil && (f->flags & Busy) == 0)
 			ff = f;
 	if(ff == nil){
 		ff = emallocz(sizeof *ff, 1);
@@ -870,7 +913,8 @@ io(void *)
 		if(n < 0){
 			rerrstr(e, sizeof e);
 			if (strcmp(e, "interrupted") == 0){
-				if (debug) fprint(2, "read9pmsg interrupted\n");
+				if (debug)
+					fprint(2, "read9pmsg interrupted\n");
 				continue;
 			}
 			return;