Browse Source

Plan 9 from Bell Labs 2006-03-24

David du Colombier 13 years ago
parent
commit
fa6f7eae66

+ 1 - 6
acme/bin/source/win/main.c

@@ -106,16 +106,11 @@ command(Window *w, char *s)
 {
 	while(*s==' ' || *s=='\t' || *s=='\n')
 		s++;
-	if(strcmp(s, "Delete")==0){
+	if(strcmp(s, "Delete")==0 || strcmp(s, "Del")==0){
 		windel(w, 1);
 		threadexitsall(nil);
 		return 1;
 	}
-	if(strcmp(s, "Del")==0){
-		if(windel(w, 0))
-			threadexitsall(nil);
-		return 1;
-	}
 	if(EQUAL(s, "scroll")){
 		ctlprint(w->ctl, "scroll\nshow");
 		return 1;

+ 59 - 57
dist/replica/_plan9.db

@@ -1,9 +1,9 @@
 386 - 20000000775 sys sys 1010957353 0
 386/9load - 775 sys sys 1131317303 216948
-386/9loaddebug - 775 sys sys 1141532057 312489
+386/9loaddebug - 775 sys sys 1143146512 312489
 386/9loadlite - 775 sys sys 1131317306 135668
-386/9loadlitedebug - 775 sys sys 1140726314 200137
-386/9pc - 775 sys sys 1141258200 1909853
+386/9loadlitedebug - 775 sys sys 1143146513 200137
+386/9pc - 775 sys sys 1143137104 1913157
 386/9pc.gz - 664 sys sys 1141258202 668936
 386/9pccpu - 775 sys sys 1141258205 1583315
 386/9pccpu.gz - 664 sys sys 1141258206 561499
@@ -530,7 +530,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 944969312 0
 386/lib/ape/lib9.a - 664 sys sys 1135531447 6906
-386/lib/ape/libap.a - 664 sys sys 1141271050 815700
+386/lib/ape/libap.a - 664 sys sys 1143137027 816198
 386/lib/ape/libbsd.a - 664 sys sys 1138500827 183176
 386/lib/ape/libdraw.a - 664 sys sys 1142871046 580970
 386/lib/ape/libfmt.a - 664 sys sys 1138500850 150976
@@ -539,37 +539,37 @@
 386/lib/ape/libregexp.a - 664 sys sys 1137468669 47670
 386/lib/ape/libutf.a - 664 sys sys 1137485201 84674
 386/lib/ape/libv.a - 664 sys sys 1137485201 19668
-386/lib/lib9p.a - 664 sys sys 1138500863 91156
-386/lib/libString.a - 664 sys sys 1115950150 22184
-386/lib/libauth.a - 664 sys sys 1138500895 58638
-386/lib/libauthsrv.a - 664 sys sys 1138500905 34210
-386/lib/libbin.a - 664 sys sys 1115950150 2534
-386/lib/libbio.a - 664 sys sys 1138500914 26064
-386/lib/libc.a - 664 sys sys 1141271053 502726
-386/lib/libcomplete.a - 664 sys sys 1138500945 6372
-386/lib/libcontrol.a - 664 sys sys 1138500950 274924
-386/lib/libdisk.a - 664 sys sys 1138982896 42414
-386/lib/libdraw.a - 664 sys sys 1142871047 374212
-386/lib/libflate.a - 664 sys sys 1138500991 76832
-386/lib/libframe.a - 664 sys sys 1141271054 66118
-386/lib/libgeometry.a - 664 sys sys 1115950153 50470
-386/lib/libhtml.a - 664 sys sys 1141271055 220134
-386/lib/libhttpd.a - 664 sys sys 1138501008 99586
-386/lib/libip.a - 664 sys sys 1116126324 35602
-386/lib/libl.a - 664 sys sys 1115950154 5384
-386/lib/libmach.a - 664 sys sys 1141271057 782466
-386/lib/libmemdraw.a - 664 sys sys 1138501040 284158
-386/lib/libmemlayer.a - 664 sys sys 1115950157 47360
-386/lib/libmp.a - 664 sys sys 1141616696 80024
-386/lib/libndb.a - 664 sys sys 1138501050 60716
-386/lib/libplumb.a - 664 sys sys 1138501055 19408
-386/lib/libregexp.a - 664 sys sys 1115950157 37464
-386/lib/libscribble.a - 664 sys sys 1138501058 107278
-386/lib/libsec.a - 664 sys sys 1140717392 646938
-386/lib/libstdio.a - 664 sys sys 1141271057 126186
-386/lib/libsunrpc.a - 664 sys sys 1138501070 355994
-386/lib/libthread.a - 664 sys sys 1138501077 71986
-386/lib/libventi.a - 664 sys sys 1138501085 98038
+386/lib/lib9p.a - 664 sys sys 1143137027 91156
+386/lib/libString.a - 664 sys sys 1143137027 22184
+386/lib/libauth.a - 664 sys sys 1143137027 58638
+386/lib/libauthsrv.a - 664 sys sys 1143137027 34210
+386/lib/libbin.a - 664 sys sys 1143137027 2534
+386/lib/libbio.a - 664 sys sys 1143137027 26064
+386/lib/libc.a - 664 sys sys 1143137029 503186
+386/lib/libcomplete.a - 664 sys sys 1143137029 6372
+386/lib/libcontrol.a - 664 sys sys 1143137030 274924
+386/lib/libdisk.a - 664 sys sys 1143137030 42414
+386/lib/libdraw.a - 664 sys sys 1143137032 374212
+386/lib/libflate.a - 664 sys sys 1143137032 76832
+386/lib/libframe.a - 664 sys sys 1143137032 66118
+386/lib/libgeometry.a - 664 sys sys 1143137033 50470
+386/lib/libhtml.a - 664 sys sys 1143137034 220134
+386/lib/libhttpd.a - 664 sys sys 1143137034 99586
+386/lib/libip.a - 664 sys sys 1143137034 35602
+386/lib/libl.a - 664 sys sys 1143137034 5384
+386/lib/libmach.a - 664 sys sys 1143137036 782466
+386/lib/libmemdraw.a - 664 sys sys 1143137037 284158
+386/lib/libmemlayer.a - 664 sys sys 1143137037 47360
+386/lib/libmp.a - 664 sys sys 1143137037 80024
+386/lib/libndb.a - 664 sys sys 1143137038 60716
+386/lib/libplumb.a - 664 sys sys 1143137038 19408
+386/lib/libregexp.a - 664 sys sys 1143137038 37464
+386/lib/libscribble.a - 664 sys sys 1143137038 107278
+386/lib/libsec.a - 664 sys sys 1143137040 646938
+386/lib/libstdio.a - 664 sys sys 1143137040 126186
+386/lib/libsunrpc.a - 664 sys sys 1143137041 355994
+386/lib/libthread.a - 664 sys sys 1143137041 71986
+386/lib/libventi.a - 664 sys sys 1143137042 98038
 386/mbr - 775 sys sys 1131317338 407
 386/mkfile - 664 sys sys 948141303 46
 386/pbs - 775 sys sys 1131317339 494
@@ -631,7 +631,7 @@ acme/bin/386/acd - 775 sys sys 1032232412 137068
 acme/bin/386/adict - 775 sys sys 1015011247 99806
 acme/bin/386/mkwnew - 775 sys sys 1130384395 38977
 acme/bin/386/spout - 775 sys sys 1135570856 61598
-acme/bin/386/win - 775 sys sys 1138500797 185035
+acme/bin/386/win - 775 sys sys 1143137024 184985
 acme/bin/Battery - 775 sys sys 1017457907 451
 acme/bin/Isspam - 775 sys sys 1063951165 235
 acme/bin/Mail - 775 sys sys 1114697798 201
@@ -684,7 +684,7 @@ acme/bin/source/spout.c - 664 sys sys 1015011255 1868
 acme/bin/source/win - 20000000775 sys sys 1015011255 0
 acme/bin/source/win/dat.h - 664 sys sys 1017679345 1992
 acme/bin/source/win/fs.c - 664 sys sys 1045503982 2713
-acme/bin/source/win/main.c - 664 sys sys 1104430370 12508
+acme/bin/source/win/main.c - 664 sys sys 1143126825 12447
 acme/bin/source/win/mkfile - 664 sys sys 1046654934 309
 acme/bin/source/win/pipe.c - 664 sys sys 1104430371 2802
 acme/bin/source/win/util.c - 664 sys sys 1017679346 1169
@@ -5535,7 +5535,7 @@ rc/bin/spell - 775 sys sys 964540791 312
 rc/bin/src - 775 sys sys 1084333365 916
 rc/bin/srvssh - 775 sys sys 1112039374 2296
 rc/bin/start - 775 sys sys 945617209 120
-rc/bin/stock - 775 sys sys 1055701355 288
+rc/bin/stock - 775 sys sys 1143126371 292
 rc/bin/stop - 775 sys sys 945617209 110
 rc/bin/tel - 775 sys sys 1019854296 136
 rc/bin/termrc - 775 sys sys 1125835735 2653
@@ -6007,7 +6007,7 @@ sys/include/html.h - 664 sys sys 1128662123 15232
 sys/include/httpd.h - 664 sys sys 1091904418 5771
 sys/include/ip.h - 664 sys sys 1103554773 2989
 sys/include/keyboard.h - 664 sys sys 1131637696 865
-sys/include/libc.h - 664 sys sys 1135487938 19627
+sys/include/libc.h - 664 sys sys 1143129918 19699
 sys/include/libsec.h - 664 sys sys 1124709121 9345
 sys/include/mach.h - 664 sys sys 1138471011 8621
 sys/include/memdraw.h - 664 sys sys 1091904419 5645
@@ -6047,7 +6047,7 @@ sys/lib/acid/power - 664 sys sys 969499633 3058
 sys/lib/acid/sparc - 664 sys sys 944955986 5339
 sys/lib/acid/sparc64 - 664 sys sys 1114524607 5441
 sys/lib/acid/syscall - 664 sys sys 1016926088 5353
-sys/lib/acid/thread - 664 sys sys 1140694878 6143
+sys/lib/acid/thread - 664 sys sys 1143129753 6163
 sys/lib/acid/transcript - 775 sys sys 954614670 752
 sys/lib/acid/trump - 664 sys sys 1014924361 3177
 sys/lib/acid/truss - 664 sys sys 1036381004 5271
@@ -7371,7 +7371,7 @@ sys/man/1/syscall - 664 sys sys 1016466457 1439
 sys/man/1/tail - 664 sys sys 1113743327 1413
 sys/man/1/tar - 664 sys sys 1131884436 3439
 sys/man/1/tbl - 664 sys sys 944959674 4308
-sys/man/1/tcs - 664 sys sys 1138383991 2682
+sys/man/1/tcs - 664 sys sys 1143131200 2654
 sys/man/1/tee - 664 sys sys 969499886 351
 sys/man/1/tel - 664 sys sys 1045501423 941
 sys/man/1/test - 664 sys sys 1079372544 3535
@@ -7527,6 +7527,7 @@ sys/man/2/seek - 664 sys sys 944959696 671
 sys/man/2/segattach - 664 sys sys 1135487945 4166
 sys/man/2/segbrk - 664 sys sys 1135487945 1195
 sys/man/2/segflush - 664 sys sys 944959695 944
+sys/man/2/semacquire - 664 sys sys 1143134715 1865
 sys/man/2/setjmp - 664 sys sys 1125540984 1857
 sys/man/2/sin - 664 sys sys 944959694 967
 sys/man/2/sinh - 664 sys sys 944959694 360
@@ -7778,14 +7779,14 @@ sys/src/9/alphapc/etherif.h - 664 sys sys 1045063621 1025
 sys/src/9/alphapc/faultalpha.c - 664 sys sys 1015012784 1257
 sys/src/9/alphapc/fdc37c93x.c - 664 sys sys 1015012785 1110
 sys/src/9/alphapc/floppy.h - 664 sys sys 1015012785 3783
-sys/src/9/alphapc/fns.h - 664 sys sys 1131289707 3613
+sys/src/9/alphapc/fns.h - 664 sys sys 1143129891 3626
 sys/src/9/alphapc/fptrap.c - 664 sys sys 1015012785 707
 sys/src/9/alphapc/i8259.c - 664 sys sys 1015012785 3409
 sys/src/9/alphapc/initcode - 664 sys sys 1039753419 779
 sys/src/9/alphapc/io.h - 664 sys sys 1137179966 4618
 sys/src/9/alphapc/kbd.c - 664 sys sys 1015012785 8676
-sys/src/9/alphapc/l.s - 664 sys sys 1137179966 9141
-sys/src/9/alphapc/main.c - 664 sys sys 1137179966 13675
+sys/src/9/alphapc/l.s - 664 sys sys 1143129848 9367
+sys/src/9/alphapc/main.c - 664 sys sys 1143129763 13748
 sys/src/9/alphapc/mem.h - 664 sys sys 1137179967 2312
 sys/src/9/alphapc/memmove.s - 664 sys sys 1015012786 2936
 sys/src/9/alphapc/memset.s - 664 sys sys 1015012786 844
@@ -7802,7 +7803,7 @@ sys/src/9/bitsy/Booting101 - 664 sys sys 1054798506 8841
 sys/src/9/bitsy/bitsy - 664 sys sys 1067722592 424
 sys/src/9/bitsy/bitsyreset.s - 664 sys sys 1017695510 2352
 sys/src/9/bitsy/clock.c - 664 sys sys 1037028998 4835
-sys/src/9/bitsy/dat.h - 664 sys sys 1138500731 5941
+sys/src/9/bitsy/dat.h - 664 sys sys 1143129783 5829
 sys/src/9/bitsy/defont.c - 664 sys sys 1017695511 21570
 sys/src/9/bitsy/devether.c - 664 sys sys 1116097769 10675
 sys/src/9/bitsy/devflash.c - 664 sys sys 1138500612 16830
@@ -7812,7 +7813,7 @@ sys/src/9/bitsy/devuda1341.c - 664 sys sys 1071245420 30346
 sys/src/9/bitsy/devµc.c - 664 sys sys 1068393562 8125
 sys/src/9/bitsy/etherif.h - 664 sys sys 1045501788 913
 sys/src/9/bitsy/etherwavelan.c - 664 sys sys 1071245513 870
-sys/src/9/bitsy/fns.h - 664 sys sys 1111851542 3018
+sys/src/9/bitsy/fns.h - 664 sys sys 1143129861 3063
 sys/src/9/bitsy/fpi.c - 664 sys sys 1017695513 5248
 sys/src/9/bitsy/fpi.h - 664 sys sys 1017695513 1679
 sys/src/9/bitsy/fpiarm.c - 664 sys sys 1017695513 9328
@@ -7822,7 +7823,7 @@ sys/src/9/bitsy/gamma.h - 664 sys sys 1017695514 540718
 sys/src/9/bitsy/init9.s - 664 sys sys 1043922398 183
 sys/src/9/bitsy/io.h - 664 sys sys 1064584624 8040
 sys/src/9/bitsy/l.s - 664 sys sys 1055700934 18211
-sys/src/9/bitsy/main.c - 664 sys sys 1131289775 8816
+sys/src/9/bitsy/main.c - 664 sys sys 1143129874 8951
 sys/src/9/bitsy/map - 664 sys sys 1017695515 236
 sys/src/9/bitsy/mem.h - 664 sys sys 1055700932 8049
 sys/src/9/bitsy/mkfile - 664 sys sys 1131289775 2459
@@ -7908,13 +7909,13 @@ sys/src/9/mtx/devether.c - 664 sys sys 1116097786 9281
 sys/src/9/mtx/devrtc.c - 664 sys sys 1018721285 6772
 sys/src/9/mtx/ether2114x.c - 664 sys sys 1026848191 37904
 sys/src/9/mtx/etherif.h - 664 sys sys 1045504432 785
-sys/src/9/mtx/fns.h - 664 sys sys 1111851554 2722
+sys/src/9/mtx/fns.h - 664 sys sys 1143129832 2767
 sys/src/9/mtx/i8259.c - 664 sys sys 1018721286 4695
 sys/src/9/mtx/inb.s - 664 sys sys 1018721286 1476
 sys/src/9/mtx/initcode - 664 sys sys 1039753442 444
 sys/src/9/mtx/io.h - 664 sys sys 1087657404 4817
 sys/src/9/mtx/kbd.c - 664 sys sys 1018721286 8358
-sys/src/9/mtx/l.s - 664 sys sys 1067722599 10730
+sys/src/9/mtx/l.s - 664 sys sys 1143129840 11000
 sys/src/9/mtx/main.c - 664 sys sys 1131289814 8307
 sys/src/9/mtx/mem.h - 664 sys sys 1026848200 5959
 sys/src/9/mtx/mkfile - 664 sys sys 1072972534 1520
@@ -7935,7 +7936,7 @@ sys/src/9/pc/archmp.c - 664 sys sys 1131290214 2357
 sys/src/9/pc/audio.h - 664 sys sys 1015014513 343
 sys/src/9/pc/cga.c - 664 sys sys 1015014513 1843
 sys/src/9/pc/dat.h - 664 sys sys 1142958313 6628
-sys/src/9/pc/devarch.c - 664 sys sys 1136048694 18625
+sys/src/9/pc/devarch.c - 664 sys sys 1143129812 19249
 sys/src/9/pc/devether.c - 664 sys sys 1131290265 10315
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devi82365.c - 664 sys sys 1099761153 20505
@@ -7977,7 +7978,7 @@ sys/src/9/pc/ethervgbe.c - 664 sys sys 1138114457 26558
 sys/src/9/pc/ethervt6102.c - 664 sys sys 1131907459 22286
 sys/src/9/pc/etherwavelan.c - 664 sys sys 1131290380 3747
 sys/src/9/pc/floppy.h - 664 sys sys 1055700609 3835
-sys/src/9/pc/fns.h - 664 sys sys 1131290383 4461
+sys/src/9/pc/fns.h - 664 sys sys 1143129956 4531
 sys/src/9/pc/hcwAMC.h - 664 sys sys 1026860163 166004
 sys/src/9/pc/i8253.c - 664 sys sys 1139681387 6236
 sys/src/9/pc/i8259.c - 664 sys sys 1131290399 4586
@@ -7985,7 +7986,7 @@ 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 1099761152 8095
 sys/src/9/pc/kbd.c - 664 sys sys 1132574883 12365
-sys/src/9/pc/l.s - 664 sys sys 1131290403 28347
+sys/src/9/pc/l.s - 664 sys sys 1143129925 28552
 sys/src/9/pc/main.c - 664 sys sys 1142958321 15304
 sys/src/9/pc/mem.h - 664 sys sys 1137622431 5203
 sys/src/9/pc/memory.c - 664 sys sys 1131573303 18191
@@ -8121,7 +8122,7 @@ sys/src/9/port/page.c - 664 sys sys 1131636090 11128
 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 1138458385 4211
-sys/src/9/port/portdat.h - 664 sys sys 1138458366 22535
+sys/src/9/port/portdat.h - 664 sys sys 1143129883 22669
 sys/src/9/port/portfns.h - 664 sys sys 1138469535 11079
 sys/src/9/port/portmkfile - 664 sys sys 1131907975 2062
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
@@ -8131,10 +8132,11 @@ sys/src/9/port/qlock.c - 664 sys sys 1139666988 3200
 sys/src/9/port/rdb.c - 664 sys sys 1018721202 1698
 sys/src/9/port/rebootcmd.c - 664 sys sys 1015278340 1561
 sys/src/9/port/sd.h - 664 sys sys 1134411408 2494
-sys/src/9/port/segment.c - 664 sys sys 1138749368 13939
+sys/src/9/port/segment.c - 664 sys sys 1143129964 13992
+sys/src/9/port/semaphore.p - 664 sys sys 1143129797 2424
 sys/src/9/port/swap.c - 664 sys sys 1138028310 7019
 sys/src/9/port/sysfile.c - 664 sys sys 1141940070 22192
-sys/src/9/port/sysproc.c - 664 sys sys 1137622456 15153
+sys/src/9/port/sysproc.c - 664 sys sys 1143129796 21535
 sys/src/9/port/taslock.c - 664 sys sys 1142957865 3928
 sys/src/9/port/thwack.c - 664 sys sys 1057323394 7253
 sys/src/9/port/thwack.h - 664 sys sys 1015278340 1792
@@ -13385,7 +13387,7 @@ sys/src/cmd/tcs/mkfile - 664 sys sys 1138382781 591
 sys/src/cmd/tcs/ms.h - 664 sys sys 1138382780 44069
 sys/src/cmd/tcs/plan9.h - 664 sys sys 944961287 751
 sys/src/cmd/tcs/tcs.c - 664 sys sys 1138382781 15489
-sys/src/cmd/tcs/utf.c - 664 sys sys 1125501123 7962
+sys/src/cmd/tcs/utf.c - 664 sys sys 1143131195 7907
 sys/src/cmd/tee.c - 664 sys sys 954970286 1062
 sys/src/cmd/telco - 20000000775 sys sys 1015701205 0
 sys/src/cmd/telco/mkfile - 664 sys sys 944961290 201
@@ -14758,7 +14760,7 @@ sys/src/libc/9sys/write.c - 664 sys sys 1014927340 110
 sys/src/libc/9sys/writev.c - 664 sys sys 1014927340 577
 sys/src/libc/9syscall - 20000000775 sys sys 1014927373 0
 sys/src/libc/9syscall/mkfile - 664 sys sys 1130424755 2625
-sys/src/libc/9syscall/sys.h - 664 sys sys 1115933472 883
+sys/src/libc/9syscall/sys.h - 664 sys sys 1143129935 927
 sys/src/libc/alpha - 20000000775 sys sys 984709299 0
 sys/src/libc/alpha/_seek.c - 664 sys sys 1130424714 180
 sys/src/libc/alpha/argv0.s - 664 sys sys 1067718982 88

+ 59 - 57
dist/replica/plan9.db

@@ -1,9 +1,9 @@
 386 - 20000000775 sys sys 1010957353 0
 386/9load - 775 sys sys 1131317303 216948
-386/9loaddebug - 775 sys sys 1141532057 312489
+386/9loaddebug - 775 sys sys 1143146512 312489
 386/9loadlite - 775 sys sys 1131317306 135668
-386/9loadlitedebug - 775 sys sys 1140726314 200137
-386/9pc - 775 sys sys 1141258200 1909853
+386/9loadlitedebug - 775 sys sys 1143146513 200137
+386/9pc - 775 sys sys 1143137104 1913157
 386/9pc.gz - 664 sys sys 1141258202 668936
 386/9pccpu - 775 sys sys 1141258205 1583315
 386/9pccpu.gz - 664 sys sys 1141258206 561499
@@ -530,7 +530,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 944969312 0
 386/lib/ape/lib9.a - 664 sys sys 1135531447 6906
-386/lib/ape/libap.a - 664 sys sys 1141271050 815700
+386/lib/ape/libap.a - 664 sys sys 1143137027 816198
 386/lib/ape/libbsd.a - 664 sys sys 1138500827 183176
 386/lib/ape/libdraw.a - 664 sys sys 1142871046 580970
 386/lib/ape/libfmt.a - 664 sys sys 1138500850 150976
@@ -539,37 +539,37 @@
 386/lib/ape/libregexp.a - 664 sys sys 1137468669 47670
 386/lib/ape/libutf.a - 664 sys sys 1137485201 84674
 386/lib/ape/libv.a - 664 sys sys 1137485201 19668
-386/lib/lib9p.a - 664 sys sys 1138500863 91156
-386/lib/libString.a - 664 sys sys 1115950150 22184
-386/lib/libauth.a - 664 sys sys 1138500895 58638
-386/lib/libauthsrv.a - 664 sys sys 1138500905 34210
-386/lib/libbin.a - 664 sys sys 1115950150 2534
-386/lib/libbio.a - 664 sys sys 1138500914 26064
-386/lib/libc.a - 664 sys sys 1141271053 502726
-386/lib/libcomplete.a - 664 sys sys 1138500945 6372
-386/lib/libcontrol.a - 664 sys sys 1138500950 274924
-386/lib/libdisk.a - 664 sys sys 1138982896 42414
-386/lib/libdraw.a - 664 sys sys 1142871047 374212
-386/lib/libflate.a - 664 sys sys 1138500991 76832
-386/lib/libframe.a - 664 sys sys 1141271054 66118
-386/lib/libgeometry.a - 664 sys sys 1115950153 50470
-386/lib/libhtml.a - 664 sys sys 1141271055 220134
-386/lib/libhttpd.a - 664 sys sys 1138501008 99586
-386/lib/libip.a - 664 sys sys 1116126324 35602
-386/lib/libl.a - 664 sys sys 1115950154 5384
-386/lib/libmach.a - 664 sys sys 1141271057 782466
-386/lib/libmemdraw.a - 664 sys sys 1138501040 284158
-386/lib/libmemlayer.a - 664 sys sys 1115950157 47360
-386/lib/libmp.a - 664 sys sys 1141616696 80024
-386/lib/libndb.a - 664 sys sys 1138501050 60716
-386/lib/libplumb.a - 664 sys sys 1138501055 19408
-386/lib/libregexp.a - 664 sys sys 1115950157 37464
-386/lib/libscribble.a - 664 sys sys 1138501058 107278
-386/lib/libsec.a - 664 sys sys 1140717392 646938
-386/lib/libstdio.a - 664 sys sys 1141271057 126186
-386/lib/libsunrpc.a - 664 sys sys 1138501070 355994
-386/lib/libthread.a - 664 sys sys 1138501077 71986
-386/lib/libventi.a - 664 sys sys 1138501085 98038
+386/lib/lib9p.a - 664 sys sys 1143137027 91156
+386/lib/libString.a - 664 sys sys 1143137027 22184
+386/lib/libauth.a - 664 sys sys 1143137027 58638
+386/lib/libauthsrv.a - 664 sys sys 1143137027 34210
+386/lib/libbin.a - 664 sys sys 1143137027 2534
+386/lib/libbio.a - 664 sys sys 1143137027 26064
+386/lib/libc.a - 664 sys sys 1143137029 503186
+386/lib/libcomplete.a - 664 sys sys 1143137029 6372
+386/lib/libcontrol.a - 664 sys sys 1143137030 274924
+386/lib/libdisk.a - 664 sys sys 1143137030 42414
+386/lib/libdraw.a - 664 sys sys 1143137032 374212
+386/lib/libflate.a - 664 sys sys 1143137032 76832
+386/lib/libframe.a - 664 sys sys 1143137032 66118
+386/lib/libgeometry.a - 664 sys sys 1143137033 50470
+386/lib/libhtml.a - 664 sys sys 1143137034 220134
+386/lib/libhttpd.a - 664 sys sys 1143137034 99586
+386/lib/libip.a - 664 sys sys 1143137034 35602
+386/lib/libl.a - 664 sys sys 1143137034 5384
+386/lib/libmach.a - 664 sys sys 1143137036 782466
+386/lib/libmemdraw.a - 664 sys sys 1143137037 284158
+386/lib/libmemlayer.a - 664 sys sys 1143137037 47360
+386/lib/libmp.a - 664 sys sys 1143137037 80024
+386/lib/libndb.a - 664 sys sys 1143137038 60716
+386/lib/libplumb.a - 664 sys sys 1143137038 19408
+386/lib/libregexp.a - 664 sys sys 1143137038 37464
+386/lib/libscribble.a - 664 sys sys 1143137038 107278
+386/lib/libsec.a - 664 sys sys 1143137040 646938
+386/lib/libstdio.a - 664 sys sys 1143137040 126186
+386/lib/libsunrpc.a - 664 sys sys 1143137041 355994
+386/lib/libthread.a - 664 sys sys 1143137041 71986
+386/lib/libventi.a - 664 sys sys 1143137042 98038
 386/mbr - 775 sys sys 1131317338 407
 386/mkfile - 664 sys sys 948141303 46
 386/pbs - 775 sys sys 1131317339 494
@@ -631,7 +631,7 @@ acme/bin/386/acd - 775 sys sys 1032232412 137068
 acme/bin/386/adict - 775 sys sys 1015011247 99806
 acme/bin/386/mkwnew - 775 sys sys 1130384395 38977
 acme/bin/386/spout - 775 sys sys 1135570856 61598
-acme/bin/386/win - 775 sys sys 1138500797 185035
+acme/bin/386/win - 775 sys sys 1143137024 184985
 acme/bin/Battery - 775 sys sys 1017457907 451
 acme/bin/Isspam - 775 sys sys 1063951165 235
 acme/bin/Mail - 775 sys sys 1114697798 201
@@ -684,7 +684,7 @@ acme/bin/source/spout.c - 664 sys sys 1015011255 1868
 acme/bin/source/win - 20000000775 sys sys 1015011255 0
 acme/bin/source/win/dat.h - 664 sys sys 1017679345 1992
 acme/bin/source/win/fs.c - 664 sys sys 1045503982 2713
-acme/bin/source/win/main.c - 664 sys sys 1104430370 12508
+acme/bin/source/win/main.c - 664 sys sys 1143126825 12447
 acme/bin/source/win/mkfile - 664 sys sys 1046654934 309
 acme/bin/source/win/pipe.c - 664 sys sys 1104430371 2802
 acme/bin/source/win/util.c - 664 sys sys 1017679346 1169
@@ -5535,7 +5535,7 @@ rc/bin/spell - 775 sys sys 964540791 312
 rc/bin/src - 775 sys sys 1084333365 916
 rc/bin/srvssh - 775 sys sys 1112039374 2296
 rc/bin/start - 775 sys sys 945617209 120
-rc/bin/stock - 775 sys sys 1055701355 288
+rc/bin/stock - 775 sys sys 1143126371 292
 rc/bin/stop - 775 sys sys 945617209 110
 rc/bin/tel - 775 sys sys 1019854296 136
 rc/bin/termrc - 775 sys sys 1125835735 2653
@@ -6007,7 +6007,7 @@ sys/include/html.h - 664 sys sys 1128662123 15232
 sys/include/httpd.h - 664 sys sys 1091904418 5771
 sys/include/ip.h - 664 sys sys 1103554773 2989
 sys/include/keyboard.h - 664 sys sys 1131637696 865
-sys/include/libc.h - 664 sys sys 1135487938 19627
+sys/include/libc.h - 664 sys sys 1143129918 19699
 sys/include/libsec.h - 664 sys sys 1124709121 9345
 sys/include/mach.h - 664 sys sys 1138471011 8621
 sys/include/memdraw.h - 664 sys sys 1091904419 5645
@@ -6047,7 +6047,7 @@ sys/lib/acid/power - 664 sys sys 969499633 3058
 sys/lib/acid/sparc - 664 sys sys 944955986 5339
 sys/lib/acid/sparc64 - 664 sys sys 1114524607 5441
 sys/lib/acid/syscall - 664 sys sys 1016926088 5353
-sys/lib/acid/thread - 664 sys sys 1140694878 6143
+sys/lib/acid/thread - 664 sys sys 1143129753 6163
 sys/lib/acid/transcript - 775 sys sys 954614670 752
 sys/lib/acid/trump - 664 sys sys 1014924361 3177
 sys/lib/acid/truss - 664 sys sys 1036381004 5271
@@ -7371,7 +7371,7 @@ sys/man/1/syscall - 664 sys sys 1016466457 1439
 sys/man/1/tail - 664 sys sys 1113743327 1413
 sys/man/1/tar - 664 sys sys 1131884436 3439
 sys/man/1/tbl - 664 sys sys 944959674 4308
-sys/man/1/tcs - 664 sys sys 1138383991 2682
+sys/man/1/tcs - 664 sys sys 1143131200 2654
 sys/man/1/tee - 664 sys sys 969499886 351
 sys/man/1/tel - 664 sys sys 1045501423 941
 sys/man/1/test - 664 sys sys 1079372544 3535
@@ -7527,6 +7527,7 @@ sys/man/2/seek - 664 sys sys 944959696 671
 sys/man/2/segattach - 664 sys sys 1135487945 4166
 sys/man/2/segbrk - 664 sys sys 1135487945 1195
 sys/man/2/segflush - 664 sys sys 944959695 944
+sys/man/2/semacquire - 664 sys sys 1143134715 1865
 sys/man/2/setjmp - 664 sys sys 1125540984 1857
 sys/man/2/sin - 664 sys sys 944959694 967
 sys/man/2/sinh - 664 sys sys 944959694 360
@@ -7778,14 +7779,14 @@ sys/src/9/alphapc/etherif.h - 664 sys sys 1045063621 1025
 sys/src/9/alphapc/faultalpha.c - 664 sys sys 1015012784 1257
 sys/src/9/alphapc/fdc37c93x.c - 664 sys sys 1015012785 1110
 sys/src/9/alphapc/floppy.h - 664 sys sys 1015012785 3783
-sys/src/9/alphapc/fns.h - 664 sys sys 1131289707 3613
+sys/src/9/alphapc/fns.h - 664 sys sys 1143129891 3626
 sys/src/9/alphapc/fptrap.c - 664 sys sys 1015012785 707
 sys/src/9/alphapc/i8259.c - 664 sys sys 1015012785 3409
 sys/src/9/alphapc/initcode - 664 sys sys 1039753419 779
 sys/src/9/alphapc/io.h - 664 sys sys 1137179966 4618
 sys/src/9/alphapc/kbd.c - 664 sys sys 1015012785 8676
-sys/src/9/alphapc/l.s - 664 sys sys 1137179966 9141
-sys/src/9/alphapc/main.c - 664 sys sys 1137179966 13675
+sys/src/9/alphapc/l.s - 664 sys sys 1143129848 9367
+sys/src/9/alphapc/main.c - 664 sys sys 1143129763 13748
 sys/src/9/alphapc/mem.h - 664 sys sys 1137179967 2312
 sys/src/9/alphapc/memmove.s - 664 sys sys 1015012786 2936
 sys/src/9/alphapc/memset.s - 664 sys sys 1015012786 844
@@ -7802,7 +7803,7 @@ sys/src/9/bitsy/Booting101 - 664 sys sys 1054798506 8841
 sys/src/9/bitsy/bitsy - 664 sys sys 1067722592 424
 sys/src/9/bitsy/bitsyreset.s - 664 sys sys 1017695510 2352
 sys/src/9/bitsy/clock.c - 664 sys sys 1037028998 4835
-sys/src/9/bitsy/dat.h - 664 sys sys 1138500731 5941
+sys/src/9/bitsy/dat.h - 664 sys sys 1143129783 5829
 sys/src/9/bitsy/defont.c - 664 sys sys 1017695511 21570
 sys/src/9/bitsy/devether.c - 664 sys sys 1116097769 10675
 sys/src/9/bitsy/devflash.c - 664 sys sys 1138500612 16830
@@ -7812,7 +7813,7 @@ sys/src/9/bitsy/devuda1341.c - 664 sys sys 1071245420 30346
 sys/src/9/bitsy/devµc.c - 664 sys sys 1068393562 8125
 sys/src/9/bitsy/etherif.h - 664 sys sys 1045501788 913
 sys/src/9/bitsy/etherwavelan.c - 664 sys sys 1071245513 870
-sys/src/9/bitsy/fns.h - 664 sys sys 1111851542 3018
+sys/src/9/bitsy/fns.h - 664 sys sys 1143129861 3063
 sys/src/9/bitsy/fpi.c - 664 sys sys 1017695513 5248
 sys/src/9/bitsy/fpi.h - 664 sys sys 1017695513 1679
 sys/src/9/bitsy/fpiarm.c - 664 sys sys 1017695513 9328
@@ -7822,7 +7823,7 @@ sys/src/9/bitsy/gamma.h - 664 sys sys 1017695514 540718
 sys/src/9/bitsy/init9.s - 664 sys sys 1043922398 183
 sys/src/9/bitsy/io.h - 664 sys sys 1064584624 8040
 sys/src/9/bitsy/l.s - 664 sys sys 1055700934 18211
-sys/src/9/bitsy/main.c - 664 sys sys 1131289775 8816
+sys/src/9/bitsy/main.c - 664 sys sys 1143129874 8951
 sys/src/9/bitsy/map - 664 sys sys 1017695515 236
 sys/src/9/bitsy/mem.h - 664 sys sys 1055700932 8049
 sys/src/9/bitsy/mkfile - 664 sys sys 1131289775 2459
@@ -7908,13 +7909,13 @@ sys/src/9/mtx/devether.c - 664 sys sys 1116097786 9281
 sys/src/9/mtx/devrtc.c - 664 sys sys 1018721285 6772
 sys/src/9/mtx/ether2114x.c - 664 sys sys 1026848191 37904
 sys/src/9/mtx/etherif.h - 664 sys sys 1045504432 785
-sys/src/9/mtx/fns.h - 664 sys sys 1111851554 2722
+sys/src/9/mtx/fns.h - 664 sys sys 1143129832 2767
 sys/src/9/mtx/i8259.c - 664 sys sys 1018721286 4695
 sys/src/9/mtx/inb.s - 664 sys sys 1018721286 1476
 sys/src/9/mtx/initcode - 664 sys sys 1039753442 444
 sys/src/9/mtx/io.h - 664 sys sys 1087657404 4817
 sys/src/9/mtx/kbd.c - 664 sys sys 1018721286 8358
-sys/src/9/mtx/l.s - 664 sys sys 1067722599 10730
+sys/src/9/mtx/l.s - 664 sys sys 1143129840 11000
 sys/src/9/mtx/main.c - 664 sys sys 1131289814 8307
 sys/src/9/mtx/mem.h - 664 sys sys 1026848200 5959
 sys/src/9/mtx/mkfile - 664 sys sys 1072972534 1520
@@ -7935,7 +7936,7 @@ sys/src/9/pc/archmp.c - 664 sys sys 1131290214 2357
 sys/src/9/pc/audio.h - 664 sys sys 1015014513 343
 sys/src/9/pc/cga.c - 664 sys sys 1015014513 1843
 sys/src/9/pc/dat.h - 664 sys sys 1142958313 6628
-sys/src/9/pc/devarch.c - 664 sys sys 1136048694 18625
+sys/src/9/pc/devarch.c - 664 sys sys 1143129812 19249
 sys/src/9/pc/devether.c - 664 sys sys 1131290265 10315
 sys/src/9/pc/devfloppy.c - 664 sys sys 1142958305 20139
 sys/src/9/pc/devi82365.c - 664 sys sys 1099761153 20505
@@ -7977,7 +7978,7 @@ sys/src/9/pc/ethervgbe.c - 664 sys sys 1138114457 26558
 sys/src/9/pc/ethervt6102.c - 664 sys sys 1131907459 22286
 sys/src/9/pc/etherwavelan.c - 664 sys sys 1131290380 3747
 sys/src/9/pc/floppy.h - 664 sys sys 1055700609 3835
-sys/src/9/pc/fns.h - 664 sys sys 1131290383 4461
+sys/src/9/pc/fns.h - 664 sys sys 1143129956 4531
 sys/src/9/pc/hcwAMC.h - 664 sys sys 1026860163 166004
 sys/src/9/pc/i8253.c - 664 sys sys 1139681387 6236
 sys/src/9/pc/i8259.c - 664 sys sys 1131290399 4586
@@ -7985,7 +7986,7 @@ 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 1099761152 8095
 sys/src/9/pc/kbd.c - 664 sys sys 1132574883 12365
-sys/src/9/pc/l.s - 664 sys sys 1131290403 28347
+sys/src/9/pc/l.s - 664 sys sys 1143129925 28552
 sys/src/9/pc/main.c - 664 sys sys 1142958321 15304
 sys/src/9/pc/mem.h - 664 sys sys 1137622431 5203
 sys/src/9/pc/memory.c - 664 sys sys 1131573303 18191
@@ -8121,7 +8122,7 @@ sys/src/9/port/page.c - 664 sys sys 1131636090 11128
 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 1138458385 4211
-sys/src/9/port/portdat.h - 664 sys sys 1138458366 22535
+sys/src/9/port/portdat.h - 664 sys sys 1143129883 22669
 sys/src/9/port/portfns.h - 664 sys sys 1138469535 11079
 sys/src/9/port/portmkfile - 664 sys sys 1131907975 2062
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
@@ -8131,10 +8132,11 @@ sys/src/9/port/qlock.c - 664 sys sys 1139666988 3200
 sys/src/9/port/rdb.c - 664 sys sys 1018721202 1698
 sys/src/9/port/rebootcmd.c - 664 sys sys 1015278340 1561
 sys/src/9/port/sd.h - 664 sys sys 1134411408 2494
-sys/src/9/port/segment.c - 664 sys sys 1138749368 13939
+sys/src/9/port/segment.c - 664 sys sys 1143129964 13992
+sys/src/9/port/semaphore.p - 664 sys sys 1143129797 2424
 sys/src/9/port/swap.c - 664 sys sys 1138028310 7019
 sys/src/9/port/sysfile.c - 664 sys sys 1141940070 22192
-sys/src/9/port/sysproc.c - 664 sys sys 1137622456 15153
+sys/src/9/port/sysproc.c - 664 sys sys 1143129796 21535
 sys/src/9/port/taslock.c - 664 sys sys 1142957865 3928
 sys/src/9/port/thwack.c - 664 sys sys 1057323394 7253
 sys/src/9/port/thwack.h - 664 sys sys 1015278340 1792
@@ -13385,7 +13387,7 @@ sys/src/cmd/tcs/mkfile - 664 sys sys 1138382781 591
 sys/src/cmd/tcs/ms.h - 664 sys sys 1138382780 44069
 sys/src/cmd/tcs/plan9.h - 664 sys sys 944961287 751
 sys/src/cmd/tcs/tcs.c - 664 sys sys 1138382781 15489
-sys/src/cmd/tcs/utf.c - 664 sys sys 1125501123 7962
+sys/src/cmd/tcs/utf.c - 664 sys sys 1143131195 7907
 sys/src/cmd/tee.c - 664 sys sys 954970286 1062
 sys/src/cmd/telco - 20000000775 sys sys 1015701205 0
 sys/src/cmd/telco/mkfile - 664 sys sys 944961290 201
@@ -14758,7 +14760,7 @@ sys/src/libc/9sys/write.c - 664 sys sys 1014927340 110
 sys/src/libc/9sys/writev.c - 664 sys sys 1014927340 577
 sys/src/libc/9syscall - 20000000775 sys sys 1014927373 0
 sys/src/libc/9syscall/mkfile - 664 sys sys 1130424755 2625
-sys/src/libc/9syscall/sys.h - 664 sys sys 1115933472 883
+sys/src/libc/9syscall/sys.h - 664 sys sys 1143129935 927
 sys/src/libc/alpha - 20000000775 sys sys 984709299 0
 sys/src/libc/alpha/_seek.c - 664 sys sys 1130424714 180
 sys/src/libc/alpha/argv0.s - 664 sys sys 1067718982 88

+ 60 - 0
dist/replica/plan9.log

@@ -28120,3 +28120,63 @@
 1142967714 0 c sys/src/9/alphapc/dma.c - 664 sys sys 1142966373 6526
 1142967714 1 c sys/src/9/pc/dma.c - 664 sys sys 1142966373 5332
 1143081031 0 c sys/man/2/rune - 664 sys sys 1143079849 3086
+1143127845 0 c acme/bin/source/win/main.c - 664 sys sys 1143126825 12447
+1143127845 1 c rc/bin/stock - 775 sys sys 1143126371 292
+1143131446 0 c sys/include/libc.h - 664 sys sys 1143129918 19699
+1143131446 1 c sys/lib/acid/thread - 664 sys sys 1143129753 6163
+1143131446 2 c sys/man/1/tcs - 664 sys sys 1143131200 2654
+1143131446 3 a sys/man/2/semacquire - 664 sys sys 1143130045 1810
+1143131446 4 c sys/src/9/alphapc/fns.h - 664 sys sys 1143129891 3626
+1143131446 5 c sys/src/9/alphapc/l.s - 664 sys sys 1143129848 9367
+1143131446 6 c sys/src/9/alphapc/main.c - 664 sys sys 1143129763 13748
+1143131446 7 c sys/src/9/bitsy/dat.h - 664 sys sys 1143129783 5829
+1143131446 8 c sys/src/9/bitsy/fns.h - 664 sys sys 1143129861 3063
+1143131446 9 c sys/src/9/bitsy/main.c - 664 sys sys 1143129874 8951
+1143131446 10 c sys/src/9/mtx/fns.h - 664 sys sys 1143129832 2767
+1143131446 11 c sys/src/9/mtx/l.s - 664 sys sys 1143129840 11000
+1143131446 12 c sys/src/9/pc/devarch.c - 664 sys sys 1143129812 19249
+1143131446 13 c sys/src/9/pc/fns.h - 664 sys sys 1143129956 4531
+1143131446 14 c sys/src/9/pc/l.s - 664 sys sys 1143129925 28552
+1143131446 15 c sys/src/9/port/portdat.h - 664 sys sys 1143129883 22669
+1143131446 16 c sys/src/9/port/segment.c - 664 sys sys 1143129964 13992
+1143131446 17 a sys/src/9/port/semaphore.p - 664 sys sys 1143129797 2424
+1143131446 18 c sys/src/9/port/sysproc.c - 664 sys sys 1143129796 21535
+1143131446 19 c sys/src/cmd/tcs/utf.c - 664 sys sys 1143131195 7907
+1143131446 20 c sys/src/libc/9syscall/sys.h - 664 sys sys 1143129935 927
+1143135047 0 c sys/man/2/semacquire - 664 sys sys 1143134715 1865
+1143138648 0 c 386/9pc - 775 sys sys 1143137104 1913157
+1143138648 1 c 386/lib/ape/libap.a - 664 sys sys 1143137027 816198
+1143138648 2 c 386/lib/lib9p.a - 664 sys sys 1143137027 91156
+1143138648 3 c 386/lib/libString.a - 664 sys sys 1143137027 22184
+1143138648 4 c 386/lib/libauth.a - 664 sys sys 1143137027 58638
+1143138648 5 c 386/lib/libauthsrv.a - 664 sys sys 1143137027 34210
+1143138648 6 c 386/lib/libbin.a - 664 sys sys 1143137027 2534
+1143138648 7 c 386/lib/libbio.a - 664 sys sys 1143137027 26064
+1143138648 8 c 386/lib/libc.a - 664 sys sys 1143137029 503186
+1143138648 9 c 386/lib/libcomplete.a - 664 sys sys 1143137029 6372
+1143138648 10 c 386/lib/libcontrol.a - 664 sys sys 1143137030 274924
+1143138648 11 c 386/lib/libdisk.a - 664 sys sys 1143137030 42414
+1143138648 12 c 386/lib/libdraw.a - 664 sys sys 1143137032 374212
+1143138648 13 c 386/lib/libflate.a - 664 sys sys 1143137032 76832
+1143138648 14 c 386/lib/libframe.a - 664 sys sys 1143137032 66118
+1143138648 15 c 386/lib/libgeometry.a - 664 sys sys 1143137033 50470
+1143138648 16 c 386/lib/libhtml.a - 664 sys sys 1143137034 220134
+1143138648 17 c 386/lib/libhttpd.a - 664 sys sys 1143137034 99586
+1143138648 18 c 386/lib/libip.a - 664 sys sys 1143137034 35602
+1143138648 19 c 386/lib/libl.a - 664 sys sys 1143137034 5384
+1143138648 20 c 386/lib/libmach.a - 664 sys sys 1143137036 782466
+1143138648 21 c 386/lib/libmemdraw.a - 664 sys sys 1143137037 284158
+1143138648 22 c 386/lib/libmemlayer.a - 664 sys sys 1143137037 47360
+1143138648 23 c 386/lib/libmp.a - 664 sys sys 1143137037 80024
+1143138648 24 c 386/lib/libndb.a - 664 sys sys 1143137038 60716
+1143138648 25 c 386/lib/libplumb.a - 664 sys sys 1143137038 19408
+1143138648 26 c 386/lib/libregexp.a - 664 sys sys 1143137038 37464
+1143138648 27 c 386/lib/libscribble.a - 664 sys sys 1143137038 107278
+1143138648 28 c 386/lib/libsec.a - 664 sys sys 1143137040 646938
+1143138648 29 c 386/lib/libstdio.a - 664 sys sys 1143137040 126186
+1143138648 30 c 386/lib/libsunrpc.a - 664 sys sys 1143137041 355994
+1143138648 31 c 386/lib/libthread.a - 664 sys sys 1143137041 71986
+1143138648 32 c 386/lib/libventi.a - 664 sys sys 1143137042 98038
+1143138648 33 c acme/bin/386/win - 775 sys sys 1143137024 184985
+1143147651 0 c 386/9loaddebug - 775 sys sys 1143146512 312489
+1143147651 1 c 386/9loadlitedebug - 775 sys sys 1143146513 200137

+ 1 - 1
rc/bin/stock

@@ -8,7 +8,7 @@ hget 'http://quote.yahoo.com/d/quotes.csv?s='^$stock^'&f=snl1d1c1v&e=.exe' |
 	sed 's/ +"/"/;s/
//' |
 	switch(`{date}){
 	case *'Apr 1 '*
-		sed 's/("LU","LUCENT TECH"),([^,]*),(.*)$/\1,2.35,\3/'
+		sed 's/("LU","LUCENT TECH INC"),([^,]*),(.*)$/\1,2.35,\3/'
 	case *
 		cat
 	}

+ 2 - 0
sys/include/libc.h

@@ -659,6 +659,8 @@ extern	void*	segbrk(void*, void*);
 extern	int	segdetach(void*);
 extern	int	segflush(void*, ulong);
 extern	int	segfree(void*, ulong);
+extern	int	semacquire(long*, int);
+extern	long	semrelease(long*, long);
 extern	int	sleep(long);
 extern	int	stat(char*, uchar*, int);
 extern	Waitmsg*	wait(void);

+ 1 - 1
sys/lib/acid/thread

@@ -227,7 +227,7 @@ defn stacksizes(){
 				sp = *(T.sched);
 			}
 			sp = *(T.sched);
-			print(top-sp\D, "\n");
+			print(top-sp\D, " / ", T.stksize\D, "\n");
 			T = T.nextt;
 		}
 		P = P.next;

+ 3 - 4
sys/man/1/tcs

@@ -48,12 +48,11 @@ The
 .B -c
 option forces the output to contain only correctly converted characters;
 otherwise,
-.B 0x80
+.B Runeerror
+(0xFFFD)
 characters will be substituted for
 .SM UTF
-encoding errors and
-.B 0xFFFD
-characters will substituted for unknown characters.
+encoding errors and unknown characters.
 .PP
 The
 .B -v

+ 106 - 0
sys/man/2/semacquire

@@ -0,0 +1,106 @@
+.TH SEMACQUIRE 2
+.SH NAME
+semacquire, semrelease \- user level semaphores
+.SH SYNOPSIS
+.B #include <u.h>
+.br
+.B #include <libc.h>
+.PP
+.B
+int semacquire(long *addr, int block);
+.PP
+.B
+long semrelease(long *addr, long count);
+.SH DESCRIPTION
+.I Semacquire
+and 
+.I semrelease
+facilitate scheduling between processes sharing memory.
+Processes arrange to share memory by using
+.I rfork
+with the
+.B RFMEM
+flag
+(see
+.IR fork (2)), 
+.IR segattach (2),
+or
+.IR thread (2).
+.PP
+The semaphore's value is the integer pointed at by
+.IR addr .
+.I Semacquire
+atomically waits until the semaphore has a positive value
+and then decrements that value.
+It returns 1 if the semaphore was acquired and \-1 on error
+(e.g., if it was interrupted).
+If
+.I block
+is zero
+and the semaphore is not immediately available,
+.I semacquire
+returns 0 instead of waiting.
+.I Semrelease
+adds 
+.I count
+to the semaphore's value
+and returns the new value.
+.PP
+.I Semacquire
+and
+.I semrelease
+can be thought of as efficient, correct replacements for:
+.IP
+.EX
+int
+semacquire(long *addr, int block)
+{
+	while(*addr == 0){
+		if(!block)
+			return 0;
+		if(interrupted)
+			return -1;
+	}
+	--*addr;
+	return 1;
+}
+
+int
+semrelease(long *addr, int count)
+{
+	return *addr += count;
+}
+.EE
+.PP
+Like
+.IR rendezvous (2),
+.I semacquire
+and
+.I semrelease
+are not typically used directly.
+Instead, they are intended to be used to coordinate
+scheduling in higher-level abstractions such as
+locks, rendezvous points, and channels
+(see
+.IR lock (2)
+and
+.IR thread (2)).
+Also like
+.I rendezvous ,
+.I semacquire
+and
+.I semrelease
+cannot be used to coordinate between threads
+in a single process.
+Use locks, rendezvous points, or channels instead.
+.SH SOURCE
+.B /sys/src/9/port/sysproc.c
+.SH SEE ALSO
+.IR fork (2),
+.IR lock (2),
+.IR rendezvous (2),
+.IR segattach (2),
+.IR thread (2)
+.SH DIAGNOSTICS
+These functions set
+.IR errstr .

+ 1 - 1
sys/src/9/alphapc/fns.h

@@ -12,7 +12,7 @@ int	cistrcmp(char*, char*);
 int	cistrncmp(char*, char*, int);
 void	cpuidprint(void);
 void	cserve(ulong, ulong);
-#define cycles(x)
+#define cycles(x)	do{}while(0)
 void	timeradd(Timer *);
 void	timerdel(Timer *);
 int	dmacount(int);

+ 14 - 0
sys/src/9/alphapc/l.s

@@ -193,6 +193,20 @@ inc1:
 	BEQ	R0, inc1		/* write failed, retry */
 	RET
 
+TEXT	cmpswap(SB), $-8
+	MOVQ	R0, R1	/* p */
+	MOVL	old+4(FP), R2
+	MOVL	new+8(FP), R3
+	MOVLL	(R1), R0
+	CMPEQ	R0, R2, R4
+	BEQ	R4, fail	/* if R0 != [sic] R2, goto fail */
+	MOVQ	R3, R0
+	MOVLC	R0, (R1)
+	RET
+fail:
+	MOVL	$0, R0
+	RET
+	
 TEXT	fpenab(SB), $-8
 	MOVQ	R0, R16
 	CALL_PAL $PALwrfen

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

@@ -73,6 +73,8 @@ dumpopts(void)
 		print("dumpopts: read %s=%s\n", confname[i], confval[i]);
 }
 
+extern void (*i8237alloc)(void);
+
 void
 main(void)
 {
@@ -87,6 +89,8 @@ main(void)
 	archinit();
 	xinit();
 	memholes();
+	if(i8237alloc != nil)
+		i8237alloc();
 	mmuinit();
 	if(arch->coreinit)
 		arch->coreinit();

+ 0 - 5
sys/src/9/bitsy/dat.h

@@ -32,10 +32,6 @@ typedef void IntrHandler(Ureg*, void*);
  */
 #define AOUT_MAGIC	(E_MAGIC)
 
-enum {
-	Lockcycles = 0,	/* Don't measure lock latencies */
-};
-
 struct Lock
 {
 	ulong	key;
@@ -44,7 +40,6 @@ struct Lock
 	Proc	*p;
 	Mach	*m;
 	ushort	isilock;
-	uvlong	lockcycles;	/* Measure lock latencies */
 };
 
 struct Label

+ 2 - 1
sys/src/9/bitsy/fns.h

@@ -12,8 +12,9 @@ int	cistrcmp(char*, char*);
 int	cistrncmp(char*, char*, int);
 void	clockinit(void);
 ulong	clockpower(int);
+int	cmpswap(long*, long, long);
 #define	coherence()
-#define cycles(x)
+#define cycles(x)	do{}while(0)
 #define	dcflush(a, b)
 void	delay(int);
 void	µcpower(int);

+ 19 - 6
sys/src/9/bitsy/main.c

@@ -522,21 +522,34 @@ getconf(char*)
 long
 _xdec(long *p)
 {
-	int x;
+	int s;
 	long v;
 
-	x = splhi();
+	s = splhi();
 	v = --*p;
-	splx(x);
+	splx(s);
 	return v;
 }
 
 void
 _xinc(long *p)
 {
-	int x;
+	int s;
 
-	x = splhi();
+	s = splhi();
 	++*p;
-	splx(x);
+	splx(s);
 }
+
+int
+cmpswap(long *addr, long old, long new)
+{
+	int r, s;
+	
+	s = splhi();
+	if(r = (*addr==old))
+		*addr = new;
+	splx(s);
+	return r;
+}
+

+ 2 - 1
sys/src/9/mtx/fns.h

@@ -5,9 +5,10 @@ int	cistrncmp(char*, char*, int);
 void	clockinit(void);
 void	clockintr(Ureg*);
 void	clockintrsched(void);
+int	cmpswap(long*, long, long);
 #define coherence()	eieio()
 void	cpuidprint(void);
-#define cycles(x)
+#define cycles(x)	do{}while(0)
 void	dcflush(void*, ulong);
 void	delay(int);
 void	dumpregs(Ureg*);

+ 16 - 0
sys/src/9/mtx/l.s

@@ -301,6 +301,22 @@ xdecloop:
 	BNE		xdecloop
 	RETURN
 
+TEXT cmpswap(SB),$0	/* int cmpswap(long*, long, long) */
+	MOVW	R3, R4	/* addr */
+	MOVW	old+4(FP), R5
+	MOVW	new+8(FP), R6
+	DCBF	(R4)		/* fix for 603x bug? */
+	LWAR	(R4), R3
+	CMP	R3, R5
+	BNE fail
+	STWCCC	R6, (R4)
+	BNE fail
+	MOVW $1, R3
+	RETURN
+fail:
+	MOVW $0, R3
+	RETURN
+
 TEXT	getpvr(SB), $0
 	MOVW	SPR(PVR), R3
 	RETURN

+ 28 - 0
sys/src/9/pc/devarch.c

@@ -496,6 +496,22 @@ nop(void)
 {
 }
 
+/*
+ * 386 has no compare-and-swap instruction.
+ * Run it with interrupts turned off instead.
+ */
+static int
+cmpswap386(long *addr, long old, long new)
+{
+	int r, s;
+	
+	s = splhi();
+	if(r = (*addr == old))
+		*addr = new;
+	splx(s);
+	return r;
+}
+
 /*
  * On a uniprocessor, you'd think that coherence could be nop,
  * but it can't.  We still need a barrier when using coherence() in
@@ -506,6 +522,8 @@ nop(void)
  */
 void (*coherence)(void) = nop;
 
+int (*cmpswap)(long*, long, long) = cmpswap386;
+
 PCArch* arch;
 extern PCArch* knownarch[];
 
@@ -787,6 +805,13 @@ archctlread(Chan*, void *a, long nn, vlong offset)
 		n += snprint(buf+n, sizeof buf-n, "nop\n");
 	else
 		n += snprint(buf+n, sizeof buf-n, "0x%p\n", coherence);
+	n += snprint(buf+n, sizeof buf-n, "cmpswap ");
+	if(cmpswap == cmpswap386)
+		n += snprint(buf+n, sizeof buf-n, "cmpswap386\n");
+	else if(cmpswap == cmpswap486)
+		n += snprint(buf+n, sizeof buf-n, "cmpswap486\n");
+	else
+		n += snprint(buf+n, sizeof buf-n, "0x%p\n", cmpswap);
 	n += snprint(buf+n, sizeof buf-n, "i8253set %s\n", doi8253set ? "on" : "off");
 	buf[n] = 0;
 	return readstr(offset, a, nn, buf);
@@ -897,6 +922,9 @@ archinit(void)
 	if(X86FAMILY(m->cpuidax) == 3)
 		conf.copymode = 1;
 
+	if(X86FAMILY(m->cpuidax) >= 4)
+		cmpswap = cmpswap486;
+
 	if(X86FAMILY(m->cpuidax) >= 5)
 		coherence = mb586;
 

+ 2 - 0
sys/src/9/pc/fns.h

@@ -5,6 +5,8 @@ Dirtab*	addarchfile(char*, int, long(*)(Chan*,void*,long,vlong), long(*)(Chan*,v
 void	archinit(void);
 void	bootargs(void*);
 void	clockintr(Ureg*, void*);
+int	(*cmpswap)(long*, long, long);
+int	cmpswap486(long*, long, long);
 void	(*coherence)(void);
 void	cpuid(char*, int*, int*);
 int	cpuidentify(void);

+ 13 - 0
sys/src/9/pc/l.s

@@ -839,6 +839,19 @@ TEXT xchgw(SB), $0
 	XCHGW	AX, (BX)
 	RET
 
+TEXT cmpswap486(SB), $0
+	MOVL	addr+0(FP), BX
+	MOVL	old+4(FP), AX
+	MOVL	new+8(FP), CX
+	LOCK
+	BYTE $0x0F; BYTE $0xB1; BYTE $0x0B	/* CMPXCHGL CX, (BX) */
+	JNZ didnt
+	MOVL	$1, AX
+	RET
+didnt:
+	XORL	AX,AX
+	RET
+
 TEXT mul64fract(SB), $0
 /*
  * Multiply two 64-bit number s and keep the middle 64 bits from the 128-bit result

+ 12 - 0
sys/src/9/port/portdat.h

@@ -40,6 +40,7 @@ typedef struct RWlock	RWlock;
 typedef struct Sargs	Sargs;
 typedef struct Schedq	Schedq;
 typedef struct Segment	Segment;
+typedef struct Sema	Sema;
 typedef struct Timer	Timer;
 typedef struct Timers	Timers;
 typedef struct Uart	Uart;
@@ -389,6 +390,15 @@ struct Physseg
 	void	(*pgfree)(Page*);
 };
 
+struct Sema
+{
+	Rendez;
+	long	*addr;
+	int	waiting;
+	Sema	*next;
+	Sema	*prev;
+};
+
 struct Segment
 {
 	Ref;
@@ -407,6 +417,8 @@ struct Segment
 	Pte	**map;
 	int	mapsize;
 	Pte	*ssegmap[SSEGMAPSIZE];
+	Lock	semalock;
+	Sema	sema;
 	ulong	mark;		/* portcountrefs */
 };
 

+ 3 - 0
sys/src/9/port/segment.c

@@ -70,6 +70,8 @@ newseg(int type, ulong base, ulong size)
 	s->base = base;
 	s->top = base+(size*BY2PG);
 	s->size = size;
+	s->sema.prev = &s->sema;
+	s->sema.next = &s->sema;
 
 	mapsize = ROUND(size, PTEPERTAB)/PTEPERTAB;
 	if(mapsize > nelem(s->ssegmap)){
@@ -789,3 +791,4 @@ segclock(ulong pc)
 		s->profile[pc>>LRESPROF] += TK2MS(1);
 	}
 }
+

+ 183 - 0
sys/src/9/port/semaphore.p

@@ -0,0 +1,183 @@
+/*
+spin -a semaphore.p
+pcc -DSAFETY -DREACH -DMEMLIM'='500 -o pan pan.c
+pan -i
+rm pan.* pan
+
+*/
+
+#define N 3
+
+bit listlock;
+byte value;
+bit onlist[N];
+bit waiting[N];
+bit sleeping[N];
+bit acquired[N];
+
+inline lock(x)
+{
+	atomic { x == 0; x = 1 }
+}
+
+inline unlock(x)
+{
+	assert x==1;
+	x = 0
+}
+
+inline sleep(cond)
+{
+	assert !sleeping[_pid];
+	assert !interrupted;
+	if
+	:: cond
+	:: atomic { else -> sleeping[_pid] = 1 } -> 
+		!sleeping[_pid]
+	fi;
+	if
+	:: skip
+	:: interrupted = 1
+	fi
+}
+
+inline wakeup(id)
+{
+	if
+	:: sleeping[id] == 1 -> sleeping[id] = 0
+	:: else
+	fi
+}
+
+inline semqueue()
+{
+	lock(listlock);
+	assert !onlist[_pid];
+	onlist[_pid] = 1;
+	unlock(listlock)
+}
+
+inline semdequeue()
+{
+	lock(listlock);
+	assert onlist[_pid];
+	onlist[_pid] = 0;
+	waiting[_pid] = 0;
+	unlock(listlock)
+}
+
+inline semwakeup(n)
+{
+	byte i, j;
+
+	lock(listlock);
+	i = 0;
+	j = n;
+	do
+	:: (i < N && j > 0) ->
+		if
+		:: onlist[i] && waiting[i] -> 
+			atomic { printf("kicked %d\n", i);
+			waiting[i] = 0 };
+			wakeup(i);
+			j--
+		:: else
+		fi;
+		i++
+	:: else -> break
+	od;
+	/* reset i and j to reduce state space */
+	i = 0;
+	j = 0;
+	unlock(listlock)
+}
+
+inline semrelease(n) 
+{
+	atomic { value = value+n; printf("release %d\n", n); };
+	semwakeup(n)
+}
+
+inline canacquire()
+{
+	atomic { value > 0 -> value--; };
+	acquired[_pid] = 1
+}
+
+#define semawoke() !waiting[_pid]
+
+inline semacquire(block)
+{
+	if
+	:: atomic { canacquire() -> printf("easy acquire\n"); } -> 
+		goto out
+	:: else
+	fi;
+	if
+	:: !block -> goto out
+	:: else
+	fi;
+
+	semqueue();
+	do
+	:: skip ->
+		waiting[_pid] = 1;
+		if
+		:: atomic { canacquire() -> printf("hard acquire\n"); } ->
+			break
+		:: else
+		fi;
+		sleep(semawoke())
+		if
+		:: interrupted -> 
+			printf("%d interrupted\n", _pid);
+			break
+		:: !interrupted
+		fi
+	od;
+	semdequeue();
+	if
+	:: !waiting[_pid] ->
+		semwakeup(1)
+	:: else
+	fi;
+out:
+	assert (!block || interrupted || acquired[_pid]);
+	assert !(interrupted && acquired[_pid]);
+	assert !waiting[_pid];
+	printf("%d done\n", _pid);
+}
+
+active[N] proctype acquire()
+{
+	bit interrupted;
+
+	semacquire(1);
+	printf("%d finished\n", _pid);
+	skip
+}
+
+active proctype release()
+{
+	byte k;
+
+	k = 0;
+	do
+	:: k < N -> 
+		semrelease(1);
+		k++;
+	:: else -> break
+	od;
+	skip
+}
+
+/*
+ * If this guy, the highest-numbered proc, sticks
+ * around, then everyone else sticks around.  
+ * This makes sure that we get a state line for
+ * everyone in a proc dump.  
+ */
+active proctype dummy()
+{
+end:	0;
+}

+ 231 - 0
sys/src/9/port/sysproc.c

@@ -840,3 +840,234 @@ sysrendezvous(ulong *arg)
 
 	return up->rendval;
 }
+
+/*
+ * The implementation of semaphores is complicated by needing
+ * to avoid rescheduling in syssemrelease, so that it is safe
+ * to call from real-time processes.  This means syssemrelease
+ * cannot acquire any qlocks, only spin locks.
+ * 
+ * Semacquire and semrelease must both manipulate the semaphore
+ * wait list.  Lock-free linked lists only exist in theory, not
+ * in practice, so the wait list is protected by a spin lock.
+ * 
+ * The semaphore value *addr is stored in user memory, so it
+ * cannot be read or written while holding spin locks.
+ * 
+ * Thus, we can access the list only when holding the lock, and
+ * we can access the semaphore only when not holding the lock.
+ * This makes things interesting.  Note that sleep's condition function
+ * is called while holding two locks - r and up->rlock - so it cannot
+ * access the semaphore value either.
+ * 
+ * An acquirer announces its intention to try for the semaphore
+ * by putting a Sema structure onto the wait list and then
+ * setting Sema.waiting.  After one last check of semaphore,
+ * the acquirer sleeps until Sema.waiting==0.  A releaser of n
+ * must wake up n acquirers who have Sema.waiting set.  It does
+ * this by clearing Sema.waiting and then calling wakeup.
+ * 
+ * There are three interesting races here.  
+ 
+ * The first is that in this particular sleep/wakeup usage, a single
+ * wakeup can rouse a process from two consecutive sleeps!  
+ * The ordering is:
+ * 
+ * 	(a) set Sema.waiting = 1
+ * 	(a) call sleep
+ * 	(b) set Sema.waiting = 0
+ * 	(a) check Sema.waiting inside sleep, return w/o sleeping
+ * 	(a) try for semaphore, fail
+ * 	(a) set Sema.waiting = 1
+ * 	(a) call sleep
+ * 	(b) call wakeup(a)
+ * 	(a) wake up again
+ * 
+ * This is okay - semacquire will just go around the loop
+ * again.  It does mean that at the top of the for(;;) loop in
+ * semacquire, phore.waiting might already be set to 1.
+ * 
+ * The second is that a releaser might wake an acquirer who is
+ * interrupted before he can acquire the lock.  Since
+ * release(n) issues only n wakeup calls -- only n can be used
+ * anyway -- if the interrupted process is not going to use his
+ * wakeup call he must pass it on to another acquirer.
+ * 
+ * The third race is similar to the second but more subtle.  An
+ * acquirer sets waiting=1 and then does a final canacquire()
+ * before going to sleep.  The opposite order would result in
+ * missing wakeups that happen between canacquire and
+ * waiting=1.  (In fact, the whole point of Sema.waiting is to
+ * avoid missing wakeups between canacquire() and sleep().) But
+ * there can be spurious wakeups between a successful
+ * canacquire() and the following semdequeue().  This wakeup is
+ * not useful to the acquirer, since he has already acquired
+ * the semaphore.  Like in the previous case, though, the
+ * acquirer must pass the wakeup call along.
+ * 
+ * This is all rather subtle.  The code below has been verified
+ * with the spin model /sys/src/9/port/semaphore.p.  The
+ * original code anticipated the second race but not the first
+ * or third, which were caught only with spin.  The first race
+ * is mentioned in /sys/doc/sleep.ps, but I'd forgotten about it.
+ * It was lucky that my abstract model of sleep/wakeup still managed
+ * to preserve that behavior.
+ *
+ * I remain slightly concerned about memory coherence
+ * outside of locks.  The spin model does not take 
+ * queued processor writes into account so we have to
+ * think hard.  The only variables accessed outside locks
+ * are the semaphore value itself and the boolean flag
+ * Sema.waiting.  The value is only accessed with cmpswap,
+ * whose job description includes doing the right thing as
+ * far as memory coherence across processors.  That leaves
+ * Sema.waiting.  To handle it, we call coherence() before each
+ * read and after each write.		- rsc
+ */
+
+/* Add semaphore p with addr a to list in seg. */
+static void
+semqueue(Segment *s, long *a, Sema *p)
+{
+	memset(p, 0, sizeof *p);
+	p->addr = a;
+	lock(&s->sema);	/* uses s->sema.Rendez.Lock, but no one else is */
+	p->next = &s->sema;
+	p->prev = s->sema.prev;
+	p->next->prev = p;
+	p->prev->next = p;
+	unlock(&s->sema);
+}
+
+/* Remove semaphore p from list in seg. */
+static void
+semdequeue(Segment *s, Sema *p)
+{
+	lock(&s->sema);
+	p->next->prev = p->prev;
+	p->prev->next = p->next;
+	unlock(&s->sema);
+}
+
+/* Wake up n waiters with addr a on list in seg. */
+static void
+semwakeup(Segment *s, long *a, long n)
+{
+	Sema *p;
+	
+	lock(&s->sema);
+	for(p=s->sema.next; p!=&s->sema && n>0; p=p->next){
+		if(p->addr == a && p->waiting){
+			p->waiting = 0;
+			coherence();
+			wakeup(p);
+			n--;
+		}
+	}
+	unlock(&s->sema);
+}
+
+/* Add delta to semaphore and wake up waiters as appropriate. */
+static long
+semrelease(Segment *s, long *addr, long delta)
+{
+	long value;
+
+	do
+		value = *addr;
+	while(!cmpswap(addr, value, value+delta));
+	semwakeup(s, addr, delta);
+	return value+delta;
+}
+
+/* Try to acquire semaphore using compare-and-swap */
+static int
+canacquire(long *addr)
+{
+	long value;
+	
+	while((value=*addr) > 0)
+		if(cmpswap(addr, value, value-1))
+			return 1;
+	return 0;
+}		
+
+/* Should we wake up? */
+static int
+semawoke(void *p)
+{
+	coherence();
+	return !((Sema*)p)->waiting;
+}
+
+/* Acquire semaphore (subtract 1). */
+static int
+semacquire(Segment *s, long *addr, int block)
+{
+	int acquired;
+	Sema phore;
+
+	if(canacquire(addr))
+		return 1;
+	if(!block)
+		return 0;
+	
+	acquired = 0;
+	semqueue(s, addr, &phore);
+	for(;;){
+		phore.waiting = 1;
+		coherence();
+		if(canacquire(addr)){
+			acquired = 1;
+			break;
+		}
+		if(waserror())
+			break;
+		sleep(&phore, semawoke, &phore);
+		poperror();
+	}
+	semdequeue(s, &phore);
+	coherence();	/* not strictly necessary due to lock in semdequeue */
+	if(!phore.waiting)
+		semwakeup(s, addr, 1);
+	if(!acquired)
+		nexterror();
+	return 1;
+}
+
+long
+syssemacquire(ulong *arg)
+{
+	int block;
+	long *addr;
+	Segment *s;
+
+	validaddr(arg[0], sizeof(long), 1);
+	evenaddr(arg[0]);
+	addr = (long*)arg[0];
+	block = arg[1];
+	
+	if((s = seg(up, (ulong)addr, 0)) == nil)
+		error(Ebadarg);
+	if(*addr < 0)
+		error(Ebadarg);
+	return semacquire(s, addr, block);
+}
+
+long
+syssemrelease(ulong *arg)
+{
+	long *addr, delta;
+	Segment *s;
+
+	validaddr(arg[0], sizeof(long), 1);
+	evenaddr(arg[0]);
+	addr = (long*)arg[0];
+	delta = arg[1];
+
+	if((s = seg(up, (ulong)addr, 0)) == nil)
+		error(Ebadarg);
+	if(delta < 0 || *addr < 0)
+		error(Ebadarg);
+	return semrelease(s, addr, arg[1]);
+}

+ 16 - 17
sys/src/cmd/tcs/utf.c

@@ -39,13 +39,13 @@ utf_in(int fd, long *notused, struct convert *out)
 		tot += n;
 		for(i=j=0; i<tot; ){
 			c = our_mbtowc(&l, buf+i, tot-i);
-			if(c == -2)
-				break;
 			if(c == -1){
 				if(squawk)
 					EPR "%s: bad UTF sequence near byte %ld in input\n", argv0, ninput+i);
-				if(clean)
+				if(clean){
+					i++;
 					continue;
+				}
 				nerrors++;
 				l = Runeerror;
 				c = 1;
@@ -92,11 +92,13 @@ isoutf_in(int fd, long *notused, struct convert *out)
 			if(!fullisorune(buf+i, tot-i))
 				break;
 			c = isochartorune(&runes[j], buf+i);
-			if(runes[j] == Runeerror){
+			if(runes[j] == Runeerror && c == 1){
 				if(squawk)
 					EPR "%s: bad UTF sequence near byte %ld in input\n", argv0, ninput+i);
-				if(clean)
+				if(clean){
+					i++;
 					continue;
+				}
 				nerrors++;
 			}
 			j++;
@@ -325,12 +327,11 @@ enum
 	Wchar2	= (1UL<<(Bit2+Bitx))-1,
 	Wchar3	= (1UL<<(Bit3+2*Bitx))-1,
 	Wchar4	= (1UL<<(Bit4+3*Bitx))-1,
-	Wchar5	= (1UL<<(Bit5+4*Bitx))-1
+	Wchar5	= (1UL<<(Bit5+4*Bitx))-1,
 
 #ifndef	EILSEQ
-	, /* we hate ansi c's comma rules */
-	EILSEQ	= 123
-#endif /* PLAN9 */
+	EILSEQ	= 123,
+#endif /* EILSEQ */
 };
 
 int
@@ -394,19 +395,19 @@ our_mbtowc(unsigned long *p, char *s, unsigned n)
 		return 0;		/* no shift states */
 
 	if(n < 1)
-		goto badlen;
+		goto bad;
 	us = (uchar*)s;
 	c0 = us[0];
 	if(c0 >= T3) {
 		if(n < 3)
-			goto badlen;
+			goto bad;
 		c1 = us[1] ^ Tx;
 		c2 = us[2] ^ Tx;
 		if((c1|c2) & T2)
 			goto bad;
 		if(c0 >= T5) {
 			if(n < 5)
-				goto badlen;
+				goto bad;
 			c3 = us[3] ^ Tx;
 			c4 = us[4] ^ Tx;
 			if((c3|c4) & T2)
@@ -414,7 +415,7 @@ our_mbtowc(unsigned long *p, char *s, unsigned n)
 			if(c0 >= T6) {
 				/* 6 bytes */
 				if(n < 6)
-					goto badlen;
+					goto bad;
 				c5 = us[5] ^ Tx;
 				if(c5 & T2)
 					goto bad;
@@ -438,7 +439,7 @@ our_mbtowc(unsigned long *p, char *s, unsigned n)
 		if(c0 >= T4) {
 			/* 4 bytes */
 			if(n < 4)
-				goto badlen;
+				goto bad;
 			c3 = us[3] ^ Tx;
 			if(c3 & T2)
 				goto bad;
@@ -461,7 +462,7 @@ our_mbtowc(unsigned long *p, char *s, unsigned n)
 	if(c0 >= T2) {
 		/* 2 bytes */
 		if(n < 2)
-			goto badlen;
+			goto bad;
 		c1 = us[1] ^ Tx;
 		if(c1 & T2)
 			goto bad;
@@ -481,6 +482,4 @@ our_mbtowc(unsigned long *p, char *s, unsigned n)
 bad:
 	errno = EILSEQ;
 	return -1;
-badlen:
-	return -2;
 }

+ 4 - 2
sys/src/libc/9syscall/sys.h

@@ -35,6 +35,8 @@
 #define	RENDEZVOUS	34
 #define	UNMOUNT		35
 #define	_WAIT		36
+#define	SEMACQUIRE	37
+#define	SEMRELEASE	38
 #define	SEEK		39
 #define	FVERSION	40
 #define	ERRSTR		41
@@ -44,5 +46,5 @@
 #define	FWSTAT		45
 #define	MOUNT		46
 #define	AWAIT		47
-#define PREAD		50
-#define PWRITE		51
+#define	PREAD		50
+#define	PWRITE		51