Browse Source

Plan 9 from Bell Labs 2008-02-14

David du Colombier 12 years ago
parent
commit
7d01326416

+ 14 - 16
dist/replica/_plan9.db

@@ -483,10 +483,10 @@
 386/bin/upas/unspam - 775 sys sys 1064598367 38
 386/bin/upas/vf - 775 sys sys 1181704900 97444
 386/bin/usb - 20000000775 sys sys 1019538890 0
-386/bin/usb/disk - 775 sys sys 1202272000 187347
-386/bin/usb/usbaudio - 775 sys sys 1202272003 188183
-386/bin/usb/usbd - 775 sys sys 1202272005 131144
-386/bin/usb/usbmouse - 775 sys sys 1202760908 128469
+386/bin/usb/disk - 775 sys sys 1202876959 188101
+386/bin/usb/usbaudio - 775 sys sys 1202876962 188937
+386/bin/usb/usbd - 775 sys sys 1202876965 132270
+386/bin/usb/usbmouse - 775 sys sys 1202876967 129429
 386/bin/usb/usbprint - 775 sys sys 1196537245 314
 386/bin/usb/usbprobe - 775 sys sys 1196537245 173
 386/bin/vac - 775 sys sys 1196742539 171330
@@ -506,7 +506,7 @@
 386/bin/venti/fmtisect - 775 sys sys 1196742587 246038
 386/bin/venti/mirrorarenas - 775 sys sys 1196742591 255146
 386/bin/venti/printarena - 775 sys sys 1196742596 257727
-386/bin/venti/rdarena - 775 sys sys 1196742600 247114
+386/bin/venti/rdarena - 775 sys sys 1202933749 247159
 386/bin/venti/read - 775 sys sys 1190716746 154800
 386/bin/venti/ro - 775 sys sys 1191273722 161694
 386/bin/venti/sync - 775 sys sys 1190716753 153672
@@ -5639,7 +5639,7 @@ rc/bin/umem - 775 sys sys 1190076661 547
 rc/bin/uncompress - 775 sys sys 1158798931 30
 rc/bin/ups - 775 sys sys 1091021981 806
 rc/bin/uptime - 775 sys sys 1074730712 234
-rc/bin/usbfat: - 775 sys sys 1202773132 818
+rc/bin/usbfat: - 775 sys sys 1202933070 827
 rc/bin/usbstart - 775 sys sys 1044894155 81
 rc/bin/usps - 775 sys sys 1016826030 450
 rc/bin/vwhois - 775 sys sys 1106409971 445
@@ -5842,7 +5842,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 1201296173 268188
+sys/games/lib/fortunes - 664 sys sys 1202950617 268681
 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
@@ -7691,6 +7691,7 @@ sys/man/3/floppy - 664 sys sys 1196638941 881
 sys/man/3/fs - 664 sys sys 1196638942 3159
 sys/man/3/i82365 - 664 sys sys 1196638942 884
 sys/man/3/ip - 664 sys sys 1196638942 26321
+sys/man/3/kbin - 664 sys sys 1202938916 654
 sys/man/3/kbmap - 664 sys sys 1196638942 1732
 sys/man/3/kprof - 664 sys sys 1196638942 1377
 sys/man/3/loopback - 664 sys sys 1196638942 1995
@@ -7752,7 +7753,7 @@ sys/man/4/tapefs - 664 sys sys 1196638944 1861
 sys/man/4/telco - 664 sys sys 1196638944 4359
 sys/man/4/u9fs - 664 sys sys 1196638944 4748
 sys/man/4/upasfs - 664 sys sys 1196638944 6212
-sys/man/4/usb - 664 sys sys 1196638944 4682
+sys/man/4/usb - 664 sys sys 1202938916 5689
 sys/man/4/usbd - 664 sys sys 1202846392 1035
 sys/man/4/usbdisk - 664 sys sys 1202847388 3041
 sys/man/4/vacfs - 664 sys sys 1196638944 1545
@@ -7889,7 +7890,7 @@ sys/man/8/trampoline - 664 sys sys 1196638948 1199
 sys/man/8/udpecho - 664 sys sys 1196638948 303
 sys/man/8/update - 664 sys sys 1196638948 2336
 sys/man/8/venti - 664 sys sys 1197570117 12190
-sys/man/8/venti-backup - 664 sys sys 1196638948 2102
+sys/man/8/venti-backup - 664 sys sys 1202925137 2290
 sys/man/8/venti-fmt - 664 sys sys 1196638948 8626
 sys/man/8/vga - 664 sys sys 1196638948 4129
 sys/man/fonts - 664 sys sys 1196638948 218
@@ -8085,6 +8086,7 @@ sys/src/9/pc/devarch.c - 664 sys sys 1194556823 19867
 sys/src/9/pc/devether.c - 664 sys sys 1196687022 10567
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devi82365.c - 664 sys sys 1146318335 20504
+sys/src/9/pc/devkbin.c - 664 sys sys 1202939391 1806
 sys/src/9/pc/devlm78.c - 664 sys sys 1128255048 6291
 sys/src/9/pc/devlml.c - 664 sys sys 1184470711 7597
 sys/src/9/pc/devlml.h - 664 sys sys 1184470164 3031
@@ -8134,7 +8136,7 @@ sys/src/9/pc/i8259.c - 664 sys sys 1131290399 4586
 sys/src/9/pc/init9.c - 664 sys sys 1040002518 94
 sys/src/9/pc/initcode.s - 664 sys sys 1015014519 282
 sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
-sys/src/9/pc/kbd.c - 664 sys sys 1191355133 12339
+sys/src/9/pc/kbd.c - 664 sys sys 1202939524 12721
 sys/src/9/pc/l.s - 664 sys sys 1196193040 29691
 sys/src/9/pc/main.c - 664 sys sys 1168306227 15337
 sys/src/9/pc/mem.h - 664 sys sys 1196193040 5308
@@ -8279,7 +8281,7 @@ sys/src/9/port/parse.c - 664 sys sys 1014931177 2026
 sys/src/9/port/pgrp.c - 664 sys sys 1138458260 4760
 sys/src/9/port/portclock.c - 664 sys sys 1189292530 4276
 sys/src/9/port/portdat.h - 664 sys sys 1155995676 22703
-sys/src/9/port/portfns.h - 664 sys sys 1178831066 11059
+sys/src/9/port/portfns.h - 664 sys sys 1202939287 11060
 sys/src/9/port/portmkfile - 664 sys sys 1184737233 2082
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
 sys/src/9/port/proc.c - 664 sys sys 1176658321 28742
@@ -14386,7 +14388,7 @@ sys/src/cmd/venti/srv/printarenapart.c - 664 sys sys 1178160304 3544
 sys/src/cmd/venti/srv/printarenas.c - 664 sys sys 1142736355 2074
 sys/src/cmd/venti/srv/printindex.c - 664 sys sys 1142736355 1746
 sys/src/cmd/venti/srv/printmap.c - 664 sys sys 1142736355 542
-sys/src/cmd/venti/srv/rdarena.c - 664 sys sys 1178161030 1637
+sys/src/cmd/venti/srv/rdarena.c - 664 sys sys 1202925159 1695
 sys/src/cmd/venti/srv/readifile.c - 664 sys sys 1177534667 411
 sys/src/cmd/venti/srv/reseal.c - 664 sys sys 1177189438 6682
 sys/src/cmd/venti/srv/round.c - 664 sys sys 1142736355 1577
@@ -15860,7 +15862,3 @@ 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/usb/disk - 775 sys sys 1202876959 188101
-386/bin/usb/usbaudio - 775 sys sys 1202876962 188937
-386/bin/usb/usbd - 775 sys sys 1202876965 132270
-386/bin/usb/usbmouse - 775 sys sys 1202876967 129429

+ 10 - 8
dist/replica/plan9.db

@@ -506,7 +506,7 @@
 386/bin/venti/fmtisect - 775 sys sys 1196742587 246038
 386/bin/venti/mirrorarenas - 775 sys sys 1196742591 255146
 386/bin/venti/printarena - 775 sys sys 1196742596 257727
-386/bin/venti/rdarena - 775 sys sys 1196742600 247114
+386/bin/venti/rdarena - 775 sys sys 1202933749 247159
 386/bin/venti/read - 775 sys sys 1190716746 154800
 386/bin/venti/ro - 775 sys sys 1191273722 161694
 386/bin/venti/sync - 775 sys sys 1190716753 153672
@@ -5639,7 +5639,7 @@ rc/bin/umem - 775 sys sys 1190076661 547
 rc/bin/uncompress - 775 sys sys 1158798931 30
 rc/bin/ups - 775 sys sys 1091021981 806
 rc/bin/uptime - 775 sys sys 1074730712 234
-rc/bin/usbfat: - 775 sys sys 1202773132 818
+rc/bin/usbfat: - 775 sys sys 1202933070 827
 rc/bin/usbstart - 775 sys sys 1044894155 81
 rc/bin/usps - 775 sys sys 1016826030 450
 rc/bin/vwhois - 775 sys sys 1106409971 445
@@ -5842,7 +5842,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 1201296173 268188
+sys/games/lib/fortunes - 664 sys sys 1202950617 268681
 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
@@ -7691,6 +7691,7 @@ sys/man/3/floppy - 664 sys sys 1196638941 881
 sys/man/3/fs - 664 sys sys 1196638942 3159
 sys/man/3/i82365 - 664 sys sys 1196638942 884
 sys/man/3/ip - 664 sys sys 1196638942 26321
+sys/man/3/kbin - 664 sys sys 1202938916 654
 sys/man/3/kbmap - 664 sys sys 1196638942 1732
 sys/man/3/kprof - 664 sys sys 1196638942 1377
 sys/man/3/loopback - 664 sys sys 1196638942 1995
@@ -7752,7 +7753,7 @@ sys/man/4/tapefs - 664 sys sys 1196638944 1861
 sys/man/4/telco - 664 sys sys 1196638944 4359
 sys/man/4/u9fs - 664 sys sys 1196638944 4748
 sys/man/4/upasfs - 664 sys sys 1196638944 6212
-sys/man/4/usb - 664 sys sys 1196638944 4682
+sys/man/4/usb - 664 sys sys 1202938916 5689
 sys/man/4/usbd - 664 sys sys 1202846392 1035
 sys/man/4/usbdisk - 664 sys sys 1202847388 3041
 sys/man/4/vacfs - 664 sys sys 1196638944 1545
@@ -7889,7 +7890,7 @@ sys/man/8/trampoline - 664 sys sys 1196638948 1199
 sys/man/8/udpecho - 664 sys sys 1196638948 303
 sys/man/8/update - 664 sys sys 1196638948 2336
 sys/man/8/venti - 664 sys sys 1197570117 12190
-sys/man/8/venti-backup - 664 sys sys 1196638948 2102
+sys/man/8/venti-backup - 664 sys sys 1202925137 2290
 sys/man/8/venti-fmt - 664 sys sys 1196638948 8626
 sys/man/8/vga - 664 sys sys 1196638948 4129
 sys/man/fonts - 664 sys sys 1196638948 218
@@ -8085,6 +8086,7 @@ sys/src/9/pc/devarch.c - 664 sys sys 1194556823 19867
 sys/src/9/pc/devether.c - 664 sys sys 1196687022 10567
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devi82365.c - 664 sys sys 1146318335 20504
+sys/src/9/pc/devkbin.c - 664 sys sys 1202939391 1806
 sys/src/9/pc/devlm78.c - 664 sys sys 1128255048 6291
 sys/src/9/pc/devlml.c - 664 sys sys 1184470711 7597
 sys/src/9/pc/devlml.h - 664 sys sys 1184470164 3031
@@ -8134,7 +8136,7 @@ sys/src/9/pc/i8259.c - 664 sys sys 1131290399 4586
 sys/src/9/pc/init9.c - 664 sys sys 1040002518 94
 sys/src/9/pc/initcode.s - 664 sys sys 1015014519 282
 sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
-sys/src/9/pc/kbd.c - 664 sys sys 1191355133 12339
+sys/src/9/pc/kbd.c - 664 sys sys 1202939524 12721
 sys/src/9/pc/l.s - 664 sys sys 1196193040 29691
 sys/src/9/pc/main.c - 664 sys sys 1168306227 15337
 sys/src/9/pc/mem.h - 664 sys sys 1196193040 5308
@@ -8279,7 +8281,7 @@ sys/src/9/port/parse.c - 664 sys sys 1014931177 2026
 sys/src/9/port/pgrp.c - 664 sys sys 1138458260 4760
 sys/src/9/port/portclock.c - 664 sys sys 1189292530 4276
 sys/src/9/port/portdat.h - 664 sys sys 1155995676 22703
-sys/src/9/port/portfns.h - 664 sys sys 1178831066 11059
+sys/src/9/port/portfns.h - 664 sys sys 1202939287 11060
 sys/src/9/port/portmkfile - 664 sys sys 1184737233 2082
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
 sys/src/9/port/proc.c - 664 sys sys 1176658321 28742
@@ -14386,7 +14388,7 @@ sys/src/cmd/venti/srv/printarenapart.c - 664 sys sys 1178160304 3544
 sys/src/cmd/venti/srv/printarenas.c - 664 sys sys 1142736355 2074
 sys/src/cmd/venti/srv/printindex.c - 664 sys sys 1142736355 1746
 sys/src/cmd/venti/srv/printmap.c - 664 sys sys 1142736355 542
-sys/src/cmd/venti/srv/rdarena.c - 664 sys sys 1178161030 1637
+sys/src/cmd/venti/srv/rdarena.c - 664 sys sys 1202925159 1695
 sys/src/cmd/venti/srv/readifile.c - 664 sys sys 1177534667 411
 sys/src/cmd/venti/srv/reseal.c - 664 sys sys 1177189438 6682
 sys/src/cmd/venti/srv/round.c - 664 sys sys 1142736355 1577

+ 10 - 0
dist/replica/plan9.log

@@ -18485,3 +18485,13 @@
 1202877003 1 c 386/bin/usb/usbaudio - 775 sys sys 1202876962 188937
 1202877003 2 c 386/bin/usb/usbd - 775 sys sys 1202876965 132270
 1202877003 3 c 386/bin/usb/usbmouse - 775 sys sys 1202876967 129429
+1202925605 0 c sys/man/8/venti-backup - 664 sys sys 1202925137 2290
+1202925605 1 c sys/src/cmd/venti/srv/rdarena.c - 664 sys sys 1202925159 1695
+1202934605 0 c 386/bin/venti/rdarena - 775 sys sys 1202933749 247159
+1202934605 1 c rc/bin/usbfat: - 775 sys sys 1202933070 827
+1202940004 0 a sys/man/3/kbin - 664 sys sys 1202938916 654
+1202940004 1 c sys/man/4/usb - 664 sys sys 1202938916 5689
+1202940004 2 c sys/src/9/pc/kbd.c - 664 sys sys 1202939524 12721
+1202940004 3 a sys/src/9/pc/devkbin.c - 664 sys sys 1202939391 1806
+1202940004 4 c sys/src/9/port/portfns.h - 664 sys sys 1202939287 11060
+1202950804 0 c sys/games/lib/fortunes - 664 sys sys 1202950617 268681

+ 1 - 1
rc/bin/usbfat:

@@ -33,7 +33,7 @@ if (! test -e $disk)
 if (! test -f /srv/usbfat.$user) {
 	blk = `{disk/fdisk -p $disk | awk '/^part dos / {print $3}'}
 	if (~ $#blk 0 || ! ~ $blk [0-9]*) {
-		echo $0: no fdisk dos partition found... >[1=2]
+		echo $0: warning: no fdisk dos partition found... >[1=2]
 		dossrv -f $disk usbfat.$user || exit dossrv
 	}
 	if not

+ 3 - 0
sys/games/lib/fortunes

@@ -4212,3 +4212,6 @@ Dear Valued Customer #88143191!
 rusty: kernel pseudo files are not the place for chit-chat
 I define UNIX as ``30 definitions of regular expressions living under one roof.''  - Don Knuth
 ADDITIONAL METAPHOR SPOILER ALERT: ``The Old Man and the Sea'' is not just about an old man and the sea.
+"it's complete cross-compilation not completely cross compilation" - Forsyth on 8c and gcc
+I claim that Mach people (and apparently FreeBSD) are incompetent idiots. Playing games with VM is bad. memory copies are _also_ bad, but quite frankly, memory copies often have _less_ downside than VM games, and bigger caches will only continue to drive that point home. - Linus Torvalds on vmsplice() versus COW
+Nothing is more hateful to wisdom than excessive cleverness - Seneca (according to Poe)

+ 36 - 0
sys/man/3/kbin

@@ -0,0 +1,36 @@
+.TH KBIN 3
+.SH NAME
+kbin \- external keyboard input
+.SH SYNOPSIS
+.nf
+.B bind -a #Ι /dev
+.sp 0.3v
+.B /dev/kbin
+.fi
+.SH DESCRIPTION
+The
+.I kbin
+device is a PC driver that
+serves a one-level directory containing a single file,
+.BR kbin ,
+which can be used to send
+keyboard scan codes to the kernel.
+.PP
+.I Kbin
+is necessary for
+.IR usb (4)
+drivers that handle keyboards.
+Keyboard input
+is processed as described in
+.IR cons (3).
+The scan codes correspond to the PC keyboard used by the
+.IR cons (3)
+driver and can be translated by the
+.IR kbmap (3)
+device.
+.SH "SEE ALSO"
+.IR cons (3),
+.IR kbmap (3),
+.IR keyboard (6)
+.SH SOURCE
+.B /sys/src/9/pc/devkbin.c

+ 77 - 18
sys/man/4/usb

@@ -1,9 +1,10 @@
 .TH USB 4
 .SH NAME
 usbmouse,
+kb,
 usbaudio,
 usbprint
-\- Universal Serial Bus user level device drivers
+\- Universal Serial Bus user-level device drivers
 .SH SYNOPSIS
 .B usb/usbmouse
 [
@@ -16,6 +17,17 @@ usbprint
 .I n
 ]
 .PP
+.B usb/kb
+[
+.B -dkmn
+] [
+.B -a
+.I n
+] [
+.I ctlrno
+.I n
+]
+.PP
 .B usb/usbaudio
 [
 .B -V
@@ -45,11 +57,17 @@ Dynamic handling of device insertion and removal is currently not supported.
 .I Usbmouse
 sends mouse events from a USB mouse to
 .B /dev/mousein
-where the Plan 9 kernel processes them like other mice.
+where the Plan 9 kernel processes them like other mice, but see
+.I kb
+below.
 .PP
 Without arguments, it scans the USB status files to find a mouse
 and uses the first one it finds.  A pair of numeric arguments overrides this search
 with a specific USB controller and device.  The options are
+.TF "-a ac"
+.TP
+.BI -a " accel"
+Accelerate mouse movements.
 .TP
 .BI -f
 Run usbmouse in foreground.
@@ -59,12 +77,50 @@ Use the scrollwheel.
 .TP
 .BI -v
 Verbose mode.
+.SS Keyboards and mice
+.I Kb
+supports USB keyboards and mice either as separate USB devices
+or as a single combined USB device. Scan codes from the keyboard
+are sent to
+.B /dev/kbin
+to let the kernel process them.
+Mouse events are sent to
+.B /dev/mousein
+in the same way.
+.PP
+Without arguments it handles the keyboard and mouse devices found
+on the bus.
+Otherwise it uses the one attached to controller
+.I ctrlno
+with device number
+.IR n .
+The following options are understood:
+.TF -k
 .TP
-.BI -a " accel"
-Accelerate mouse movements.
+.B \-a
+Accelerate the mouse to level
+.I n
+(similar to the kernel mouse driver acceleration).
+.TP
+.B \-d
+Activate debug diagnostics. Repeating the flag one or more times
+increases the verbosity.
+.TP
+.B \-k
+Serve just the keyboard (and not the mouse).
+.TP
+.B \-m
+Serve just the mouse (and not the keyboard).
+.TP
+.B \-n
+Dry run. Do not send any events to the kernel for processing.
+.SS Printers
+.I Usbprint
+is a script that mounts a USB printer on
+.BR /dev/lp .
 .SS Audio devices
 .I Usbaudio
-configures and manages a usb audio device.  It implements a file system,
+configures and manages a USB audio device.  It implements a file system,
 normally mounted in
 .BI /dev ,
 but this can be changed with the
@@ -148,12 +204,7 @@ and read from
 The data format is little endian, samples ordered primarily by time and
 secondarily by channel.  Samples occupy the minimum integral number
 of bytes.  Read and write operations of arbitrary size are allowed.
-.SS Printers
-.I Usbprint
-is a script that mounts a USB printer on
-.BR /dev/lp .
 .SH EXAMPLE
-.LP
 To use a USB mouse and audio device, put the following in your profile
 (replace
 .I x
@@ -176,26 +227,33 @@ in your profile.
 .B /sys/src/cmd/usb
 .SH "SEE ALSO"
 .IR usb (3),
-.IR usbd (4)
+.IR usbd (4),
+.IR usbdisk (4)
 .SH BUGS
-Usbaudio only works for certain audio devices.
-This is the list of devices known to work with usbaudio:
-.IP
+.I Usbaudio
+only works for certain audio devices.
+This is the list of devices known to work with
+.IR usbaudio :
+.IP "" 3
 .RS
+.TF "Edirol U"
 .TP
 Xitel AN1
-Output only.  Marginally enough to drive headphones.
+Output only.
+Marginally enough to drive headphones.
 Has mute, volume, bass, treble controls.
 .TP
 Philips USB speakers, model DSS 370/17
-Usbaudio acts on the volume
+.I Usbaudio
+acts on the volume
 .L +
 and
 .L -
 buttons.
 .TP
 Edirol UA-3
-Playback and record.  Playback only at 44.1 KHz, record at 32, 44.1 or 48 KHz.
+Playback and record.
+Playback only at 44.1 KHz, record at 32, 44.1 or 48 KHz.
 Playback volume control and mute control.
 The device only has analog (slider controlled)
 input volume control.
@@ -207,7 +265,8 @@ Playback volume control and mute control
 (haven't tested recording, but I believe it'll work).
 .TP
 Xitel Pro HiFi-Link
-Playback only.  48 KHz only.
+Playback only.
+48 KHz only.
 There is a volume control but it isn't connected to the output, so does nothing.
 .TP
 Onkyo WAVIO series MA-500U

+ 9 - 3
sys/man/8/venti-backup

@@ -5,7 +5,7 @@ rdarena, wrarena \- copy arenas between venti servers
 .PP
 .B venti/rdarena
 [
-.B -v
+.B -qv
 ]
 .I arenapart
 .I arenaname
@@ -34,7 +34,9 @@ and writes this arena to standard output.
 This command is typically used to back up an arena to external media.
 The
 .B -v
-option generates more verbose output on standard error.
+option generates more verbose output on standard error;
+.B -q
+generates only errors on standard error.
 .PP
 .I Wrarena
 writes the blocks contained in the arena
@@ -97,10 +99,14 @@ awk '/^end offset/ { print $3 }' offset >last
 Of course, one would need to add wrapper code to keep track
 of which arenas have been processed.
 See
-.B /sys/src/cmd/venti/backup.example
+.B /sys/src/cmd/venti/words/backup.example
 for a version that does this.
 .SH SOURCE
 .B /sys/src/cmd/venti/srv
 .SH SEE ALSO
 .IR venti (6),
 .IR venti (8)
+.SH BUGS
+.I Wrarena
+can't read a pipe or network connection containing an arena;
+it needs a file already containing the entire arena.

+ 120 - 0
sys/src/9/pc/devkbin.c

@@ -0,0 +1,120 @@
+/*
+ *  keyboard scan code input from outside the kernel.
+ *  to avoid duplication of keyboard map processing for usb.
+ */
+
+#include	"u.h"
+#include	"../port/lib.h"
+#include	"mem.h"
+#include	"dat.h"
+#include	"fns.h"
+#include	"../port/error.h"
+
+extern	void kbdputsc(int, int);
+
+enum {
+	Qdir,
+	Qkbd,
+};
+
+Dirtab kbintab[] = {
+	".",	{Qdir, 0, QTDIR},	0,	0555,
+	"kbin",	{Qkbd, 0},		0,	0200,
+};
+
+Lock	kbinlck;
+int	kbinbusy;
+
+static Chan *
+kbinattach(char *spec)
+{
+	return devattach(L'Ι', spec);
+}
+
+static Walkqid*
+kbinwalk(Chan *c, Chan *nc, char **name, int nname)
+{
+	return devwalk(c, nc, name, nname, kbintab, nelem(kbintab), devgen);
+}
+
+static int
+kbinstat(Chan *c, uchar *dp, int n)
+{
+	return devstat(c, dp, n, kbintab, nelem(kbintab), devgen);
+}
+
+static Chan*
+kbinopen(Chan *c, int omode)
+{
+	if(!iseve())
+		error(Eperm);
+	if(c->qid.path == Qkbd){
+		lock(&kbinlck);
+		if(kbinbusy){
+			unlock(&kbinlck);
+			error(Einuse);
+		}
+		kbinbusy++;
+		unlock(&kbinlck);
+	}
+	return devopen(c, omode, kbintab, nelem(kbintab), devgen);
+}
+
+static void
+kbinclose(Chan *c)
+{
+	if(c->aux){
+		free(c->aux);
+		c->aux = nil;
+	}
+	if(c->qid.path == Qkbd)
+		kbinbusy = 0;
+}
+
+static long
+kbinread(Chan *c, void *a, long n, vlong )
+{
+	if(c->qid.type == QTDIR)
+		return devdirread(c, a, n, kbintab, nelem(kbintab), devgen);
+	return 0;
+}
+
+static long
+kbinwrite(Chan *c, void *a, long n, vlong)
+{
+	int i;
+	uchar *p = a;
+
+	if(c->qid.type == QTDIR)
+		error(Eisdir);
+	switch((int)c->qid.path){
+	case Qkbd:
+		for(i = 0; i < n; i++)
+			kbdputsc(*p++, 1);	/* external source */
+		break;
+	default:
+		error(Egreg);
+	}
+	return n;
+}
+
+Dev kbindevtab = {
+	L'Ι',
+	"kbin",
+
+	devreset,
+	devinit,
+	devshutdown,
+	kbinattach,
+	kbinwalk,
+	kbinstat,
+	kbinopen,
+	devcreate,
+	kbinclose,
+	kbinread,
+	devbread,
+	kbinwrite,
+	devbwrite,
+	devremove,
+	devwstat,
+};

+ 105 - 83
sys/src/9/pc/kbd.c

@@ -1,3 +1,6 @@
+/*
+ * keyboard input
+ */
 #include	"u.h"
 #include	"../port/lib.h"
 #include	"mem.h"
@@ -290,68 +293,51 @@ i8042auxcmds(uchar *cmd, int ncmd)
 	return i;
 }
 
-struct {
-	int esc1;
-	int esc2;
-	int alt;
-	int altgr;
-	int caps;
-	int ctl;
-	int num;
-	int shift;
-	int collecting;
-	int nk;
-	Rune kc[5];
-	int buttons;
-} kbscan;
+typedef struct Kbscan Kbscan;
+struct Kbscan {
+	int	esc1;
+	int	esc2;
+	int	alt;
+	int	altgr;
+	int	caps;
+	int	ctl;
+	int	num;
+	int	shift;
+	int	collecting;
+	int	nk;
+	Rune	kc[5];
+	int	buttons;
+};
+
+Kbscan kbscans[2];	/* kernel and external scan code state */
 
 /*
- *  keyboard interrupt
+ * Scan code processing
  */
-static void
-i8042intr(Ureg*, void*)
+void
+kbdputsc(int c, int external)
 {
-	int s, c, i;
-	int keyup;
-
-	/*
-	 *  get status
-	 */
-	ilock(&i8042lock);
-	s = inb(Status);
-	if(!(s&Inready)){
-		iunlock(&i8042lock);
-		return;
-	}
+	int i, keyup;
+	Kbscan *kbscan;
 
-	/*
-	 *  get the character
-	 */
-	c = inb(Data);
-	iunlock(&i8042lock);
-
-	/*
-	 *  if it's the aux port...
-	 */
-	if(s & Minready){
-		if(auxputc != nil)
-			auxputc(c, kbscan.shift);
-		return;
-	}
+	if(external)
+		kbscan = &kbscans[1];
+	else
+		kbscan = &kbscans[0];
 
 	/*
 	 *  e0's is the first of a 2 character sequence, e1 the first
 	 *  of a 3 character sequence (on the safari)
 	 */
 	if(c == 0xe0){
-		kbscan.esc1 = 1;
+		kbscan->esc1 = 1;
 		return;
 	} else if(c == 0xe1){
-		kbscan.esc2 = 2;
+		kbscan->esc2 = 2;
 		return;
 	}
 
-	keyup = c&0x80;
+	keyup = c & 0x80;
 	c &= 0x7f;
 	if(c > sizeof kbtab){
 		c |= keyup;
@@ -360,22 +346,22 @@ i8042intr(Ureg*, void*)
 		return;
 	}
 
-	if(kbscan.esc1){
+	if(kbscan->esc1){
 		c = kbtabesc1[c];
-		kbscan.esc1 = 0;
-	} else if(kbscan.esc2){
-		kbscan.esc2--;
+		kbscan->esc1 = 0;
+	} else if(kbscan->esc2){
+		kbscan->esc2--;
 		return;
-	} else if(kbscan.shift)
+	} else if(kbscan->shift)
 		c = kbtabshift[c];
-	else if(kbscan.altgr)
+	else if(kbscan->altgr)
 		c = kbtabaltgr[c];
-	else if(kbscan.ctl)
+	else if(kbscan->ctl)
 		c = kbtabctrl[c];
 	else
 		c = kbtab[c];
 
-	if(kbscan.caps && c<='z' && c>='a')
+	if(kbscan->caps && c<='z' && c>='a')
 		c += 'A' - 'a';
 
 	/*
@@ -384,26 +370,26 @@ i8042intr(Ureg*, void*)
 	if(keyup){
 		switch(c){
 		case Latin:
-			kbscan.alt = 0;
+			kbscan->alt = 0;
 			break;
 		case Shift:
-			kbscan.shift = 0;
+			kbscan->shift = 0;
 			mouseshifted = 0;
 			break;
 		case Ctrl:
-			kbscan.ctl = 0;
+			kbscan->ctl = 0;
 			break;
 		case Altgr:
-			kbscan.altgr = 0;
+			kbscan->altgr = 0;
 			break;
 		case Kmouse|1:
 		case Kmouse|2:
 		case Kmouse|3:
 		case Kmouse|4:
 		case Kmouse|5:
-			kbscan.buttons &= ~(1<<(c-Kmouse-1));
+			kbscan->buttons &= ~(1<<(c-Kmouse-1));
 			if(kbdmouse)
-				kbdmouse(kbscan.buttons);
+				kbdmouse(kbscan->buttons);
 			break;
 		}
 		return;
@@ -413,39 +399,39 @@ i8042intr(Ureg*, void*)
  	 *  normal character
 	 */
 	if(!(c & (Spec|KF))){
-		if(kbscan.ctl)
-			if(kbscan.alt && c == Del)
+		if(kbscan->ctl)
+			if(kbscan->alt && c == Del)
 				exit(0);
-		if(!kbscan.collecting){
+		if(!kbscan->collecting){
 			kbdputc(kbdq, c);
 			return;
 		}
-		kbscan.kc[kbscan.nk++] = c;
-		c = latin1(kbscan.kc, kbscan.nk);
+		kbscan->kc[kbscan->nk++] = c;
+		c = latin1(kbscan->kc, kbscan->nk);
 		if(c < -1)	/* need more keystrokes */
 			return;
 		if(c != -1)	/* valid sequence */
 			kbdputc(kbdq, c);
 		else	/* dump characters */
-			for(i=0; i<kbscan.nk; i++)
-				kbdputc(kbdq, kbscan.kc[i]);
-		kbscan.nk = 0;
-		kbscan.collecting = 0;
+			for(i=0; i<kbscan->nk; i++)
+				kbdputc(kbdq, kbscan->kc[i]);
+		kbscan->nk = 0;
+		kbscan->collecting = 0;
 		return;
 	} else {
 		switch(c){
 		case Caps:
-			kbscan.caps ^= 1;
+			kbscan->caps ^= 1;
 			return;
 		case Num:
-			kbscan.num ^= 1;
+			kbscan->num ^= 1;
 			return;
 		case Shift:
-			kbscan.shift = 1;
+			kbscan->shift = 1;
 			mouseshifted = 1;
 			return;
 		case Latin:
-			kbscan.alt = 1;
+			kbscan->alt = 1;
 			/*
 			 * VMware and Qemu use Ctl-Alt as the key combination
 			 * to make the VM give up keyboard and mouse focus.
@@ -456,31 +442,67 @@ i8042intr(Ureg*, void*)
 			 * As a clumsy hack around this, we look for ctl-alt
 			 * and don't treat it as the start of a compose sequence.
 			 */
-			if(!kbscan.ctl){
-				kbscan.collecting = 1;
-				kbscan.nk = 0;
+			if(!kbscan->ctl){
+				kbscan->collecting = 1;
+				kbscan->nk = 0;
 			}
 			return;
 		case Ctrl:
-			kbscan.ctl = 1;
+			kbscan->ctl = 1;
 			return;
 		case Altgr:
-			kbscan.altgr = 1;
+			kbscan->altgr = 1;
 			return;
 		case Kmouse|1:
 		case Kmouse|2:
 		case Kmouse|3:
 		case Kmouse|4:
 		case Kmouse|5:
-			kbscan.buttons |= 1<<(c-Kmouse-1);
+			kbscan->buttons |= 1<<(c-Kmouse-1);
 			if(kbdmouse)
-				kbdmouse(kbscan.buttons);
+				kbdmouse(kbscan->buttons);
 			return;
 		}
 	}
 	kbdputc(kbdq, c);
 }
 
+/*
+ *  keyboard interrupt
+ */
+static void
+i8042intr(Ureg*, void*)
+{
+	int s, c;
+
+	/*
+	 *  get status
+	 */
+	ilock(&i8042lock);
+	s = inb(Status);
+	if(!(s&Inready)){
+		iunlock(&i8042lock);
+		return;
+	}
+
+	/*
+	 *  get the character
+	 */
+	c = inb(Data);
+	iunlock(&i8042lock);
+
+	/*
+	 *  if it's the aux port...
+	 */
+	if(s & Minready){
+		if(auxputc != nil)
+			auxputc(c, kbscans[0].shift);	/* internal source */
+		return;
+	}
+
+	kbdputsc(c, 0);			/* internal source */
+}
+
 void
 i8042auxenable(void (*putc)(int, int))
 {
@@ -581,12 +603,12 @@ kbdputmap(ushort m, ushort scanc, Rune r)
 }
 
 int
-kbdgetmap(int offset, int *t, int *sc, Rune *r)
+kbdgetmap(uint offset, int *t, int *sc, Rune *r)
 {
+	if ((int)offset < 0)
+		error(Ebadarg);
 	*t = offset/Nscan;
 	*sc = offset%Nscan;
-	if(*t < 0 || *sc < 0)
-		error(Ebadarg);
 	switch(*t) {
 	default:
 		return 0;

+ 1 - 1
sys/src/9/port/portfns.h

@@ -143,7 +143,7 @@ int		ispages(void*);
 int		isphysseg(char*);
 void		ixsummary(void);
 int		kbdcr2nl(Queue*, int);
-int		kbdgetmap(int, int*, int*, Rune*);
+int		kbdgetmap(uint, int*, int*, Rune*);
 int		kbdputc(Queue*, int);
 void		kbdputmap(ushort, ushort, Rune);
 void		kickpager(void);

+ 8 - 3
sys/src/cmd/venti/srv/rdarena.c

@@ -2,7 +2,7 @@
 #include "dat.h"
 #include "fns.h"
 
-static int	verbose;
+static int verbose, quiet;
 
 void
 usage(void)
@@ -18,8 +18,10 @@ rdarena(Arena *arena)
 	u64int a, e;
 	u32int bs;
 
-	fprint(2, "copying %s to standard output\n", arena->name);
-	printarena(2, arena);
+	if (!quiet) {
+		fprint(2, "copying %s to standard output\n", arena->name);
+		printarena(2, arena);
+	}
 
 	bs = MaxIoSize;
 	if(bs < arena->blocksize)
@@ -51,6 +53,9 @@ threadmain(int argc, char *argv[])
 	statsinit();
 
 	ARGBEGIN{
+	case 'q':
+		quiet++;
+		break;
 	case 'v':
 		verbose++;
 		break;