Browse Source

Plan 9 from Bell Labs 2006-05-08

David du Colombier 14 years ago
parent
commit
769f26ab0b

+ 13 - 6
dist/replica/_plan9.db

@@ -79,6 +79,7 @@
 386/bin/auth/warning - 775 sys sys 1144688915 101390
 386/bin/auth/wrkey - 775 sys sys 1143777752 75559
 386/bin/aux - 20000000775 sys sys 1016920817 0
+386/bin/aux/8prefix - 775 sys sys 1147057033 67198
 386/bin/aux/9pcon - 775 sys sys 1143777753 95248
 386/bin/aux/LOCK - 775 sys sys 1143777753 60240
 386/bin/aux/X509gen - 775 sys sys 1048341826 129186
@@ -6114,6 +6115,10 @@ sys/lib/dist/cmd/bzfs/unbzip.c - 664 sys sys 1018469727 24395
 sys/lib/dist/cmd/cdsh.c - 664 sys sys 1018469727 2100
 sys/lib/dist/cmd/clog.c - 664 sys sys 1018469727 920
 sys/lib/dist/cmd/mkfile - 664 sys sys 1018641017 259
+sys/lib/dist/cmd/multi - 20000000775 sys sys 1147022829 0
+sys/lib/dist/cmd/multi/mkfile - 664 sys sys 1147022825 844
+sys/lib/dist/cmd/multi/mkmulti - 775 sys sys 1147022824 1235
+sys/lib/dist/cmd/multi/multi.c - 664 sys sys 1147022829 543
 sys/lib/dist/cmd/tailfsrv.c - 664 sys sys 1018469727 258
 sys/lib/dist/cmd/touchfs.c - 664 sys sys 1018469727 1120
 sys/lib/dist/cmd/unbflz.c - 664 sys sys 1018469727 1688
@@ -6183,11 +6188,12 @@ sys/lib/dist/pc/inst/textonly - 775 sys sys 1112361039 182
 sys/lib/dist/pc/inst/watchfd - 775 sys sys 1127670125 362
 sys/lib/dist/pc/inst/xxx - 775 sys sys 1018469719 160
 sys/lib/dist/pc/mkfile - 664 sys sys 1142958580 2193
+sys/lib/dist/pc/multi - 20000000775 sys sys 1147022870 0
 sys/lib/dist/pc/plan9.ini - 664 sys sys 1142177575 236
 sys/lib/dist/pc/plan9.ini.blank - 664 sys sys 1018469720 512
 sys/lib/dist/pc/plan9.ini.cd - 664 sys sys 1132452554 369
 sys/lib/dist/pc/plan9.ini.vmware - 664 sys sys 1045500078 168
-sys/lib/dist/pc/proto - 664 sys sys 1112535197 4250
+sys/lib/dist/pc/proto - 664 sys sys 1147022862 5596
 sys/lib/dist/pc/sub - 20000000775 sys sys 1018640631 0
 sys/lib/dist/pc/sub/a: - 775 sys sys 1018469726 481
 sys/lib/dist/pc/sub/bind - 775 sys sys 1018469726 207
@@ -7797,7 +7803,7 @@ sys/src/9/alphapc/mkfile - 664 sys sys 1109218102 1682
 sys/src/9/alphapc/mmu.c - 664 sys sys 1131538486 4981
 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 1131289708 3818
+sys/src/9/alphapc/screen.h - 664 sys sys 1147023555 3888
 sys/src/9/alphapc/sd53c8xx.c - 664 sys sys 1137179967 55257
 sys/src/9/alphapc/sio.c - 664 sys sys 1015012787 293
 sys/src/9/alphapc/trap.c - 664 sys sys 1105030177 18099
@@ -7844,7 +7850,7 @@ sys/src/9/bitsy/random.c - 664 sys sys 1036813517 1982
 sys/src/9/bitsy/sa1110dma.c - 664 sys sys 1017695520 4666
 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 1017695520 260
+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 1131289776 44404
 sys/src/9/bitsy/tar.c - 664 sys sys 1017695521 1375
@@ -8019,7 +8025,7 @@ sys/src/9/pc/random.c - 664 sys sys 1036812832 2021
 sys/src/9/pc/realmode.c - 664 sys sys 1139667044 2678
 sys/src/9/pc/rebootcode.s - 664 sys sys 1015014522 988
 sys/src/9/pc/screen.c - 664 sys sys 1136336092 13971
-sys/src/9/pc/screen.h - 664 sys sys 1131290516 4156
+sys/src/9/pc/screen.h - 664 sys sys 1147023549 4256
 sys/src/9/pc/sd53c8xx.c - 664 sys sys 1145359822 55087
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sdata.c - 664 sys sys 1141793347 52244
@@ -8073,7 +8079,7 @@ sys/src/9/port/devaudio.c - 664 sys sys 1142086793 21147
 sys/src/9/port/devbridge.c - 664 sys sys 1055688301 24308
 sys/src/9/port/devcap.c - 664 sys sys 1048644215 4113
 sys/src/9/port/devcons.c - 664 sys sys 1143648105 23071
-sys/src/9/port/devdraw.c - 664 sys sys 1131289870 43537
+sys/src/9/port/devdraw.c - 664 sys sys 1147023550 44447
 sys/src/9/port/devdup.c - 664 sys sys 1014931172 2332
 sys/src/9/port/devenv.c - 664 sys sys 1048644225 6992
 sys/src/9/port/devfs.c - 664 sys sys 1105799131 10783
@@ -9536,6 +9542,7 @@ sys/src/cmd/auth/userpasswd.c - 664 sys sys 1015008432 591
 sys/src/cmd/auth/warning.c - 664 sys sys 1140272945 5271
 sys/src/cmd/auth/wrkey.c - 664 sys sys 1019058717 176
 sys/src/cmd/aux - 20000000775 sys sys 1015008975 0
+sys/src/cmd/aux/8prefix.c - 664 sys sys 1147022850 4505
 sys/src/cmd/aux/9pcon.c - 664 sys sys 1127394247 6284
 sys/src/cmd/aux/accupoint.c - 664 sys sys 985124882 2166
 sys/src/cmd/aux/acidleak.c - 664 sys sys 1143670676 5965
@@ -9651,7 +9658,7 @@ sys/src/cmd/aux/lines.c - 664 sys sys 1015008782 546
 sys/src/cmd/aux/lis - 775 sys sys 944960794 45
 sys/src/cmd/aux/listen.c - 664 sys sys 1143759349 8150
 sys/src/cmd/aux/listen1.c - 664 sys sys 1143759349 2005
-sys/src/cmd/aux/mkfile - 664 sys sys 1139744302 1011
+sys/src/cmd/aux/mkfile - 664 sys sys 1147022848 1021
 sys/src/cmd/aux/mklatinkbd.c - 664 sys sys 953253425 3813
 sys/src/cmd/aux/mnihongo - 20000000775 sys sys 944960789 0
 sys/src/cmd/aux/mnihongo/README - 664 sys sys 944960789 475

+ 13 - 6
dist/replica/plan9.db

@@ -79,6 +79,7 @@
 386/bin/auth/warning - 775 sys sys 1144688915 101390
 386/bin/auth/wrkey - 775 sys sys 1143777752 75559
 386/bin/aux - 20000000775 sys sys 1016920817 0
+386/bin/aux/8prefix - 775 sys sys 1147057033 67198
 386/bin/aux/9pcon - 775 sys sys 1143777753 95248
 386/bin/aux/LOCK - 775 sys sys 1143777753 60240
 386/bin/aux/X509gen - 775 sys sys 1048341826 129186
@@ -6114,6 +6115,10 @@ sys/lib/dist/cmd/bzfs/unbzip.c - 664 sys sys 1018469727 24395
 sys/lib/dist/cmd/cdsh.c - 664 sys sys 1018469727 2100
 sys/lib/dist/cmd/clog.c - 664 sys sys 1018469727 920
 sys/lib/dist/cmd/mkfile - 664 sys sys 1018641017 259
+sys/lib/dist/cmd/multi - 20000000775 sys sys 1147022829 0
+sys/lib/dist/cmd/multi/mkfile - 664 sys sys 1147022825 844
+sys/lib/dist/cmd/multi/mkmulti - 775 sys sys 1147022824 1235
+sys/lib/dist/cmd/multi/multi.c - 664 sys sys 1147022829 543
 sys/lib/dist/cmd/tailfsrv.c - 664 sys sys 1018469727 258
 sys/lib/dist/cmd/touchfs.c - 664 sys sys 1018469727 1120
 sys/lib/dist/cmd/unbflz.c - 664 sys sys 1018469727 1688
@@ -6183,11 +6188,12 @@ sys/lib/dist/pc/inst/textonly - 775 sys sys 1112361039 182
 sys/lib/dist/pc/inst/watchfd - 775 sys sys 1127670125 362
 sys/lib/dist/pc/inst/xxx - 775 sys sys 1018469719 160
 sys/lib/dist/pc/mkfile - 664 sys sys 1142958580 2193
+sys/lib/dist/pc/multi - 20000000775 sys sys 1147022870 0
 sys/lib/dist/pc/plan9.ini - 664 sys sys 1142177575 236
 sys/lib/dist/pc/plan9.ini.blank - 664 sys sys 1018469720 512
 sys/lib/dist/pc/plan9.ini.cd - 664 sys sys 1132452554 369
 sys/lib/dist/pc/plan9.ini.vmware - 664 sys sys 1045500078 168
-sys/lib/dist/pc/proto - 664 sys sys 1112535197 4250
+sys/lib/dist/pc/proto - 664 sys sys 1147022862 5596
 sys/lib/dist/pc/sub - 20000000775 sys sys 1018640631 0
 sys/lib/dist/pc/sub/a: - 775 sys sys 1018469726 481
 sys/lib/dist/pc/sub/bind - 775 sys sys 1018469726 207
@@ -7797,7 +7803,7 @@ sys/src/9/alphapc/mkfile - 664 sys sys 1109218102 1682
 sys/src/9/alphapc/mmu.c - 664 sys sys 1131538486 4981
 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 1131289708 3818
+sys/src/9/alphapc/screen.h - 664 sys sys 1147023555 3888
 sys/src/9/alphapc/sd53c8xx.c - 664 sys sys 1137179967 55257
 sys/src/9/alphapc/sio.c - 664 sys sys 1015012787 293
 sys/src/9/alphapc/trap.c - 664 sys sys 1105030177 18099
@@ -7844,7 +7850,7 @@ sys/src/9/bitsy/random.c - 664 sys sys 1036813517 1982
 sys/src/9/bitsy/sa1110dma.c - 664 sys sys 1017695520 4666
 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 1017695520 260
+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 1131289776 44404
 sys/src/9/bitsy/tar.c - 664 sys sys 1017695521 1375
@@ -8019,7 +8025,7 @@ sys/src/9/pc/random.c - 664 sys sys 1036812832 2021
 sys/src/9/pc/realmode.c - 664 sys sys 1139667044 2678
 sys/src/9/pc/rebootcode.s - 664 sys sys 1015014522 988
 sys/src/9/pc/screen.c - 664 sys sys 1136336092 13971
-sys/src/9/pc/screen.h - 664 sys sys 1131290516 4156
+sys/src/9/pc/screen.h - 664 sys sys 1147023549 4256
 sys/src/9/pc/sd53c8xx.c - 664 sys sys 1145359822 55087
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sdata.c - 664 sys sys 1141793347 52244
@@ -8073,7 +8079,7 @@ sys/src/9/port/devaudio.c - 664 sys sys 1142086793 21147
 sys/src/9/port/devbridge.c - 664 sys sys 1055688301 24308
 sys/src/9/port/devcap.c - 664 sys sys 1048644215 4113
 sys/src/9/port/devcons.c - 664 sys sys 1143648105 23071
-sys/src/9/port/devdraw.c - 664 sys sys 1131289870 43537
+sys/src/9/port/devdraw.c - 664 sys sys 1147023550 44447
 sys/src/9/port/devdup.c - 664 sys sys 1014931172 2332
 sys/src/9/port/devenv.c - 664 sys sys 1048644225 6992
 sys/src/9/port/devfs.c - 664 sys sys 1105799131 10783
@@ -9536,6 +9542,7 @@ sys/src/cmd/auth/userpasswd.c - 664 sys sys 1015008432 591
 sys/src/cmd/auth/warning.c - 664 sys sys 1140272945 5271
 sys/src/cmd/auth/wrkey.c - 664 sys sys 1019058717 176
 sys/src/cmd/aux - 20000000775 sys sys 1015008975 0
+sys/src/cmd/aux/8prefix.c - 664 sys sys 1147022850 4505
 sys/src/cmd/aux/9pcon.c - 664 sys sys 1127394247 6284
 sys/src/cmd/aux/accupoint.c - 664 sys sys 985124882 2166
 sys/src/cmd/aux/acidleak.c - 664 sys sys 1143670676 5965
@@ -9651,7 +9658,7 @@ sys/src/cmd/aux/lines.c - 664 sys sys 1015008782 546
 sys/src/cmd/aux/lis - 775 sys sys 944960794 45
 sys/src/cmd/aux/listen.c - 664 sys sys 1143759349 8150
 sys/src/cmd/aux/listen1.c - 664 sys sys 1143759349 2005
-sys/src/cmd/aux/mkfile - 664 sys sys 1139744302 1011
+sys/src/cmd/aux/mkfile - 664 sys sys 1147022848 1021
 sys/src/cmd/aux/mklatinkbd.c - 664 sys sys 953253425 3813
 sys/src/cmd/aux/mnihongo - 20000000775 sys sys 944960789 0
 sys/src/cmd/aux/mnihongo/README - 664 sys sys 944960789 475

+ 13 - 0
dist/replica/plan9.log

@@ -29628,3 +29628,16 @@
 1146799887 2 c sys/src/fs/port/lib.h - 664 sys sys 1146798595 3791
 1146805289 0 c sys/src/fs/doc/words - 664 sys sys 1146803821 1162
 1146805289 1 c sys/src/fs/pc/compat.h - 664 sys sys 1140774918 2578
+1147023034 0 a sys/lib/dist/cmd/multi - 20000000775 sys sys 1147022829 0
+1147023034 1 a sys/lib/dist/cmd/multi/mkfile - 664 sys sys 1147022825 844
+1147023034 2 a sys/lib/dist/cmd/multi/mkmulti - 775 sys sys 1147022824 1235
+1147023034 3 a sys/lib/dist/cmd/multi/multi.c - 664 sys sys 1147022829 543
+1147023034 4 a sys/lib/dist/pc/multi - 20000000775 sys sys 1147022870 0
+1147023034 5 c sys/lib/dist/pc/proto - 664 sys sys 1147022862 5596
+1147023034 6 a sys/src/cmd/aux/8prefix.c - 664 sys sys 1147022850 4505
+1147023034 7 c sys/src/cmd/aux/mkfile - 664 sys sys 1147022848 1021
+1147024835 0 c sys/src/9/alphapc/screen.h - 664 sys sys 1147023555 3888
+1147024835 1 c sys/src/9/bitsy/screen.h - 664 sys sys 1147023548 284
+1147024835 2 c sys/src/9/pc/screen.h - 664 sys sys 1147023549 4256
+1147024835 3 c sys/src/9/port/devdraw.c - 664 sys sys 1147023550 44447
+1147057243 0 a 386/bin/aux/8prefix - 775 sys sys 1147057033 67198

+ 76 - 0
sys/lib/dist/cmd/multi/mkfile

@@ -0,0 +1,76 @@
+objtype=386
+</$objtype/mkfile
+
+TARG=multi
+
+PIECES=\
+	aux/mouse\
+	aux/pcmcia\
+	aux/vga\
+	aux/zerotrunc\
+	disk/fdisk\
+	disk/format\
+	disk/mbr\
+	disk/prep\
+#	fossil/fossil\
+#	fossil/flfmt\
+	ip/ipconfig\
+	ip/ppp\
+	ndb/cs\
+	ndb/dns\
+	replica/applylog\
+	9660srv\
+#	awk\
+	basename\
+	cat\
+	chgrp\
+	chmod\
+	cleanname\
+	cmp\
+	cp\
+	date\
+	dd\
+	dossrv\
+	echo\
+	ed\
+	ext2srv\
+#	fcp\
+	grep\
+	hget\
+	hoc\
+	ls\
+	mc\
+	mount\
+	mv\
+	ps\
+	read\
+#	rio\
+	rm\
+	sed\
+	sort\
+	srv\
+#	stats\
+	syscall\
+	tail\
+	tee\
+	test\
+	wc\
+	xd\
+
+8.multi:V: mkmulti mkfile
+	mkmulti $PIECES 
+	ls -l 8.multi
+	ls -l /386/bin/$PIECES | awk '{s += $6} END{print s}'
+
+scripts:V:
+	rm -rf ../../pc/multi
+	mkdir ../../pc/multi
+	for(i in $PIECES){
+		b=`{basename $i}
+		echo '#!/bin/multi' >>../../pc/multi/$b
+		chmod +x ../../pc/multi/$b
+	}
+
+BIN=/sys/lib/dist/bin/$objtype
+</sys/src/cmd/mkmany
+

+ 70 - 0
sys/lib/dist/cmd/multi/mkmulti

@@ -0,0 +1,70 @@
+#!/bin/rc
+
+targ=multi
+
+n=0
+dir=`{pwd}
+
+fn grab {
+	echo using $*
+	for(i){
+		n=`{echo 1+$n|hoc}
+		mv $i $dir/a.$n.8
+	}
+}
+
+fn getfiles {
+	sed -n 's/^(pcc|8\^l|8l) +(-o [^ ]* +)?([^\-].*)/ \3/p' | sed 's/ -[^ ]*//g' |
+		sed 's/ [^ ]*\.a//g'
+}
+
+rm a.*.8
+>multi.h
+>multiproto.h
+
+for(i){
+echo $i...
+	b=`{basename $i}
+	p=$b
+	if(~ $b [0-9]*)
+		p=_$b
+	echo void $p^_main'(int, char**);' >>$dir/multiproto.h
+	echo "$b", $p^_main, >>$dir/multi.h
+	d=`{basename -d $i}
+	if(~ $i disk/prep disk/fdisk){
+		cd /sys/src/cmd/disk/prep
+		rm 8.$b
+		files=`{mk 8.$b | getfiles}
+	}
+	if not if(test -d /sys/src/cmd/$i && @{cd /sys/src/cmd/$i && mk 8.out}){
+		cd /sys/src/cmd/$i
+		rm 8.out
+		files=`{mk 8.out | getfiles}
+	}
+	if not if(test -d /sys/src/cmd/$i && @{cd /sys/src/cmd/$i && mk 8.$b}){
+		cd /sys/src/cmd/$i
+		rm 8.out
+		files=`{mk 8.$b | getfiles}
+	}
+	if not if(test -d /sys/src/cmd/$d && @{cd /sys/src/cmd/$d && mk 8.$b}){
+		cd /sys/src/cmd/$d
+		rm 8.$b
+		files=`{mk 8.$b | getfiles}
+	}
+	if not{
+		echo do not know how to make $i
+		exit oops
+	}
+	aux/8prefix $p^_ $files
+	grab $files
+	switch(`{pwd}){
+	case /sys/src/cmd /sys/src/cmd/aux /sys/src/cmd/ip
+		rm 8.$b
+	case *
+		mk clean
+	}
+}
+cd $dir
+8c -FVw multi.c
+8l -o 8.$targ multi.8 a.*.8
+# rm a.*.8

+ 38 - 0
sys/lib/dist/cmd/multi/multi.c

@@ -0,0 +1,38 @@
+#include <u.h>
+#include <libc.h>
+
+#include "multiproto.h"
+struct {
+	char *name; 
+	void (*fn)(int, char**);
+} mains[] =
+{
+#include "multi.h"
+};
+
+void
+main(int argc, char **argv)
+{
+	int i;
+	char *cmd, *p;
+	
+	if(argc == 1){
+		fprint(2, "usage: multi cmd args...\n");
+		exits("usage");
+	}
+	
+	cmd = argv[1];
+	if(p = strrchr(cmd, '/'))
+		cmd = p+1;
+	argv++;
+	argc--;
+
+	for(i=0; i<nelem(mains); i++){
+		if(strcmp(cmd, mains[i].name) == 0){
+			mains[i].fn(argc, argv);
+			return;
+		}
+	}
+	fprint(2, "multi: no such cmd %s\n", cmd);
+	exits("no cmd");
+}

+ 47 - 46
sys/lib/dist/pc/proto

@@ -11,37 +11,37 @@
 #			factotum	555 sys sys
 		aux	d555 sys sys
 			isvmware	555 sys sys
-			mouse	555 sys sys
-			pcmcia	555 sys sys
+			mouse	555 sys sys /sys/lib/dist/pc/multi/mouse
+			pcmcia	555 sys sys /sys/lib/dist/pc/multi/pcmcia
 		#	stub	555 sys sys
-			vga	555 sys sys
+			vga	555 sys sys /sys/lib/dist/pc/multi/vga
 			vmware	555 sys sys /sys/lib/dist/pc/sub/vmware
 		#	vmware	555 sys sys
 		#	vmwarefs	555 sys sys
 		#	vmmousepoll	555 sys sys
-			zerotrunc	555 sys sys
+			zerotrunc	555 sys sys /sys/lib/dist/pc/multi/zerotrunc
 		disk	d555 sys sys
-			fdisk	555 sys sys
-			format	555 sys sys
+			fdisk	555 sys sys /sys/lib/dist/pc/multi/fdisk
+			format	555 sys sys /sys/lib/dist/pc/multi/format
 #			kfs	555 sys sys
 #			kfscmd	555 sys sys
-			mbr	555 sys sys
-			prep	555 sys sys
+			mbr	555 sys sys /sys/lib/dist/pc/multi/mbr
+			prep	555 sys sys /sys/lib/dist/pc/multi/prep
 		fossil	d555 sys sys
 			fossil	555 sys sys
 			flfmt	555 sys sys
 			conf		555 sys sys
 		ip	d555 sys sys
-			ipconfig	555 sys sys
-			ppp	555 sys sys
+			ipconfig	555 sys sys /sys/lib/dist/pc/multi/ipconfig
+			ppp	555 sys sys /sys/lib/dist/pc/multi/ppp
 		ndb	d555 sys sys
 # csquery and dnsquery could go
-			cs	555 sys sys
+			cs	555 sys sys /sys/lib/dist/pc/multi/cs
 # 			csquery	555 sys sys
-			dns	555 sys sys
+			dns	555 sys sys /sys/lib/dist/pc/multi/dns
 # 			dnsquery	555 sys sys
 		replica	d555 sys sys
-			applylog	555 sys sys
+			applylog	555 sys sys /sys/lib/dist/pc/multi/applylog
 			changes	555 sys sys
 			compactdb	555 sys sys /sys/lib/dist/pc/sub/compactdb
 			pull		555 sys sys
@@ -51,58 +51,59 @@
 #			fmtarenas	555 sys sys
 #			fmtindex	555 sys sys
 #			fmtisect	555 sys sys
-		9660srv	555 sys sys
+		9660srv	555 sys sys /sys/lib/dist/pc/multi/9660srv
 # acme could go
 #		acme	555 sys sys
 		awk	555 sys sys
 		bargraph	555 sys sys /sys/lib/dist/bin/386/bargraph
-		basename	555 sys sys
-		cat	555 sys sys
-		chgrp	555 sys sys
-		chmod	555 sys sys
-		cleanname	555 sys sys
-		cmp	555 sys sys
+		basename	555 sys sys /sys/lib/dist/pc/multi/basename
+		cat	555 sys sys /sys/lib/dist/pc/multi/cat
+		chgrp	555 sys sys /sys/lib/dist/pc/multi/chgrp
+		chmod	555 sys sys /sys/lib/dist/pc/multi/chmod
+		cleanname	555 sys sys /sys/lib/dist/pc/multi/cleanname
+		cmp	555 sys sys /sys/lib/dist/pc/multi/cmp
 		cdsh	555 sys sys /sys/lib/dist/bin/386/cdsh
-		cp	555 sys sys
+		cp	555 sys sys /sys/lib/dist/pc/multi/cp
 # cpu could go
 #		cpu	555 sys sys
-		date	555 sys sys
-		dd	555 sys sys
-		dossrv 555 sys sys
-		echo	555 sys sys
-		ed	555 sys sys
+		date	555 sys sys /sys/lib/dist/pc/multi/date
+		dd	555 sys sys /sys/lib/dist/pc/multi/dd
+		dossrv 555 sys sys /sys/lib/dist/pc/multi/dossrv
+		echo	555 sys sys /sys/lib/dist/pc/multi/echo
+		ed	555 sys sys /sys/lib/dist/pc/multi/ed
 # if cpu goes, exportfs could go
 #		exportfs	555 sys sys
-		ext2srv	555 sys sys
+		ext2srv	555 sys sys /sys/lib/dist/pc/multi/ext2srv
 		fcp		555	sys	sys
-		grep	555 sys sys
-		hget	555 sys sys
-		hoc	555 sys sys
-		ls	555 sys sys
-		mc	555 sys sys
-		mount	555 sys sys
-		mv	555 sys sys
+		grep	555 sys sys /sys/lib/dist/pc/multi/grep
+		hget	555 sys sys /sys/lib/dist/pc/multi/hget
+		hoc	555 sys sys /sys/lib/dist/pc/multi/hoc
+		ls	555 sys sys /sys/lib/dist/pc/multi/ls
+		mc	555 sys sys /sys/lib/dist/pc/multi/mc
+		mount	555 sys sys /sys/lib/dist/pc/multi/mount
+		multi	555 sys sys /sys/lib/dist/bin/386/multi
+		mv	555 sys sys /sys/lib/dist/pc/multi/mv
 #		netkey	555 sys sys
-		ps	555 sys sys
+		ps	555 sys sys /sys/lib/dist/pc/multi/ps
 		rc	555 sys sys
-		read	555 sys sys
+		read	555 sys sys /sys/lib/dist/pc/multi/read
 		rio	555 sys sys
-		rm	555 sys sys
-		sed	555 sys sys
+		rm	555 sys sys /sys/lib/dist/pc/multi/rm
+		sed	555 sys sys /sys/lib/dist/pc/multi/sed
 # snoopy could go
 # 		snoopy	555 sys sys
-		sort	555 sys sys
-		srv	555 sys sys
+		sort	555 sys sys /sys/lib/dist/pc/multi/sort
+		srv	555 sys sys /sys/lib/dist/pc/multi/srv
 #		ssh	555 sys sys
 		stats	555 sys sys
-		syscall	555 sys sys
-		tail	555 sys sys
+		syscall	555 sys sys /sys/lib/dist/pc/multi/syscall
+		tail	555 sys sys /sys/lib/dist/pc/multi/tail
 		tailfsrv	555 sys sys /sys/lib/dist/bin/386/tailfsrv
-		tee	555 sys sys
+		tee	555 sys sys /sys/lib/dist/pc/multi/tee
 #		telnet	555 sys sys
-		test	555 sys sys
-		wc	555 sys sys
-		xd	555 sys sys
+		test	555 sys sys /sys/lib/dist/pc/multi/test
+		wc	555 sys sys /sys/lib/dist/pc/multi/wc
+		xd	555 sys sys /sys/lib/dist/pc/multi/xd
 adm	d555 adm adm
 	timezone	d555 sys sys
 		local	555 sys sys

+ 3 - 0
sys/src/9/alphapc/screen.h

@@ -166,3 +166,6 @@ extern void	vgablank(VGAscr*, int);
 
 extern Lock	vgascreenlock;
 
+#define ishwimage(i)	((i)->data->bdata == vgascreen[0].gscreendata)
+
+

+ 2 - 0
sys/src/9/bitsy/screen.h

@@ -10,3 +10,5 @@ struct Cursorinfo {
 extern void	blankscreen(int);
 extern void	flushmemscreen(Rectangle);
 extern uchar*	attachscreen(Rectangle*, ulong*, int*, int*, int*);
+
+#define ishwimage(i)	0

+ 1 - 3
sys/src/9/pc/screen.h

@@ -174,6 +174,4 @@ extern void	vgablank(VGAscr*, int);
 
 extern Lock	vgascreenlock;
 
-
-
-
+#define ishwimage(i)	(vgascreen[0].gscreendata && (i)->data->bdata == vgascreen[0].gscreendata->bdata)

+ 32 - 6
sys/src/9/port/devdraw.c

@@ -876,11 +876,12 @@ drawpoint(Point *p, uchar *a)
 }
 
 Point
-drawchar(Memimage *dst, Point p, Memimage *src, Point *sp, DImage *font, int index, int op)
+drawchar(Memimage *dst, Memimage *rdst, Point p, Memimage *src, Point *sp, DImage *font, int index, int op)
 {
 	FChar *fc;
 	Rectangle r;
 	Point sp1;
+	static Memimage *tmp;
 
 	fc = &font->fchar[index];
 	r.min.x = p.x+fc->left;
@@ -889,7 +890,31 @@ drawchar(Memimage *dst, Point p, Memimage *src, Point *sp, DImage *font, int ind
 	r.max.y = r.min.y+(fc->maxy-fc->miny);
 	sp1.x = sp->x+fc->left;
 	sp1.y = sp->y+fc->miny;
-	memdraw(dst, r, src, sp1, font->image, Pt(fc->minx, fc->miny), op);
+
+	/*
+	 * If we're drawing greyscale fonts onto a VGA screen,
+	 * it's very costly to read the screen memory to do the
+	 * alpha blending inside memdraw.  If this is really a stringbg,
+	 * then rdst is the bg image (in main memory) which we can
+	 * refer to for the underlying dst pixels instead of reading dst
+	 * directly.
+	 */
+	if(ishwimage(dst) && !ishwimage(rdst) && font->image->depth > 1){
+		if(tmp == nil || tmp->chan != dst->chan || Dx(tmp->r) < Dx(r) || Dy(tmp->r) < Dy(r)){
+			if(tmp)
+				freememimage(tmp);
+			tmp = allocmemimage(Rect(0,0,Dx(r),Dy(r)), dst->chan);
+			if(tmp == nil)
+				goto fallback;
+		}
+		memdraw(tmp, Rect(0,0,Dx(r),Dy(r)), rdst, r.min, memopaque, ZP, S);
+		memdraw(tmp, Rect(0,0,Dx(r),Dy(r)), src, sp1, font->image, Pt(fc->minx, fc->miny), op);
+		memdraw(dst, r, tmp, ZP, memopaque, ZP, S);
+	}else{
+	fallback:
+		memdraw(dst, r, src, sp1, font->image, Pt(fc->minx, fc->miny), op);
+	}
+
 	p.x += fc->width;
 	sp->x += fc->width;
 	return p;
@@ -1399,7 +1424,7 @@ drawmesg(Client *client, void *av, int n)
 	ulong value, chan;
 	Rectangle r, clipr;
 	Point p, q, *pp, sp;
-	Memimage *i, *dst, *src, *mask;
+	Memimage *i, *bg, *dst, *src, *mask;
 	Memimage *l, **lp;
 	Memscreen *scrn;
 	DImage *font, *ll, *di, *ddst, *dsrc;
@@ -1936,9 +1961,10 @@ drawmesg(Client *client, void *av, int n)
 			clipr = dst->clipr;
 			dst->clipr = r;
 			op = drawclientop(client);
+			bg = dst;
 			if(*a == 'x'){
 				/* paint background */
-				l = drawimage(client, a+47);
+				bg = drawimage(client, a+47);
 				drawpoint(&q, a+51);
 				r.min.x = p.x;
 				r.min.y = p.y-font->ascent;
@@ -1954,7 +1980,7 @@ drawmesg(Client *client, void *av, int n)
 					r.max.x += font->fchar[ci].width;
 					u += 2;
 				}
-				memdraw(dst, r, l, q, memopaque, ZP, op);
+				memdraw(dst, r, bg, q, memopaque, ZP, op);
 				u -= 2*ni;
 			}
 			q = p;
@@ -1964,7 +1990,7 @@ drawmesg(Client *client, void *av, int n)
 					dst->clipr = clipr;
 					error(Eindex);
 				}
-				q = drawchar(dst, q, src, &sp, font, ci, op);
+				q = drawchar(dst, bg, q, src, &sp, font, ci, op);
 				u += 2;
 			}
 			dst->clipr = clipr;

+ 294 - 0
sys/src/cmd/aux/8prefix.c

@@ -0,0 +1,294 @@
+/*
+ * Pre-resolve references inside an object file.
+ * Mark such functions static so that linking with
+ * other object files can't get at them.
+ * Also rename "main".
+ */
+#include <u.h>
+#include <libc.h>
+#include <bio.h>
+#include "/sys/src/cmd/8c/8.out.h"
+
+typedef struct Sym Sym;
+struct Sym
+{
+	char *name;
+	char *newname;
+	short type;
+	short version;
+	Sym *link;
+};
+
+typedef struct Obj Obj;
+struct Obj
+{
+	int fd;
+	int version;
+	uchar *bp;
+	uchar *ep;
+	char *name;
+};
+
+enum
+{
+	NHASH = 10007
+};
+
+Sym *hash[NHASH];
+int nsymbol;
+int renamemain = 1;
+Sym *xsym[256];
+int version = 1;
+Obj **obj;
+int nobj;
+Biobuf bout;
+char *prefix;
+int verbose;
+
+void *emalloc(ulong);
+Sym *lookup(char*, int);
+Obj *openobj(char*);
+void walkobj(Obj*, void (*fn)(int, Sym*, uchar*, int));
+void walkobjs(void (*fn)(int, Sym*, uchar*, int));
+void dump(int, Sym*, uchar*, int);
+void nop(int, Sym*, uchar*, int);
+void owrite(int, Sym*, uchar*, int);
+int zaddr(uchar*, Sym**);
+void renamesyms(int, Sym*, uchar*, int);
+
+void
+usage(void)
+{
+	fprint(2, "usage: 8prelink [-mv] prefix file.8...\n");
+	exits("usage");
+}
+
+void
+main(int argc, char **argv)
+{
+	int i;
+	Obj *o;
+
+	ARGBEGIN{
+	case 'm':
+		renamemain = 0;
+		break;
+	case 'v':
+		verbose = 1;
+		break;
+	default:
+		usage();
+	}ARGEND
+	
+	if(argc < 2)
+		usage();
+	
+	prefix = argv[0];
+	argv++;
+	argc--;
+
+	nobj = argc;
+	obj = emalloc(nobj*sizeof obj[0]);
+	for(i=0; i<argc; i++)
+		obj[i] = openobj(argv[i]);
+
+	walkobjs(nop);	/* initialize symbol table */
+	if(verbose)
+		walkobjs(dump);
+	walkobjs(renamesyms);
+	
+	for(i=0; i<nobj; i++){
+		o = obj[i];
+		seek(o->fd, 0, 0);
+		Binit(&bout, o->fd, OWRITE);
+		walkobj(o, owrite);
+		Bflush(&bout);
+	}
+	exits(0);
+}
+
+void
+renamesyms(int op, Sym *sym, uchar*, int)
+{
+	if(sym && sym->version==0 && !sym->newname)
+	switch(op){
+	case AGLOBL:
+	case AINIT:
+	case ADATA:
+	case ATEXT:
+		if(!renamemain && strcmp(sym->name, "main") == 0)
+			break;
+		sym->newname = smprint("%s%s", prefix, sym->name);
+		break;
+	}	
+}
+
+void
+dump(int op, Sym *sym, uchar*, int)
+{
+	if(sym && sym->version==0)
+	switch(op){
+	case AGLOBL:
+	case AINIT:
+	case ADATA:
+	case ATEXT:
+		print("%s\n", sym->name);
+		break;
+	}	
+}
+
+void
+nop(int, Sym*, uchar*, int)
+{
+}
+
+void
+owrite(int op, Sym *sym, uchar *p, int l)
+{
+	switch(op){
+	case ASIGNAME:
+		Bwrite(&bout, p, 4);
+		p += 4;
+		l -= 4;
+	case ANAME:
+		if(sym->newname){
+			Bwrite(&bout, p, 4);
+			Bwrite(&bout, sym->newname, strlen(sym->newname)+1);
+			break;
+		}
+	default:
+		Bwrite(&bout, p, l);
+		break;
+	}
+}
+
+int
+zaddr(uchar *p, Sym **symp)
+{
+	int c, t;
+	
+	t = p[0];
+	c = 1;
+	if(t & T_INDEX)
+		c += 2;
+	if(t & T_OFFSET)
+		c += 4;
+	if(t & T_SYM){
+		if(symp)
+			*symp = xsym[p[c]];
+		c++;
+	}
+	if(t & T_FCONST)
+		c += 8;
+	else if(t & T_SCONST)
+		c += NSNAME;
+	if(t & T_TYPE)
+		c++;
+	return c;
+}
+
+void*
+emalloc(ulong n)
+{
+	void *v;
+	
+	v = mallocz(n, 1);
+	if(v == nil)
+		sysfatal("out of memory");
+	return v;
+}
+
+Sym*
+lookup(char *symb, int v)
+{
+	Sym *s;
+	char *p;
+	long h;
+	int l, c;
+
+	h = v;
+	for(p=symb; c = *p; p++)
+		h = h+h+h + c;
+	l = (p - symb) + 1;
+	if(h < 0)
+		h = ~h;
+	h %= NHASH;
+	for(s = hash[h]; s != nil; s = s->link)
+		if(s->version == v)
+		if(memcmp(s->name, symb, l) == 0)
+			return s;
+
+	s = emalloc(sizeof *s);
+	s->name = emalloc(l + 1);
+	memmove(s->name, symb, l);
+
+	s->link = hash[h];
+	s->type = 0;
+	s->version = v;
+	hash[h] = s;
+	nsymbol++;
+	return s;
+}
+
+Obj*
+openobj(char *name)
+{
+	Dir *d;
+	Obj *obj;
+	
+	obj = emalloc(sizeof *obj);
+	obj->name = name;
+	obj->version = version++;
+	if((obj->fd = open(name, ORDWR)) < 0)
+		sysfatal("open %s: %r", name);
+	if((d = dirfstat(obj->fd)) == nil)
+		sysfatal("dirfstat: %r");
+	obj->bp = emalloc(d->length);
+	if(readn(obj->fd, obj->bp, d->length) != d->length)
+		sysfatal("read %s: %r", name);
+	obj->ep = obj->bp+d->length;
+	return obj;
+}
+
+void
+walkobjs(void (*fn)(int, Sym*, uchar*, int))
+{
+	int i;
+	
+	for(i=0; i<nobj; i++)
+		walkobj(obj[i], fn);
+}
+
+void
+walkobj(Obj *obj, void (*fn)(int, Sym*, uchar*, int))
+{
+	int op, type;
+	Sym *sym;
+	uchar *p, *p0;
+
+	for(p=obj->bp; p+4<=obj->ep; ){
+		op = p[0] | (p[1]<<8);
+		if(op <= AXXX || op >= ALAST)
+			sysfatal("%s: opcode out of range - probably not a .8 file", obj->name);
+		p0 = p;
+		switch(op){
+		case ASIGNAME:
+			p += 4;	/* sign */
+		case ANAME:
+			type = p[2];
+			sym = lookup((char*)p+4, type==D_STATIC ? obj->version : 0);
+			xsym[p[3]] = sym;
+			p += 4+strlen(sym->name)+1;
+			fn(op, sym, p0, p-p0);
+			break;
+		
+		default:
+			p += 6;
+			p += zaddr(p, &sym);
+			p += zaddr(p, nil);
+			fn(op, sym, p0, p-p0);
+			break;
+		}
+	}
+}
+

+ 1 - 0
sys/src/cmd/aux/mkfile

@@ -1,6 +1,7 @@
 </$objtype/mkfile
 
 TARG=\
+	8prefix\
 	9pcon\
 	accupoint\
 	acidleak\