Browse Source

Plan 9 from Bell Labs 2009-10-06

David du Colombier 14 years ago
parent
commit
388c2512cd

+ 7 - 1
sys/man/2/lock

@@ -295,7 +295,7 @@ where some other process holds the lock.
 After a thousand unsuccessful attempts,
 .I lock
 sleeps for 100ms between attempts.
-Another another thousand unsuccessful attempts,
+After another thousand unsuccessful attempts,
 .I lock
 sleeps for a full second between attempts.
 .B Locks
@@ -305,3 +305,9 @@ avoid tying up the CPU when a process deadlocks.
 As discussed above,
 if a lock is to be held for much more than a few instructions,
 the queueing lock types should be almost always be used.
+.PP
+It is an error for a program to
+.I fork
+when it holds a lock in shared memory, since this will result
+in two processes holding the same lock at the same time,
+which should not happen.

+ 1 - 1
sys/src/cmd/1c/gc.h

@@ -281,7 +281,7 @@ Node*	nodconst(long);
 int	swcmp(const void*, const void*);
 void	doswit(int, Node*);
 void	swit1(C1*, int, long, int, Node*);
-void	cas(void);
+void	casf(void);
 int	bitload(Node*, int, int, int, Node*);
 void	bitstore(Node*, int, int, int, int, Node*);
 long	outstring(char*, long);

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

@@ -132,7 +132,7 @@ loop:
 		if(cases == C)
 			diag(n, "case/default outside a switch");
 		if(l == Z) {
-			cas();
+			casf();
 			cases->val = 0;
 			cases->def = 1;
 			cases->label = pc;
@@ -144,7 +144,7 @@ loop:
 			goto rloop;
 		if(l->op == OCONST)
 		if(typechl[l->type->etype]) {
-			cas();
+			casf();
 			cases->val = l->vconst;
 			cases->def = 0;
 			cases->label = pc;
@@ -175,7 +175,7 @@ loop:
 
 		cn = cases;
 		cases = C;
-		cas();
+		casf();
 
 		sbc = breakpc;
 		breakpc = pc;

+ 1 - 1
sys/src/cmd/1c/swt.c

@@ -106,7 +106,7 @@ linear:
 }
 
 void
-cas(void)
+casf(void)
 {
 	Case *c;
 

+ 1 - 1
sys/src/cmd/2c/gc.h

@@ -298,7 +298,7 @@ Node*	nodconst(long);
 int	swcmp(const void*, const void*);
 void	doswit(int, Node*);
 void	swit1(C1*, int, long, int, Node*);
-void	cas(void);
+void	casf(void);
 int	bitload(Node*, int, int, int, Node*);
 void	bitstore(Node*, int, int, int, int, Node*);
 long	outstring(char*, long);

+ 3 - 3
sys/src/cmd/2c/sgen.c

@@ -132,7 +132,7 @@ loop:
 		if(cases == C)
 			diag(n, "case/default outside a switch");
 		if(l == Z) {
-			cas();
+			casf();
 			cases->val = 0;
 			cases->def = 1;
 			cases->label = pc;
@@ -144,7 +144,7 @@ loop:
 			goto rloop;
 		if(l->op == OCONST)
 		if(typechl[l->type->etype]) {
-			cas();
+			casf();
 			cases->val = l->vconst;
 			cases->def = 0;
 			cases->label = pc;
@@ -175,7 +175,7 @@ loop:
 
 		cn = cases;
 		cases = C;
-		cas();
+		casf();
 
 		sbc = breakpc;
 		breakpc = pc;

+ 1 - 1
sys/src/cmd/2c/swt.c

@@ -186,7 +186,7 @@ linear:
 }
 
 void
-cas(void)
+casf(void)
 {
 	Case *c;
 

+ 1 - 1
sys/src/cmd/5c/gc.h

@@ -269,7 +269,7 @@ int	swcmp(const void*, const void*);
 void	doswit(Node*);
 void	swit1(C1*, int, long, Node*);
 void	swit2(C1*, int, long, Node*, Node*);
-void	cas(void);
+void	casf(void);
 void	bitload(Node*, Node*, Node*, Node*, Node*);
 void	bitstore(Node*, Node*, Node*, Node*, Node*);
 long	outstring(char*, long);

+ 1 - 1
sys/src/cmd/7c/gc.h

@@ -268,7 +268,7 @@ int	swcmp(void*, void*);
 void	doswit(Node*);
 void	swit1(C1*, int, long, Node*);
 void	swit2(C1*, int, long, Node*, Node*);
-void	cas(void);
+void	casf(void);
 void	bitload(Node*, Node*, Node*, Node*, Node*);
 void	bitstore(Node*, Node*, Node*, Node*, Node*);
 long	outstring(char*, long);

+ 1 - 1
sys/src/cmd/8c/gc.h

@@ -269,7 +269,7 @@ void	gpseudo(int, Sym*, Node*);
 int	swcmp(const void*, const void*);
 void	doswit(Node*);
 void	swit1(C1*, int, long, Node*);
-void	cas(void);
+void	casf(void);
 void	bitload(Node*, Node*, Node*, Node*, Node*);
 void	bitstore(Node*, Node*, Node*, Node*, Node*);
 long	outstring(char*, long);

+ 3 - 3
sys/src/cmd/cc/pgen.c

@@ -231,7 +231,7 @@ loop:
 		if(cases == C)
 			diag(n, "case/default outside a switch");
 		if(l == Z) {
-			cas();
+			casf();
 			cases->val = 0;
 			cases->def = 1;
 			cases->label = pc;
@@ -243,7 +243,7 @@ loop:
 			goto rloop;
 		if(l->op == OCONST)
 		if(typeword[l->type->etype] && l->type->etype != TIND) {
-			cas();
+			casf();
 			cases->val = l->vconst;
 			cases->def = 0;
 			cases->label = pc;
@@ -268,7 +268,7 @@ loop:
 
 		cn = cases;
 		cases = C;
-		cas();
+		casf();
 
 		sbc = breakpc;
 		breakpc = pc;

+ 1 - 1
sys/src/cmd/cc/pickle.c

@@ -195,7 +195,7 @@ pickletype(Type *t)
 			goto asmstr;
 		an = pmap(s->name);
 
-		Bprint(&outbuf, "char *\npickle_%s(char *bp, char *ep, int un, %s *addr)\n{\n\tint _i = 0;\n\n\tUSED(_i);\n", an, an);
+		Bprint(&outbuf, "uchar*\npickle_%s(uchar *bp, uchar *ep, int un, %s *addr)\n{\n\tint _i = 0;\n\n\tUSED(_i);\n", an, an);
 		for(l = t->link; l != T; l = l->down)
 			picklemember(l, 0);
 		Bprint(&outbuf, "\treturn bp;\n}\n\n");

+ 1 - 1
sys/src/cmd/cc/pswt.c

@@ -62,7 +62,7 @@ doswit(Node *n)
 }
 
 void
-cas(void)
+casf(void)
 {
 	Case *c;
 

+ 1 - 1
sys/src/cmd/kc/gc.h

@@ -259,7 +259,7 @@ int	swcmp(const void*, const void*);
 void	doswit(Node*);
 void	swit1(C1*, int, long, Node*);
 void	swit2(C1*, int, long, Node*, Node*);
-void	cas(void);
+void	casf(void);
 void	bitload(Node*, Node*, Node*, Node*, Node*);
 void	bitstore(Node*, Node*, Node*, Node*, Node*);
 long	outstring(char*, long);

+ 1 - 1
sys/src/cmd/qc/gc.h

@@ -275,7 +275,7 @@ int	swcmp(void*, void*);
 void	doswit(Node*);
 void	swit1(C1*, int, long, Node*);
 void	swit2(C1*, int, long, Node*, Node*);
-void	cas(void);
+void	casf(void);
 void	bitload(Node*, Node*, Node*, Node*, Node*);
 void	bitstore(Node*, Node*, Node*, Node*, Node*);
 long	outstring(char*, long);

+ 1 - 1
sys/src/cmd/vc/gc.h

@@ -260,7 +260,7 @@ int	swcmp(const void*, const void*);
 void	doswit(Node*);
 void	swit1(C1*, int, long, Node*);
 void	swit2(C1*, int, long, Node*, Node*);
-void	cas(void);
+void	casf(void);
 void	bitload(Node*, Node*, Node*, Node*, Node*);
 void	bitstore(Node*, Node*, Node*, Node*, Node*);
 long	outstring(char*, long);