Browse Source

Plan 9 from Bell Labs 2003-02-28

David du Colombier 21 years ago
parent
commit
5833b9f1bd

+ 24 - 23
dist/replica/plan9.db

@@ -108,13 +108,13 @@
 386/bin/aux/ms2 - 775 sys sys 1045537953 84053
 386/bin/aux/mswordstrings - 775 sys sys 1039758542 64268
 386/bin/aux/na - 775 sys sys 1045537953 152774
-386/bin/aux/nfsmount - 775 sys sys 1046265120 231230
+386/bin/aux/nfsmount - 775 sys sys 1046368786 231402
 386/bin/aux/nfsserver - 775 sys sys 1045537954 171046
 386/bin/aux/olefs - 775 sys sys 1045537954 144352
 386/bin/aux/p9bitpost - 775 sys sys 1039758543 127979
 386/bin/aux/pcmcia - 775 sys sys 1039758543 46790
 386/bin/aux/pcnfsd - 775 sys sys 1045537955 126750
-386/bin/aux/portmap - 775 sys sys 1046265121 140783
+386/bin/aux/portmap - 775 sys sys 1046368787 140955
 386/bin/aux/portmapper - 775 sys sys 1045537955 125638
 386/bin/aux/postgif - 775 sys sys 1038443100 177440
 386/bin/aux/postprint - 775 sys sys 1038443101 161939
@@ -171,7 +171,7 @@
 386/bin/cpu - 775 sys sys 1042640741 137389
 386/bin/crop - 775 sys sys 1039758553 115496
 386/bin/date - 775 sys sys 1039758553 43976
-386/bin/db - 775 sys sys 1045537970 323629
+386/bin/db - 775 sys sys 1046368788 323629
 386/bin/dc - 775 sys sys 1045537970 97871
 386/bin/dd - 775 sys sys 1039758554 46046
 386/bin/deroff - 775 sys sys 1045537971 73202
@@ -299,7 +299,7 @@
 386/bin/netkey - 775 sys sys 1039758579 70753
 386/bin/netstat - 775 sys sys 1045538036 81379
 386/bin/news - 775 sys sys 1045538036 70512
-386/bin/nfs - 775 sys sys 1046265123 315584
+386/bin/nfs - 775 sys sys 1046368789 315776
 386/bin/nm - 775 sys sys 1045538037 123227
 386/bin/nntpfs - 775 sys sys 1045538038 161729
 386/bin/ns - 775 sys sys 1039758580 63830
@@ -337,7 +337,7 @@
 386/bin/replica/setupdirs - 775 sys sys 1020319083 44
 386/bin/replica/updatedb - 775 sys sys 1045538046 95942
 386/bin/resample - 775 sys sys 1039758586 120283
-386/bin/rio - 775 sys sys 1045538047 302877
+386/bin/rio - 775 sys sys 1046368790 302875
 386/bin/rm - 775 sys sys 1045538047 60036
 386/bin/rtstats - 775 sys sys 1045538048 177343
 386/bin/rx - 775 sys sys 1045538048 78437
@@ -466,7 +466,7 @@
 386/lib - 20000000775 sys sys 1016826328 0
 386/lib/ape - 20000000775 sys sys 944969312 0
 386/lib/ape/lib9.a - 664 sys sys 1038237538 6378
-386/lib/ape/libap.a - 664 sys sys 1044031555 780602
+386/lib/ape/libap.a - 664 sys sys 1046356069 780602
 386/lib/ape/libbsd.a - 664 sys sys 1038237542 171922
 386/lib/ape/libl.a - 664 sys sys 1038237542 8666
 386/lib/ape/libnet.a - 664 sys sys 1038237543 16604
@@ -499,7 +499,7 @@
 386/lib/libscribble.a - 664 sys sys 1045538126 108138
 386/lib/libsec.a - 664 sys sys 1045538128 635686
 386/lib/libstdio.a - 664 sys sys 1045538128 125144
-386/lib/libsunrpc.a - 664 sys sys 1046265131 355574
+386/lib/libsunrpc.a - 664 sys sys 1046368791 357146
 386/lib/libthread.a - 664 sys sys 1045538129 71494
 386/lib/libventi.a - 664 sys sys 1045538129 97938
 386/mbr - 775 sys sys 1022125974 407
@@ -3195,7 +3195,7 @@ sys/doc/venti/venti.pdf - 755 sys sys 1020384352 139090
 sys/doc/venti/venti.ps - 664 sys sys 1019852320 2012620
 sys/games - 20000000775 sys sys 952648872 0
 sys/games/lib - 20000000775 sys sys 952648879 0
-sys/games/lib/fortunes - 664 sys sys 1045543258 238358
+sys/games/lib/fortunes - 664 sys sys 1046322489 238404
 sys/include - 20000000775 sys sys 1016902416 0
 sys/include/9p.h - 664 sys sys 1044836327 4309
 sys/include/String.h - 664 sys sys 1014929061 1133
@@ -3291,7 +3291,7 @@ sys/include/realtime.h - 664 sys sys 1037669237 869
 sys/include/regexp.h - 664 sys sys 1014929066 1308
 sys/include/scribble.h - 664 sys sys 1014929066 679
 sys/include/stdio.h - 664 sys sys 1014929066 4145
-sys/include/sunrpc.h - 664 sys sys 1045589438 7174
+sys/include/sunrpc.h - 664 sys sys 1046367129 7219
 sys/include/thread.h - 664 sys sys 1045504289 3562
 sys/include/venti.h - 664 sys sys 1045504293 6956
 sys/lib - 20000000775 sys sys 1018580948 0
@@ -3308,11 +3308,11 @@ sys/lib/acid/leak - 664 sys sys 1014924361 1796
 sys/lib/acid/mips - 664 sys sys 944955985 5472
 sys/lib/acid/network - 664 sys sys 1020313817 2499
 sys/lib/acid/pool - 664 sys sys 1016833869 4244
-sys/lib/acid/port - 664 sys sys 1014924361 8107
+sys/lib/acid/port - 664 sys sys 1046363154 8899
 sys/lib/acid/power - 664 sys sys 969499633 3058
 sys/lib/acid/sparc - 664 sys sys 944955986 5339
 sys/lib/acid/syscall - 664 sys sys 1016926088 5353
-sys/lib/acid/thread - 664 sys sys 1014924361 4622
+sys/lib/acid/thread - 664 sys sys 1046363154 5848
 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
@@ -4757,7 +4757,7 @@ sys/man/4/kfs - 664 sys sys 1019058716 2159
 sys/man/4/lnfs - 664 sys sys 1018973955 1006
 sys/man/4/mntgen - 664 sys sys 1043680799 473
 sys/man/4/namespace - 664 sys sys 1018386777 6916
-sys/man/4/nfs - 664 sys sys 1045589694 2739
+sys/man/4/nfs - 664 sys sys 1046367663 2740
 sys/man/4/nntpfs - 664 sys sys 1032632346 2771
 sys/man/4/paqfs - 664 sys sys 1017723482 1541
 sys/man/4/plumber - 664 sys sys 944959699 2748
@@ -5151,11 +5151,11 @@ sys/src/9/pc/mmu.c - 664 sys sys 1018553449 10008
 sys/src/9/pc/mouse.c - 664 sys sys 1020369766 6315
 sys/src/9/pc/mp.c - 664 sys sys 1018974174 17091
 sys/src/9/pc/mp.h - 664 sys sys 1015014520 6575
-sys/src/9/pc/pc - 664 sys sys 1039753496 1311
-sys/src/9/pc/pcauth - 664 sys sys 1039753496 600
+sys/src/9/pc/pc - 664 sys sys 1046359057 1316
+sys/src/9/pc/pcauth - 664 sys sys 1046359058 605
 sys/src/9/pc/pccd - 664 sys sys 1039753495 1278
-sys/src/9/pc/pccpu - 664 sys sys 1039803186 785
-sys/src/9/pc/pcdisk - 664 sys sys 1045504515 1369
+sys/src/9/pc/pccpu - 664 sys sys 1046359058 790
+sys/src/9/pc/pcdisk - 664 sys sys 1046359059 1374
 sys/src/9/pc/pcfl - 664 sys sys 1042004821 1563
 sys/src/9/pc/pcflop - 664 sys sys 1045500133 1386
 sys/src/9/pc/pci.c - 664 sys sys 1032052921 23359
@@ -6887,7 +6887,7 @@ sys/src/cmd/db/main.c - 664 sys sys 1016731556 3308
 sys/src/cmd/db/mkfile - 664 sys sys 944960880 233
 sys/src/cmd/db/output.c - 664 sys sys 1014925293 2009
 sys/src/cmd/db/pcs.c - 664 sys sys 1016731557 2859
-sys/src/cmd/db/print.c - 664 sys sys 1016731557 5855
+sys/src/cmd/db/print.c - 664 sys sys 1046363143 5856
 sys/src/cmd/db/regs.c - 664 sys sys 1014925293 1998
 sys/src/cmd/db/runpcs.c - 664 sys sys 1014925293 2929
 sys/src/cmd/db/setup.c - 664 sys sys 1014925293 3581
@@ -9305,7 +9305,7 @@ sys/src/cmd/ndb/query.c - 664 sys sys 957402054 1133
 sys/src/cmd/ndb/time.c - 664 sys sys 957402055 321
 sys/src/cmd/netstat.c - 664 sys sys 1038237140 3796
 sys/src/cmd/news.c - 664 sys sys 1014926614 3778
-sys/src/cmd/nfs.c - 664 sys sys 1045589249 30446
+sys/src/cmd/nfs.c - 664 sys sys 1046367340 30488
 sys/src/cmd/nm.c - 664 sys sys 1014926696 4908
 sys/src/cmd/nntpfs.c - 664 sys sys 1037404000 18808
 sys/src/cmd/ns.c - 664 sys sys 984717934 3558
@@ -9756,7 +9756,7 @@ sys/src/cmd/rio/scrl.c - 664 sys sys 1014926357 3245
 sys/src/cmd/rio/time.c - 664 sys sys 1014926357 1829
 sys/src/cmd/rio/util.c - 664 sys sys 1014926357 2061
 sys/src/cmd/rio/wctl.c - 664 sys sys 1023206837 8808
-sys/src/cmd/rio/wind.c - 664 sys sys 1023206837 29888
+sys/src/cmd/rio/wind.c - 664 sys sys 1046363182 29893
 sys/src/cmd/rio/xfid.c - 664 sys sys 1032061723 17424
 sys/src/cmd/rm.c - 664 sys sys 1014926615 1563
 sys/src/cmd/rtstats - 20000000775 sys sys 1018897680 0
@@ -11758,19 +11758,20 @@ sys/src/libstdio/vsprintf.c - 664 sys sys 1022112162 246
 sys/src/libsunrpc - 20000000775 sys sys 1045589225 0
 sys/src/libsunrpc/COPYING - 664 sys sys 1045589219 1269
 sys/src/libsunrpc/authunix.c - 664 sys sys 1045589219 1477
-sys/src/libsunrpc/client.c - 664 sys sys 1046184855 8902
+sys/src/libsunrpc/client.c - 664 sys sys 1046367118 8960
 sys/src/libsunrpc/emalloc.c - 664 sys sys 1045589220 397
 sys/src/libsunrpc/error.c - 664 sys sys 1045589221 819
 sys/src/libsunrpc/fd.c - 664 sys sys 1045589221 1734
 sys/src/libsunrpc/fmt.c - 664 sys sys 1045589222 1146
-sys/src/libsunrpc/mkfile - 664 sys sys 1045589222 318
+sys/src/libsunrpc/mkfile - 664 sys sys 1046367118 331
 sys/src/libsunrpc/mount3.c - 664 sys sys 1045589223 15217
 sys/src/libsunrpc/net.c - 664 sys sys 1045589223 792
 sys/src/libsunrpc/nfs3.c - 664 sys sys 1045589224 93376
 sys/src/libsunrpc/portmap.c - 664 sys sys 1045589224 9758
-sys/src/libsunrpc/prog.c - 664 sys sys 1045589225 1586
+sys/src/libsunrpc/prog.c - 664 sys sys 1046367120 1704
 sys/src/libsunrpc/rpc.c - 664 sys sys 1045589225 9235
-sys/src/libsunrpc/server.c - 664 sys sys 1045589225 5187
+sys/src/libsunrpc/server.c - 664 sys sys 1046367121 5227
+sys/src/libsunrpc/suncall.c - 664 sys sys 1046367121 257
 sys/src/libsunrpc/udp.c - 664 sys sys 1045589225 2158
 sys/src/libthread - 20000000775 sys sys 1014928161 0
 sys/src/libthread/386.c - 664 sys sys 1014928156 448

+ 25 - 0
dist/replica/plan9.log

@@ -18085,3 +18085,28 @@
 1046282461 4 c mips/include/ape/math.h - 664 sys sys 1046282353 2123
 1046282461 5 c power/include/ape/math.h - 664 sys sys 1046282353 2123
 1046282461 6 c sparc/include/ape/math.h - 664 sys sys 1046282354 2123
+1046323874 0 c sys/games/lib/fortunes - 664 sys sys 1046322489 238404
+1046356242 0 c 386/lib/ape/libap.a - 664 sys sys 1046356069 780602
+1046359842 0 c sys/src/9/pc/pc - 664 sys sys 1046359057 1316
+1046359842 1 c sys/src/9/pc/pcauth - 664 sys sys 1046359058 605
+1046359842 2 c sys/src/9/pc/pccpu - 664 sys sys 1046359058 790
+1046359842 3 c sys/src/9/pc/pcdisk - 664 sys sys 1046359059 1374
+1046363443 0 c sys/lib/acid/port - 664 sys sys 1046363154 8899
+1046363443 1 c sys/lib/acid/thread - 664 sys sys 1046363154 5848
+1046363443 2 c sys/src/cmd/db/print.c - 664 sys sys 1046363143 5856
+1046363443 3 c sys/src/cmd/rio/wind.c - 664 sys sys 1046363182 29893
+1046367043 0 c sys/src/cmd/nfs.c - 664 sys sys 1046367112 30465
+1046367043 1 c sys/src/libsunrpc/client.c - 664 sys sys 1046367118 8960
+1046367043 2 c sys/src/libsunrpc/mkfile - 664 sys sys 1046367118 331
+1046367043 3 c sys/src/libsunrpc/prog.c - 664 sys sys 1046367120 1704
+1046367043 4 c sys/src/libsunrpc/server.c - 664 sys sys 1046367121 5227
+1046367043 5 a sys/src/libsunrpc/suncall.c - 664 sys sys 1046367121 257
+1046367187 0 c sys/include/sunrpc.h - 664 sys sys 1046367129 7219
+1046367344 0 c sys/src/cmd/nfs.c - 664 sys sys 1046367340 30488
+1046368792 0 c 386/bin/db - 775 sys sys 1046368788 323629
+1046368792 1 c 386/bin/rio - 775 sys sys 1046368790 302875
+1046368792 2 c 386/bin/aux/nfsmount - 775 sys sys 1046368786 231402
+1046368792 3 c 386/bin/aux/portmap - 775 sys sys 1046368787 140955
+1046368792 4 c 386/bin/nfs - 775 sys sys 1046368789 315776
+1046368792 5 c 386/lib/libsunrpc.a - 664 sys sys 1046368791 357146
+1046368792 6 c sys/man/4/nfs - 664 sys sys 1046367663 2740

+ 3 - 2
sys/games/lib/fortunes

@@ -1200,7 +1200,7 @@ Seek not to understand that you may believe, but believe that you may understand
 Self denial is better than self degradation.
 Sell everything. Market top has been reached. -Joseph Granville
 Send not to ask for whom the bell tolls; it tolls for thee.
-Senor, if you hurry from here, you will wait longer there. -Mexico taxi driver
+Señor, if you hurry from here, you will wait longer there. -Mexico taxi driver
 Sex with someone you don't love is just gymnastics--and I hate exercise. -John Derek
 Shadows slick as eels slither through.
 Share your happiness with others today.
@@ -1594,7 +1594,7 @@ Versatility is one of your outstanding traits.
 Vests are to suits as seat-belts are to cars.
 Vigilia pretium libertatis.
 Violence is the last refuge of the incompetent.  -Salvador Hardin
-Viva Nuestra Senora Guadalupe y jueron gubernacion mala.  -Father Hidalgo
+Viva Nuestra Señora Guadalupe y jueron gubernacion mala.  -Father Hidalgo
 Vivaldi did not write 600 concerti grossi.  He wrote the same one 600 times. -Stravinski
 Vocatus atque non vocatus deus aderit.
 Vote anarchist.
@@ -3862,3 +3862,4 @@ The second line computes the sinus of the result.  - Programming in the .NET Env
 Where would Christianity be if Jesus got eight to fifteen years, with time off for good behavior? -- New York Senator James H. Donovan on capital punishment. 
 rsc            5202    0:00   0:00 1710768K Rendez   8.portmapd
 http://www.fortunecookieadvertising.com
+A short stranger will soon enter your life.

+ 1 - 0
sys/include/sunrpc.h

@@ -167,6 +167,7 @@ SunStatus sunCallPack(SunProg*, uchar*, uchar*, uchar**, SunCall*);
 SunStatus sunCallUnpack(SunProg*, uchar*, uchar*, uchar**, SunCall*);
 SunStatus sunCallUnpackAlloc(SunProg*, SunCallType, uchar*, uchar*, uchar**, SunCall**);
 uint sunCallSize(SunProg*, SunCall*);
+void sunCallSetup(SunCall*, SunProg*, uint);
 
 /*
  * Formatting

+ 64 - 14
sys/lib/acid/port

@@ -42,44 +42,78 @@ defn params(param)
 {
 	while param do {
 		sym = head param;
-		print(sym[0], "=", sym[1]);
+		print(sym[0], "=", itoa(sym[1], "%x"));
 		param = tail param;
 		if param then
 			print (",");
 	}	
 }
 
+stkprefix = "";
+stkignore = {};
+stkend = 0;
+
 defn locals(l)
 {
 	local sym;
 
 	while l do {
 		sym = head l;
-		print("\t", sym[0], "=", sym[1], "\n");
+		print(stkprefix, "\t", sym[0], "=", itoa(sym[1], "%x"), "\n");
 		l = tail l;
 	}	
 }
 
-defn _stk(pc, sp, link, dolocals)
+defn _stkign(file)
 {
-	local stk;
+	s = stkignore;
+	while s do {
+		if regexp(head s, file) then
+			return 1;
+		s = tail s;
+	}
+	return 0;
+}
 
-	print("At pc:", pc, ":", fmt(pc, 'a'), " ");
-	pfl(pc);
+// print a stack trace
+//
+// in a run of leading frames in files matched by regexps in stkignore,
+// only print the last one.
+defn _stk(pc, sp, link, dolocals)
+{
+	local stk, ign, last, lastpc;
 
 	stk = strace(pc, sp, link);
-
+	if stkignore then
+		ign = 1;
+	else
+		ign = 0;
+	last = stk;
+	lastpc = pc;
 	while stk do {
+		if ign then {
+			if !_stkign(pcfile(pc)) then {
+				ign = 0;
+				stk = last;
+				pc = lastpc;
+			}
+		}
 		frame = head stk;
-		print(fmt(frame[0], 'a'), "(");
-		params(frame[2]);
-		print(") ", pcfile(frame[0]), ":", pcline(frame[0]));
-		print("\n\tcalled from ", fmt(frame[1], 'a'), " ");
-		pfl(frame[1]);
+		if !ign then {
+			print(stkprefix, fmt(frame[0], 'a'), "(");
+			params(frame[2]);
+			print(")+", itoa(pc-frame[0], "%x"), " ");
+			pfl(pc);
+			if dolocals then
+				locals(frame[3]);
+		}
+		last = stk;
+		lastpc = pc;
 		stk = tail stk;
-		if dolocals then
-			locals(frame[3]);
+		pc = frame[1];
 	}
+	print(stkprefix, fmt(pc, 'a'), " ");
+	pfl(pc);
 }
 
 defn findsrc(file)
@@ -178,6 +212,22 @@ defn Bsrc(addr)
 	print("no source for ", file, "\n");
 }
 
+defn srcline(addr)
+{
+	local text, cline, line, file, src;
+	file = pcfile(addr);
+	src = match(file,srcfiles);
+	if (src>=0) then
+		src = srctext[src];
+	else
+		src = findsrc(file);
+	if (src=={}) then
+	{
+		return "(no source)";
+	}
+	return src[pcline(addr)-1];
+}
+
 defn src(addr)
 {
 	local src, file, line, cline, text;

+ 132 - 57
sys/lib/acid/thread

@@ -1,19 +1,25 @@
 include("/sys/src/libthread/sched.acid");
 
-defn labstk(l)
+defn labpc(l)
 {
 	if objtype == "386" then
-		_stk(longjmp, *l, linkreg(0), 0);
-	else
-		_stk(*(l+4), *l, linkreg(0), 0);
+		return longjmp;
+	return *(l+4);
+}
+
+defn labsp(l)
+{
+	return *l;
+}
+
+defn labstk(l)
+{
+	_stk(labpc(l), labsp(l), 0, 0);
 }
 
 defn lablstk(l)
 {
-	if objtype == "386" then
-		_stk(longjmp, *l, linkreg(0), 1);
-	else
-		_stk(*(l+4), *l, linkreg(0), 1);
+	_stk(labpc(l), labsp(l), 0, 1);
 }
 
 defn altfmt(A){
@@ -21,18 +27,18 @@ defn altfmt(A){
 	complex Alt A;
 
 	s = "alt(";
-	s = s + "tag(*" + itoa(A.tag\X) + "=" + itoa(*A.tag\X) + ") ";
+	s = s + "tag(*" + itoa(A.tag, "%x") + "=" + itoa(*A.tag, "%x") + ") ";
 	i = 0;
 	yes = 0;
 	while A.op != CHANEND && A.op != CHANNOBLK do{
 		if A.op != CHANNOP then{
-			if yes then s = s + ", ";
-			s = s + itoa(i);
-			s = s + ": ";
+			if yes then s = s + " ";
+			s = s + itoa(i, "%d");
+			s = s + ":";
 			if A.op == CHANSND then s = s + "send";
 			if A.op == CHANRCV then s = s + "recv";
 			s = s + "(channel(";
-			s = s + itoa(A.c);
+			s = s + itoa(A.c, "%x");
 			s = s + "))";
 			yes = 1;
 		}
@@ -40,7 +46,7 @@ defn altfmt(A){
 		A = (Alt)(A + sizeofAlt);
 	}
 	if A.op==CHANNOBLK then{
-		if yes then s = s + ", ";
+		if yes then s = s + " ";
 		s = s + "noblock";
 	}
 	s = s + ")";
@@ -51,48 +57,106 @@ defn alt(A){
 	print(altfmt(A), "\n");
 }
 
-defn thread(T){
-	complex Thread T;
-	local A, yes, i, P;
+threadignsrc = {
+	"^/sys/src/libc",
+	"^/sys/src/libthread",
+};
 
-	P = (Proc)T.proc;
-	if T.cmdname != 0 then{
-		print("\t", *(T.cmdname\s), ":\n");
+defn fnname(a){
+	local sym, s;
+
+	s = symbols;
+	while s do {
+		sym = head s;
+		if sym[2] == a then
+			return sym[0];
+		s = tail s;
 	}
-	print("\t", T\X, "\t", T.id);
+	return itoa(a, "%x");
+}
+
+defn threadstkline(T){
+	local stk, frame, pc, pc0, file, lastpc0, s, sym, i, stop;
+
 	if T.state == Running then{
-		print("\t\tRunning   ");
-	} else if T.state == Ready then{
-		print("\t\tReady     ");
-	} else if T.state == Rendezvous then{
-		print("\t\tRendezvous ");
+		pc = *PC;
+		stk = strace(*PC, *SP, linkreg(0));
 	}else{
-		print("\t\tBad state ", T.state\X, " ");
+		pc = labpc(T.sched);
+		stk = strace(labpc(T.sched), labsp(T.sched), 0);
 	}
-	if T.chan == Chanalt then{
-		print("\t\t", altfmt(T.alt), "\n");
-	} else if T.chan == Chansend then{
-		A = (Alt)T.alt;
-		print("\t\tsend(Channel(", A.c\X, "))");
-	} else if T.chan == Chanrecv then{
-		A = (Alt)T.alt;
-		print("\t\trecv(Channel(", A.c\X, "))");
-	}
-	if T.moribund == 1 then{
-		print(" (Moribund)");
+	lastpc0 = 0;
+	pc0 = 0;
+	stop = 0;
+	while stk && !stop do {
+		file = pcfile(pc);
+		if !regexp("^/sys/src/libc/", file)
+		&& !regexp("^/sys/src/libthread/", file) then
+			stop = 1;
+		else{
+			lastpc0 = pc0;
+			frame = head stk;
+			stk = tail stk;
+			pc0 = frame[0];
+			pc = frame[1];
+		}
 	}
-	print("\n");
+	file = pcfile(pc);
+	s = file+":"+itoa(pcline(pc), "%d");
+	if pc0 != 0 then 
+		s = s + " "+fnname(pc0);
+	return s;
+}
+
+defn threadfmt(T){
+	complex Thread T;
+	local A, yes, i, P, s;
+
+	P = (Proc)T.proc;
+	s = "t=(Thread)"+itoa(T, "%-10x")+" ";
+
+	if T.state == Running then
+		s = s + "Running    ";
+	else if T.state == Ready then
+		s = s + "Ready      ";
+	else if T.state == Rendezvous then
+		s = s + "Rendez     ";
+	else
+		s = s + "Bad state "+itoa(T.state, "%x")+" ";
+
+	A = (Alt)T.alt;
+	if 1 then
+		s = s + threadstkline(T);
+	else if T.chan == Chanalt then
+		s = s + altfmt(T.alt);
+	else if T.chan == Chansend then
+		s = s + "send(Channel("+itoa(A.c, "%x")+"))";
+	else if T.chan == Chanrecv then
+		s = s + "recv(Channel("+itoa(A.c, "%x")+"))";
+	else
+		s = s + threadstkline(T);
+
+	if T.moribund == 1 then
+		s = s + " Moribund";
+	if T.cmdname != 0 then
+		s = s + " ["+*(T.cmdname\s)+"]";
+	return s;
+}
+
+defn thread(T){
+	print(threadfmt(T), "\n");
 }
 
 defn pthreads(P){
 	complex Proc P;
-	local T, Tq;
+	local T, Tq, mainpid;
 
 	mainpid = pid;
 	setproc(P.pid);
 	Tq = (Tqueue)P.threads;
 	T = (Thread)Tq.$head;
 	while T != 0 do{
+		print("\t");
 		thread(T);
 		T = T.nextt;
 	}
@@ -111,26 +175,27 @@ defn threads(){
 }
 
 defn stacks(){
-	local P;
+	local P, mainpid;
 
 	mainpid = pid;
 	P = (Proc)_threadpq.$head;
 	while P != 0 do{
-		print("=========================================================\n");
 		proc(P);
-		setproc(P.pid);
-		if P.thread==0 then{
-			print("=== thread scheduler stack\n");
-			stk();
-		}
+	//	setproc(P.pid);
+	//	if P.thread==0 then{
+	//		print("=== thread scheduler stack\n");
+	//		stk();
+	//	}
+	//	print("threadstks(", P\X, ")\n");
 		threadstks(P);
 		P = P.next;
+		print("\n");
 	}
 	setproc(mainpid);
 }
 
 defn stacksizes(){
-	local P, T, Tq, top, sp;
+	local P, T, Tq, top, sp, mainpid;
 
 	mainpid = pid;
 	P = (Proc)_threadpq.$head;
@@ -161,31 +226,41 @@ defn lproc(P){
 
 defn threadstks(P){
 	complex Proc P;
-	local T, Tq;
+	local T, Tq, mainpid, pref, ign;
 
 	mainpid = pid;
+	pref = stkprefix;
+	stkprefix = pref+"\t\t";
+	ign = stkignore;
+	stkignore = {
+		"^/sys/src/libthread/",
+		"^/sys/src/libc/(386|arm|alpha|sparc|power|mips)/"
+	};
 	setproc(P.pid);
 	Tq = (Tqueue)P.threads;
 	T = (Thread)Tq.$head;
 	while T != 0 do{
-		print("=============================\n");
+	//	print("=============================\n");
+	//	print("  thread(", T\X, ")\n");
+		print("\t");
 		thread(T);
-		print("\n");
 		threadstk(T);
 		T = T.nextt;
+		print("\n");
 	}
 	setproc(mainpid);
+	stkprefix = pref;
+	stkignore = ign;
 }
 
 defn proc(P){
 	complex Proc P;
 
-	print("Proc *p=", P\X, ", p->pid=", P.pid\D);
-	if P.thread==0 then{
-		print(", p->state=Sched, p->tag=", P\X);
-	}else{
-		print(", p->state=Running");
-	}
+	print("p=(Proc)", itoa(P, "%-10x"), " pid ", P.pid\D, " ");
+	if P.thread==0 then
+		print(" Sched");
+	else
+		print(" Running");
 	print("\n");
 }
 

+ 1 - 1
sys/man/4/nfs

@@ -90,7 +90,7 @@ and
 files, which are in the traditional Unix format.
 The translation is used to present names for
 user and group in
-.I stat (5)
+.IR stat (5)
 and
 .I wstat
 messages.

+ 1 - 0
sys/src/9/pc/pc

@@ -102,6 +102,7 @@ port
 
 boot
 	il
+	tcp
 
 bootdir
 	bootpc.out boot

+ 1 - 0
sys/src/9/pc/pcauth

@@ -55,6 +55,7 @@ port
 
 boot cpu boot #S/sdC0/
 	il
+	tcp
 	local
 
 bootdir

+ 1 - 0
sys/src/9/pc/pccpu

@@ -68,6 +68,7 @@ port
 
 boot cpu
 	il
+	tcp
 
 bootdir
 	bootpccpu.out boot

+ 1 - 0
sys/src/9/pc/pcdisk

@@ -101,6 +101,7 @@ port
 
 boot boot #S/sdC0/
 	il
+	tcp
 	local
 
 bootdir

+ 1 - 1
sys/src/cmd/db/print.c

@@ -363,6 +363,6 @@ printparams(Symbol *fn, ADDR fp)
 		if (first++)
 			dprint(", ");
 		if (get4(cormap, fp+s.value, &v) > 0)
-			dprint("%s=%lux", s.name, v);
+			dprint("%s=%#lux", s.name, v);
 	}
 }

+ 3 - 1
sys/src/cmd/nfs.c

@@ -338,6 +338,7 @@ nfsWrite(Auth *a, ulong tag, Nfs3Handle *h, uchar *data, u32int count, u64int of
 	tx.count = count;
 	tx.offset = offset;
 	tx.data = data;
+	tx.ndata = count;
 
 	memset(&rx, 0, sizeof rx);
 	nfs3Call(a, &rx.call, Nfs3CallRWrite);
@@ -544,12 +545,13 @@ nfsReadDir(Auth *a, ulong tag, Nfs3Handle *h, u32int count, u64int cookie, uchar
 			readplus = 1;
 			return 0;
 		}
-fprint(2, "readdirplus: %r\n");
 		if(readplus == 0){
 			rerrstr(e, sizeof e);
 			if(strstr(e, "procedure unavailable"))
 				readplus = -1;
 		}
+		if(readplus == 0)
+			fprint(2, "readdirplus: %r\n");
 	}
 	if(readplus == 1)
 		return -1;

+ 1 - 1
sys/src/cmd/rio/wind.c

@@ -608,7 +608,7 @@ wpaste(Window *w)
 		waddraw(w, snarf, nsnarf);
 		wsetselect(w, q0, q0);
 	}else{
-		winsert(w, snarf, nsnarf, w->q0);
+		q0 = winsert(w, snarf, nsnarf, w->q0);
 		wsetselect(w, q0, q0+nsnarf);
 	}
 }

+ 8 - 5
sys/src/libsunrpc/client.c

@@ -179,7 +179,7 @@ rpcMuxThread(void *v)
 
 	for(;;){
 		switch(alt(a)){
-		case 0:	/* rpcchan */
+		case 0:	/* o = <-rpcchan */
 			if(o == nil)
 				goto Done;
 			cli->nsend++;
@@ -212,7 +212,7 @@ if(cli->chatty) fprint(2, "send %lux %lud %lud\n", o->xid, o->st, o->t);
 			a[1].op = CHANRCV;
 			break;
 
-		case 1:	/* timerchan */
+		case 1:	/* <-timerchan */
 			t = msec();
 			for(i=0; i<nout; i++){
 				o = out[i];
@@ -244,7 +244,7 @@ if(cli->chatty) fprint(2, "resend %lux %lud %lud\n", o->xid, t, o->t);
 				a[1].op = CHANNOP;
 			break;
 			
-		case 2:	/* flushchan */
+		case 2:	/* tag = <-flushchan */
 			for(i=0; i<nout; i++){
 				o = out[i];
 				if(o->tag == tag){
@@ -257,7 +257,7 @@ if(cli->chatty) fprint(2, "resend %lux %lud %lud\n", o->xid, t, o->t);
 			}
 			break;
 
-		case 3:	/* readchan */
+		case 3:	/* buf = <-readchan */
 			p = buf;
 			n = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3];
 			p += 4;
@@ -274,9 +274,12 @@ if(cli->chatty) fprint(2, "resend %lux %lud %lud\n", o->xid, t, o->t);
 				free(buf);
 				break;
 			}
-			for(i=0; i<nout; i++)
+			o = nil;
+			for(i=0; i<nout; i++){
+				o = out[i];
 				if(o->xid == rpc.xid)
 					break;
+			}
 			if(i==nout){
 				if(cli->chatty) fprint(2, "did not find waiting request\n");
 				free(buf);

+ 1 - 0
sys/src/libsunrpc/mkfile

@@ -16,6 +16,7 @@ OFILES=\
 	prog.$O\
 	rpc.$O\
 	server.$O\
+	suncall.$O\
 	udp.$O\
 	$PROTO\
 

+ 4 - 1
sys/src/libsunrpc/prog.c

@@ -28,8 +28,10 @@ sunCallUnpack(SunProg *prog, uchar *a, uchar *ea, uchar **pa, SunCall *c)
 		pa = &x;
 	if(c->type < 0 || c->type >= prog->nproc || (unpack=prog->proc[c->type].unpack) == nil)
 		return SunProcUnavail;
-	if((*unpack)(a, ea, pa, c) < 0)
+	if((*unpack)(a, ea, pa, c) < 0){
+		fprint(2, "in: %.*H unpack failed\n", (int)(ea-a), a);
 		return SunGarbageArgs;
+	}
 	return SunSuccess;
 }
 
@@ -53,6 +55,7 @@ sunCallUnpackAlloc(SunProg *prog, SunCallType type, uchar *a, uchar *ea, uchar *
 		return SunSystemErr;
 	c->type = type;
 	if((*unpack)(a, ea, pa, c) < 0){
+		fprint(2, "in: %.*H unpack failed\n", (int)(ea-a), a);
 		free(c);
 		return SunGarbageArgs;
 	}

+ 10 - 10
sys/src/libsunrpc/server.c

@@ -89,21 +89,21 @@ sunRpcRequestThread(void *v)
 	while((m = recvp(srv->crequest)) != nil){
 		/* could look up in cache here? */
 
-if(srv->chatty) print("sun msg %p count %d\n", m, m->count);
+if(srv->chatty) fprint(2, "sun msg %p count %d\n", m, m->count);
 		m->srv = srv;
 		p = m->data;
 		ep = p+m->count;
 		if(sunRpcUnpack(p, ep, &p, &m->rpc) < 0){
-			print("in: %.*H unpack failed\n", m->count, m->data);
+			fprint(2, "in: %.*H unpack failed\n", m->count, m->data);
 			sunMsgDrop(m);
 			continue;
 		}
 		if(srv->chatty)
-			print("in: %B\n", &m->rpc);
+			fprint(2, "in: %B\n", &m->rpc);
 
 		if(srv->alwaysReject){
 			if(srv->chatty)
-				print("\trejecting\n");
+				fprint(2, "\trejecting\n");
 			sunMsgReplyError(m, SunAuthTooWeak);
 			continue;
 		}
@@ -128,7 +128,7 @@ if(srv->chatty) print("sun msg %p count %d\n", m, m->count);
 		m->call->rpc = m->rpc;
 
 		if(srv->chatty)
-			print("\t%C\n", m->call);
+			fprint(2, "\t%C\n", m->call);
 
 		m->pg = pg;
 		sendp(c, m);
@@ -160,14 +160,14 @@ sunFindProg(SunSrv *srv, SunMsg *m, SunRpc *rpc, Channel **pc)
 	}
 	if(vhi == -1){
 		if(srv->chatty)
-			print("\tprogram %ud unavailable\n", rpc->prog);
+			fprint(2, "\tprogram %ud unavailable\n", rpc->prog);
 		sunMsgReplyError(m, SunProgUnavail);
 	}else{
 		/* putting these in rpc is a botch */
 		rpc->low = vlo;
 		rpc->high = vhi;
 		if(srv->chatty)
-			print("\tversion %ud unavailable; have %d-%d\n", rpc->vers, vlo, vhi);
+			fprint(2, "\tversion %ud unavailable; have %d-%d\n", rpc->vers, vlo, vhi);
 		sunMsgReplyError(m, SunProgMismatch);
 	}
 	return nil;
@@ -198,7 +198,7 @@ sunMsgReplyError(SunMsg *m, SunStatus error)
 	m->rpc.ndata = 0;
 
 	if(m->srv->chatty)
-		print("out: %B\n", &m->rpc);
+		fprint(2, "out: %B\n", &m->rpc);
 
 	n = sunRpcSize(&m->rpc);
 	bp = emalloc(n);
@@ -235,8 +235,8 @@ sunMsgReply(SunMsg *m, SunCall *c)
 	c->rpc.xid = m->rpc.xid;
 
 	if(m->srv->chatty){
-		print("out: %B\n", &c->rpc);
-		print("\t%C\n", c);
+		fprint(2, "out: %B\n", &c->rpc);
+		fprint(2, "\t%C\n", c);
 	}
 
 	n1 = sunRpcSize(&c->rpc);

+ 14 - 0
sys/src/libsunrpc/suncall.c

@@ -0,0 +1,14 @@
+#include <u.h>
+#include <libc.h>
+#include <thread.h>
+#include <sunrpc.h>
+
+void
+sunCallSetup(SunCall *c, SunProg *prog, uint proc)
+{
+	c->rpc.prog = prog->prog;
+	c->rpc.vers = prog->vers;
+	c->rpc.proc = proc>>1;
+	c->rpc.iscall = !(proc&1);
+	c->type = proc;
+}