Browse Source

Plan 9 from Bell Labs 2005-09-20

David du Colombier 15 years ago
parent
commit
2657b675d6

+ 10 - 9
dist/replica/_plan9.db

@@ -8003,7 +8003,7 @@ sys/src/9/pc/sdmylex.c - 664 sys sys 1071245460 27812
 sys/src/9/pc/sdscsi.c - 664 sys sys 1077033661 7487
 sys/src/9/pc/trap.c - 664 sys sys 1123438642 20550
 sys/src/9/pc/uarti8250.c - 664 sys sys 1102820421 13958
-sys/src/9/pc/uartisa.c - 664 sys sys 1111725178 1775
+sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
 sys/src/9/pc/uartpci.c - 664 sys sys 1096379063 2891
 sys/src/9/pc/usb.h - 664 sys sys 1099760881 3650
 sys/src/9/pc/usbuhci.c - 664 sys sys 1099760881 30955
@@ -8708,8 +8708,9 @@ sys/src/ape/lib/ap/stdio/_IO_getc.c - 664 sys sys 1038237530 527
 sys/src/ape/lib/ap/stdio/_IO_putc.c - 664 sys sys 1014921981 1895
 sys/src/ape/lib/ap/stdio/_dtoa.c - 664 sys sys 1014921983 15559
 sys/src/ape/lib/ap/stdio/_fconv.c - 664 sys sys 1014921983 9016
+sys/src/ape/lib/ap/stdio/atexit.c - 664 sys sys 1127126836 220
 sys/src/ape/lib/ap/stdio/clearerr.c - 664 sys sys 1014921981 186
-sys/src/ape/lib/ap/stdio/exit.c - 664 sys sys 1014921981 456
+sys/src/ape/lib/ap/stdio/exit.c - 664 sys sys 1127126840 321
 sys/src/ape/lib/ap/stdio/fclose.c - 664 sys sys 1014921981 306
 sys/src/ape/lib/ap/stdio/fconv.h - 664 sys sys 1014921983 6538
 sys/src/ape/lib/ap/stdio/fdopen.c - 664 sys sys 1014921981 873
@@ -8738,7 +8739,7 @@ sys/src/ape/lib/ap/stdio/getc.c - 664 sys sys 1014921982 99
 sys/src/ape/lib/ap/stdio/getchar.c - 664 sys sys 1014921983 109
 sys/src/ape/lib/ap/stdio/gets.c - 664 sys sys 1014921982 261
 sys/src/ape/lib/ap/stdio/iolib.h - 664 sys sys 1014921982 1442
-sys/src/ape/lib/ap/stdio/mkfile - 664 sys sys 1050684343 829
+sys/src/ape/lib/ap/stdio/mkfile - 664 sys sys 1127126838 841
 sys/src/ape/lib/ap/stdio/perror.c - 664 sys sys 1014921982 236
 sys/src/ape/lib/ap/stdio/pow10.c - 664 sys sys 1014921982 429
 sys/src/ape/lib/ap/stdio/printf.c - 664 sys sys 1014921982 189
@@ -9253,7 +9254,7 @@ sys/src/cmd/9nfs/xfile.c - 664 sys sys 1017337816 1847
 sys/src/cmd/aan.c - 664 sys sys 1019856827 9758
 sys/src/cmd/acid - 20000000775 sys sys 944960739 0
 sys/src/cmd/acid/acid.h - 664 sys sys 1046198958 4354
-sys/src/cmd/acid/builtin.c - 664 sys sys 1071247428 19979
+sys/src/cmd/acid/builtin.c - 664 sys sys 1127126990 20156
 sys/src/cmd/acid/dbg.y - 664 sys sys 1081736447 5567
 sys/src/cmd/acid/dot.c - 664 sys sys 944960739 2161
 sys/src/cmd/acid/exec.c - 664 sys sys 1016833876 8187
@@ -14483,7 +14484,7 @@ sys/src/libgeometry/tstack.c - 664 sys sys 944961726 4716
 sys/src/libhtml - 20000000775 sys sys 1016902547 0
 sys/src/libhtml/build.c - 664 sys sys 1022112161 94832
 sys/src/libhtml/impl.h - 664 sys sys 1021580002 4627
-sys/src/libhtml/lex.c - 664 sys sys 1017251334 25806
+sys/src/libhtml/lex.c - 664 sys sys 1127183300 25915
 sys/src/libhtml/mkfile - 664 sys sys 1035389778 246
 sys/src/libhtml/strinttab.c - 664 sys sys 1016902547 1285
 sys/src/libhtml/utils.c - 664 sys sys 1021580002 9745
@@ -14644,14 +14645,14 @@ sys/src/libmp/mips/mpvecdigmulsub.s - 664 sys sys 953347683 1226
 sys/src/libmp/mips/mpvecsub.s - 664 sys sys 953347683 1209
 sys/src/libmp/mkfile - 664 sys sys 1032061370 923
 sys/src/libmp/port - 20000000775 sys sys 1014930548 0
-sys/src/libmp/port/betomp.c - 664 sys sys 964540763 577
+sys/src/libmp/port/betomp.c - 664 sys sys 1127128751 617
 sys/src/libmp/port/crt.c - 664 sys sys 1014930532 2050
 sys/src/libmp/port/crttest.c - 664 sys sys 956279160 813
 sys/src/libmp/port/dat.h - 664 sys sys 1045502198 350
 sys/src/libmp/port/letomp.c - 664 sys sys 1055700222 432
 sys/src/libmp/port/mkfile - 664 sys sys 1085667604 620
 sys/src/libmp/port/mpadd.c - 664 sys sys 984710624 783
-sys/src/libmp/port/mpaux.c - 664 sys sys 1055700209 2650
+sys/src/libmp/port/mpaux.c - 664 sys sys 1127128751 2685
 sys/src/libmp/port/mpcmp.c - 664 sys sys 1055700210 465
 sys/src/libmp/port/mpdigdiv.c - 664 sys sys 950104711 732
 sys/src/libmp/port/mpdiv.c - 664 sys sys 964540764 2423
@@ -14667,7 +14668,7 @@ sys/src/libmp/port/mpmul.c - 664 sys sys 1014930533 3110
 sys/src/libmp/port/mprand.c - 664 sys sys 956526245 584
 sys/src/libmp/port/mpright.c - 664 sys sys 1055700262 872
 sys/src/libmp/port/mpsub.c - 664 sys sys 984710625 792
-sys/src/libmp/port/mptobe.c - 664 sys sys 952888274 879
+sys/src/libmp/port/mptobe.c - 664 sys sys 1127128751 915
 sys/src/libmp/port/mptoi.c - 664 sys sys 1055700264 580
 sys/src/libmp/port/mptole.c - 664 sys sys 952888274 786
 sys/src/libmp/port/mptoui.c - 664 sys sys 984710625 413
@@ -14806,7 +14807,7 @@ sys/src/libsec/port/smallprimes.c - 664 sys sys 984710525 6851
 sys/src/libsec/port/smallprimetest.c - 664 sys sys 984710525 70640
 sys/src/libsec/port/thumb.c - 664 sys sys 1019832052 1891
 sys/src/libsec/port/tlshand.c - 664 sys sys 1126971523 54895
-sys/src/libsec/port/x509.c - 664 sys sys 1126971568 50653
+sys/src/libsec/port/x509.c - 664 sys sys 1127128751 50918
 sys/src/libsec/power - 20000000775 sys sys 984710502 0
 sys/src/libsec/power/mkfile - 664 sys sys 1032061453 139
 sys/src/libstdio - 20000000775 sys sys 984710098 0

+ 10 - 9
dist/replica/plan9.db

@@ -8003,7 +8003,7 @@ sys/src/9/pc/sdmylex.c - 664 sys sys 1071245460 27812
 sys/src/9/pc/sdscsi.c - 664 sys sys 1077033661 7487
 sys/src/9/pc/trap.c - 664 sys sys 1123438642 20550
 sys/src/9/pc/uarti8250.c - 664 sys sys 1102820421 13958
-sys/src/9/pc/uartisa.c - 664 sys sys 1111725178 1775
+sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
 sys/src/9/pc/uartpci.c - 664 sys sys 1096379063 2891
 sys/src/9/pc/usb.h - 664 sys sys 1099760881 3650
 sys/src/9/pc/usbuhci.c - 664 sys sys 1099760881 30955
@@ -8708,8 +8708,9 @@ sys/src/ape/lib/ap/stdio/_IO_getc.c - 664 sys sys 1038237530 527
 sys/src/ape/lib/ap/stdio/_IO_putc.c - 664 sys sys 1014921981 1895
 sys/src/ape/lib/ap/stdio/_dtoa.c - 664 sys sys 1014921983 15559
 sys/src/ape/lib/ap/stdio/_fconv.c - 664 sys sys 1014921983 9016
+sys/src/ape/lib/ap/stdio/atexit.c - 664 sys sys 1127126836 220
 sys/src/ape/lib/ap/stdio/clearerr.c - 664 sys sys 1014921981 186
-sys/src/ape/lib/ap/stdio/exit.c - 664 sys sys 1014921981 456
+sys/src/ape/lib/ap/stdio/exit.c - 664 sys sys 1127126840 321
 sys/src/ape/lib/ap/stdio/fclose.c - 664 sys sys 1014921981 306
 sys/src/ape/lib/ap/stdio/fconv.h - 664 sys sys 1014921983 6538
 sys/src/ape/lib/ap/stdio/fdopen.c - 664 sys sys 1014921981 873
@@ -8738,7 +8739,7 @@ sys/src/ape/lib/ap/stdio/getc.c - 664 sys sys 1014921982 99
 sys/src/ape/lib/ap/stdio/getchar.c - 664 sys sys 1014921983 109
 sys/src/ape/lib/ap/stdio/gets.c - 664 sys sys 1014921982 261
 sys/src/ape/lib/ap/stdio/iolib.h - 664 sys sys 1014921982 1442
-sys/src/ape/lib/ap/stdio/mkfile - 664 sys sys 1050684343 829
+sys/src/ape/lib/ap/stdio/mkfile - 664 sys sys 1127126838 841
 sys/src/ape/lib/ap/stdio/perror.c - 664 sys sys 1014921982 236
 sys/src/ape/lib/ap/stdio/pow10.c - 664 sys sys 1014921982 429
 sys/src/ape/lib/ap/stdio/printf.c - 664 sys sys 1014921982 189
@@ -9253,7 +9254,7 @@ sys/src/cmd/9nfs/xfile.c - 664 sys sys 1017337816 1847
 sys/src/cmd/aan.c - 664 sys sys 1019856827 9758
 sys/src/cmd/acid - 20000000775 sys sys 944960739 0
 sys/src/cmd/acid/acid.h - 664 sys sys 1046198958 4354
-sys/src/cmd/acid/builtin.c - 664 sys sys 1071247428 19979
+sys/src/cmd/acid/builtin.c - 664 sys sys 1127126990 20156
 sys/src/cmd/acid/dbg.y - 664 sys sys 1081736447 5567
 sys/src/cmd/acid/dot.c - 664 sys sys 944960739 2161
 sys/src/cmd/acid/exec.c - 664 sys sys 1016833876 8187
@@ -14483,7 +14484,7 @@ sys/src/libgeometry/tstack.c - 664 sys sys 944961726 4716
 sys/src/libhtml - 20000000775 sys sys 1016902547 0
 sys/src/libhtml/build.c - 664 sys sys 1022112161 94832
 sys/src/libhtml/impl.h - 664 sys sys 1021580002 4627
-sys/src/libhtml/lex.c - 664 sys sys 1017251334 25806
+sys/src/libhtml/lex.c - 664 sys sys 1127183300 25915
 sys/src/libhtml/mkfile - 664 sys sys 1035389778 246
 sys/src/libhtml/strinttab.c - 664 sys sys 1016902547 1285
 sys/src/libhtml/utils.c - 664 sys sys 1021580002 9745
@@ -14644,14 +14645,14 @@ sys/src/libmp/mips/mpvecdigmulsub.s - 664 sys sys 953347683 1226
 sys/src/libmp/mips/mpvecsub.s - 664 sys sys 953347683 1209
 sys/src/libmp/mkfile - 664 sys sys 1032061370 923
 sys/src/libmp/port - 20000000775 sys sys 1014930548 0
-sys/src/libmp/port/betomp.c - 664 sys sys 964540763 577
+sys/src/libmp/port/betomp.c - 664 sys sys 1127128751 617
 sys/src/libmp/port/crt.c - 664 sys sys 1014930532 2050
 sys/src/libmp/port/crttest.c - 664 sys sys 956279160 813
 sys/src/libmp/port/dat.h - 664 sys sys 1045502198 350
 sys/src/libmp/port/letomp.c - 664 sys sys 1055700222 432
 sys/src/libmp/port/mkfile - 664 sys sys 1085667604 620
 sys/src/libmp/port/mpadd.c - 664 sys sys 984710624 783
-sys/src/libmp/port/mpaux.c - 664 sys sys 1055700209 2650
+sys/src/libmp/port/mpaux.c - 664 sys sys 1127128751 2685
 sys/src/libmp/port/mpcmp.c - 664 sys sys 1055700210 465
 sys/src/libmp/port/mpdigdiv.c - 664 sys sys 950104711 732
 sys/src/libmp/port/mpdiv.c - 664 sys sys 964540764 2423
@@ -14667,7 +14668,7 @@ sys/src/libmp/port/mpmul.c - 664 sys sys 1014930533 3110
 sys/src/libmp/port/mprand.c - 664 sys sys 956526245 584
 sys/src/libmp/port/mpright.c - 664 sys sys 1055700262 872
 sys/src/libmp/port/mpsub.c - 664 sys sys 984710625 792
-sys/src/libmp/port/mptobe.c - 664 sys sys 952888274 879
+sys/src/libmp/port/mptobe.c - 664 sys sys 1127128751 915
 sys/src/libmp/port/mptoi.c - 664 sys sys 1055700264 580
 sys/src/libmp/port/mptole.c - 664 sys sys 952888274 786
 sys/src/libmp/port/mptoui.c - 664 sys sys 984710625 413
@@ -14806,7 +14807,7 @@ sys/src/libsec/port/smallprimes.c - 664 sys sys 984710525 6851
 sys/src/libsec/port/smallprimetest.c - 664 sys sys 984710525 70640
 sys/src/libsec/port/thumb.c - 664 sys sys 1019832052 1891
 sys/src/libsec/port/tlshand.c - 664 sys sys 1126971523 54895
-sys/src/libsec/port/x509.c - 664 sys sys 1126971568 50653
+sys/src/libsec/port/x509.c - 664 sys sys 1127128751 50918
 sys/src/libsec/power - 20000000775 sys sys 984710502 0
 sys/src/libsec/power/mkfile - 664 sys sys 1032061453 139
 sys/src/libstdio - 20000000775 sys sys 984710098 0

+ 11 - 0
dist/replica/plan9.log

@@ -21319,3 +21319,14 @@
 1127014238 14 c 386/bin/upas/smtpd - 775 sys sys 1127012956 329607
 1127014238 15 c 386/lib/libsec.a - 664 sys sys 1127012961 645922
 1127014238 16 c acme/bin/386/Mail - 775 sys sys 1127012960 179106
+1127127671 0 c sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
+1127127671 1 a sys/src/ape/lib/ap/stdio/atexit.c - 664 sys sys 1127126836 220
+1127127671 2 c sys/src/ape/lib/ap/stdio/exit.c - 664 sys sys 1127126840 321
+1127127671 3 c sys/src/ape/lib/ap/stdio/mkfile - 664 sys sys 1127126838 841
+1127127671 4 c sys/src/cmd/acid/builtin.c - 664 sys sys 1127126990 20156
+1127129466 0 c sys/src/libmp/port/betomp.c - 664 sys sys 1127128751 617
+1127129466 1 c sys/src/libmp/port/mpaux.c - 664 sys sys 1127128751 2685
+1127129466 2 c sys/src/libmp/port/mptobe.c - 664 sys sys 1127128751 915
+1127129466 3 c sys/src/libsec/port/x509.c - 664 sys sys 1127128751 50918
+1127149212 0 c sys/src/libhtml/lex.c - 664 sys sys 1127148223 25918
+1127183419 0 c sys/src/libhtml/lex.c - 664 sys sys 1127183300 25915

+ 1 - 1
sys/src/9/pc/uartisa.c

@@ -34,7 +34,7 @@ uartisa(int ctlrno, ISAConf* isa)
 	}
 
 	uart->regs = ctlr;
-	snprint(buf, sizeof(buf), "COM%d", ctlrno);
+	snprint(buf, sizeof(buf), "COM%d", ctlrno+1);
 	kstrdup(&uart->name, buf);
 	uart->freq = isa->freq;
 	uart->phys = &i8250physuart;

+ 15 - 0
sys/src/ape/lib/ap/stdio/atexit.c

@@ -0,0 +1,15 @@
+#include <unistd.h>
+#define	NONEXIT	34
+extern int (*_atexitfns[NONEXIT])(void);
+
+int
+atexit(int (*f)(void))
+{
+	int i;
+	for(i=0; i<NONEXIT; i++)
+		if(!_atexitfns[i]){
+			_atexitfns[i] = f;
+			return(0);
+		}
+	return(1);
+}

+ 0 - 10
sys/src/ape/lib/ap/stdio/exit.c

@@ -15,13 +15,3 @@ void exit(int status)
 	_doatexits();
 	_exit(status);
 }
-atexit(int (*f)(void))
-{
-	int i;
-	for(i=0; i<NONEXIT; i++)
-		if(!_atexitfns[i]){
-			_atexitfns[i] = f;
-			return(0);
-		}
-	return(1);
-}

+ 1 - 0
sys/src/ape/lib/ap/stdio/mkfile

@@ -7,6 +7,7 @@ OFILES=\
 	_dtoa.$O\
 	_fconv.$O\
 	clearerr.$O\
+	atexit.$O\
 	exit.$O\
 	fclose.$O\
 	fdopen.$O\

+ 13 - 0
sys/src/cmd/acid/builtin.c

@@ -39,6 +39,7 @@ void	readfile(Node*, Node*);
 void	interpret(Node*, Node*);
 void	include(Node*, Node*);
 void	regexp(Node*, Node*);
+void dosysr1(Node*, Node*);
 
 typedef struct Btab Btab;
 struct Btab
@@ -73,6 +74,7 @@ struct Btab
 	"status",	status,
 	"stop",		stop,
 	"strace",	strace,
+	"sysr1",	dosysr1,
 	"waitstop",	waitstop,
 	"map",		map,
 	"interpret",	interpret,
@@ -111,6 +113,17 @@ installbuiltin(void)
 	}
 }
 
+void
+dosysr1(Node *r, Node*)
+{
+	extern int sysr1(void);
+	
+	r->op = OCONST;
+	r->type = TINT;
+	r->fmt = 'D';
+	r->ival = sysr1();
+}
+
 void
 match(Node *r, Node *args)
 {

+ 5 - 3
sys/src/libhtml/lex.c

@@ -250,7 +250,7 @@ Rune* attrnames[] = {
 
 // Character entity to unicode character number map.
 // Keep sorted by name.
-StringInt	chartab[142]= {
+StringInt	chartab[]= {
 	{L"AElig", 198},
 	{L"Aacute", 193},
 	{L"Acirc", 194},
@@ -307,9 +307,9 @@ StringInt	chartab[142]= {
 	{L"eacute", 233},
 	{L"ecirc", 234},
 	{L"egrave", 232},
-	{L"emdash", 8212},
+	{L"emdash", 8212},	/* non-standard but commonly used */
 	{L"emsp", 8195},
-	{L"endash", 8211},
+	{L"endash", 8211},	/* non-standard but commonly used */
 	{L"ensp", 8194},
 	{L"epsilon", 949},
 	{L"eta", 951},
@@ -333,10 +333,12 @@ StringInt	chartab[142]= {
 	{L"ldots", 8230},
 	{L"lt", 60},
 	{L"macr", 175},
+	{L"mdash", 8212},
 	{L"micro", 181},
 	{L"middot", 183},
 	{L"mu", 956},
 	{L"nbsp", 160},
+	{L"ndash", 8211},
 	{L"not", 172},
 	{L"ntilde", 241},
 	{L"nu", 957},

+ 3 - 1
sys/src/libmp/port/betomp.c

@@ -9,8 +9,10 @@ betomp(uchar *p, uint n, mpint *b)
 	int m, s;
 	mpdigit x;
 
-	if(b == nil)
+	if(b == nil){
 		b = mpnew(0);
+		setmalloctag(b, getcallerpc(&p));
+	}
 
 	// dump leading zeros
 	while(*p == 0 && n > 1){

+ 1 - 0
sys/src/libmp/port/mpaux.c

@@ -58,6 +58,7 @@ mpnew(int n)
 		sysfatal("mpsetminbits: n < 0");
 
 	b = mallocz(sizeof(mpint), 1);
+	setmalloctag(b, getcallerpc(&n));
 	if(b == nil)
 		sysfatal("mpnew: %r");
 	n = DIGITS(n);

+ 1 - 0
sys/src/libmp/port/mptobe.c

@@ -15,6 +15,7 @@ mptobe(mpint *b, uchar *p, uint n, uchar **pp)
 	if(p == nil){
 		n = (b->top+1)*Dbytes;
 		p = malloc(n);
+		setmalloctag(p, getcallerpc(&b));
 	}
 	if(p == nil)
 		return -1;

+ 9 - 3
sys/src/libsec/port/x509.c

@@ -172,6 +172,7 @@ emalloc(int n)
 		exits("out of memory");
 	}
 	memset(p, 0, n);
+	setmalloctag(p, getcallerpc(&n));
 	return p;
 }
 
@@ -259,9 +260,11 @@ ber_decode(uchar** pp, uchar* pend, Elem* pelem)
 	if(err == ASN_OK) {
 		err = length_decode(pp, pend, &length);
 		if(err == ASN_OK) {
-			if(tag.class == Universal)
+			if(tag.class == Universal) {
 				err = value_decode(pp, pend, length, tag.num, isconstr, &val);
-			else
+				if(val.tag == VSeq || val.tag == VSet)
+					setmalloctag(val.u.seqval, getcallerpc(&pp));
+			}else
 				err = value_decode(pp, pend, length, OCTET_STRING, 0, &val);
 			if(err == ASN_OK) {
 				pelem->tag = tag;
@@ -498,6 +501,7 @@ value_decode(uchar** pp, uchar* pend, int length, int kind, int isconstr, Value*
 
 	case SEQUENCE:
 		err = seq_decode(&p, pend, length, isconstr, &vl);
+		setmalloctag(vl, getcallerpc(&pp));
 		if(err == ASN_OK) {
 			pval->tag = VSeq ;
 			pval->u.seqval = vl;
@@ -506,6 +510,7 @@ value_decode(uchar** pp, uchar* pend, int length, int kind, int isconstr, Value*
 
 	case SETOF:
 		err = seq_decode(&p, pend, length, isconstr, &vl);
+		setmalloctag(vl, getcallerpc(&pp));
 		if(err == ASN_OK) {
 			pval->tag = VSet;
 			pval->u.setval = vl;
@@ -742,6 +747,7 @@ seq_decode(uchar** pp, uchar* pend, int length, int isconstr, Elist** pelist)
 	}
 	*pp = p;
 	*pelist = ans;
+	setmalloctag(ans, getcallerpc(&pp));
 	return err;
 }
 
@@ -1402,6 +1408,7 @@ mkel(Elem e, Elist* tail)
 	Elist* el;
 
 	el = (Elist*)emalloc(sizeof(Elist));
+	setmalloctag(el, getcallerpc(&e));
 	el->hd = e;
 	el->tl = tail;
 	return el;
@@ -2042,7 +2049,6 @@ verify_signature(Bytes* signature, RSApub *pk, uchar *edigest, Elem **psigalg)
 	/* see 9.2.1 of rfc2437 */
 	pkcs1 = betomp(signature->data, signature->len, nil);
 	mpexp(pkcs1, pk->ek, pk->n, pkcs1);
-	pkcs1buf = nil;
 	buflen = mptobe(pkcs1, nil, 0, &pkcs1buf);
 	buf = pkcs1buf;
 	if(buflen != nlen || buf[0] != 1) {