Browse Source

Plan 9 from Bell Labs 2006-12-16

David du Colombier 17 years ago
parent
commit
da93de2833
5 changed files with 26 additions and 20 deletions
  1. 1 1
      dist/replica/_plan9.db
  2. 1 1
      dist/replica/plan9.db
  3. 2 0
      dist/replica/plan9.log
  4. 21 17
      sys/src/9/port/proc.c
  5. 1 1
      sys/src/cmd/rc/havefork.c

+ 1 - 1
dist/replica/_plan9.db

@@ -375,7 +375,7 @@
 386/bin/ps - 775 sys sys 1148500685 68906
 386/bin/pwd - 775 sys sys 1148500685 36932
 386/bin/ramfs - 775 sys sys 1148500686 90121
-386/bin/rc - 775 sys sys 1135101637 143284
+386/bin/rc - 775 sys sys 1166241174 143268
 386/bin/rdbfs - 775 sys sys 1160622244 174696
 386/bin/read - 775 sys sys 1148500687 58377
 386/bin/replica - 20000000775 sys sys 1018321168 0

+ 1 - 1
dist/replica/plan9.db

@@ -375,7 +375,7 @@
 386/bin/ps - 775 sys sys 1148500685 68906
 386/bin/pwd - 775 sys sys 1148500685 36932
 386/bin/ramfs - 775 sys sys 1148500686 90121
-386/bin/rc - 775 sys sys 1135101637 143284
+386/bin/rc - 775 sys sys 1166241174 143268
 386/bin/rdbfs - 775 sys sys 1160622244 174696
 386/bin/read - 775 sys sys 1148500687 58377
 386/bin/replica - 20000000775 sys sys 1018321168 0

+ 2 - 0
dist/replica/plan9.log

@@ -31794,3 +31794,5 @@
 1165968006 2 c sys/src/cmd/upas/fs/mbox.c - 664 sys sys 1165967884 27070
 1165968006 3 c sys/src/cmd/upas/fs/plan9.c - 664 sys sys 1165967878 7480
 1165969806 0 c sys/games/lib/fortunes - 664 sys sys 1165968371 262152
+1166229006 0 c 386/bin/rc - 775 sys sys 1166228518 143268
+1166241606 0 c 386/bin/rc - 775 sys sys 1166241174 143268

+ 21 - 17
sys/src/9/port/proc.c

@@ -866,8 +866,10 @@ wakeup(Rendez *r)
 
 	if(p != nil){
 		lock(&p->rlock);
-		if(p->state != Wakeme || p->r != r)
+		if(p->state != Wakeme || p->r != r){
+			iprint("%p %p %d\n", p->r, r, p->state);
 			panic("wakeup: state");
+		}
 		r->p = nil;
 		p->r = nil;
 		ready(p);
@@ -1099,28 +1101,30 @@ pexit(char *exitstr, int freemem)
 
 		lock(&p->exl);
 		/*
-		 *  If my parent is no longer alive, or if there would be more
-		 *  than 128 zombie child processes for my parent, then don't
-		 *  leave a wait record behind.  This helps prevent badly
-		 *  written daemon processes from accumulating lots of wait
-		 *  records.
+		 * Check that parent is still alive.
 		 */
-		if(p->pid == up->parentpid && p->state != Broken && p->nwait < 128) {
+		if(p->pid == up->parentpid && p->state != Broken) {
 			p->nchild--;
 			p->time[TCUser] += utime;
 			p->time[TCSys] += stime;
-
-			wq->next = p->waitq;
-			p->waitq = wq;
-			p->nwait++;
-
-			wakeup(&p->waitr);
-			unlock(&p->exl);
+			/*
+			 * If there would be more than 128 wait records
+			 * processes for my parent, then don't leave a wait
+			 * record behind.  This helps prevent badly written
+			 * daemon processes from accumulating lots of wait
+			 * records.
+		 	 */
+			if(p->nwait < 128) {
+				wq->next = p->waitq;
+				p->waitq = wq;
+				p->nwait++;
+				wq = nil;
+				wakeup(&p->waitr);
+			}
 		}
-		else {
-			unlock(&p->exl);
+		unlock(&p->exl);
+		if(wq)
 			free(wq);
-		}
 	}
 
 	if(!freemem)

+ 1 - 1
sys/src/cmd/rc/havefork.c

@@ -16,7 +16,7 @@ Xasync(void)
 		Xerror("Can't open /dev/null\n");
 		return;
 	}
-	switch(pid = rfork(RFFDG|RFPROC|RFNOTEG)){
+	switch(pid = rfork(RFFDG|RFPROC|RFNOTEG|RFNOWAIT)){
 	case -1:
 		close(null);
 		Xerror("try again");