Browse Source

Plan 9 from Bell Labs 2013-09-05

David du Colombier 10 years ago
parent
commit
5853170001
2 changed files with 12 additions and 9 deletions
  1. 9 7
      sys/man/2/malloc
  2. 3 2
      sys/src/9/port/proc.c

+ 9 - 7
sys/man/2/malloc

@@ -78,7 +78,7 @@ is non-zero, the memory returned will be zeroed.
 .PP
 .I Mallocalign
 allocates a block of at least 
-.I n
+.I size
 bytes of memory respecting alignment contraints.
 If
 .I align
@@ -91,8 +91,8 @@ If
 .I span
 is non-zero,
 the
-.I n
-byte block allocated will not span a
+.IR size -byte
+block allocated will not span a
 .IR span -byte
 boundary.
 .PP
@@ -107,18 +107,20 @@ The contents will be unchanged up to the
 lesser of the new and old sizes.
 .I Realloc
 takes on special meanings when one or both arguments are zero:
+.TF "\fLrealloc(0, sz)
+.PD
 .TP
-.B "realloc(0,\ size)
+.B "realloc(0, sz)
 means
-.LR malloc(size) ;
+.LR malloc(sz) ;
 returns a pointer to the newly-allocated memory
 .TP
-.B "realloc(ptr,\ 0)
+.B "realloc(ptr, 0)
 means
 .LR free(ptr) ;
 returns null
 .TP
-.B "realloc(0,\ 0)
+.B "realloc(0, 0)
 no-op; returns null
 .PD
 .PP

+ 3 - 2
sys/src/9/port/proc.c

@@ -419,7 +419,7 @@ ready(Proc *p)
 		return;
 	}
 
-	if(up != p)
+	if(up != p && (p->wired == nil || p->wired == m))
 		m->readied = p;	/* group scheduling */
 
 	updatecpu(p);
@@ -505,6 +505,7 @@ runproc(void)
 
 	/* cooperative scheduling until the clock ticks */
 	if((p=m->readied) && p->mach==0 && p->state==Ready
+	&& (p->wired == nil || p->wired == m)
 	&& runq[Nrq-1].head == nil && runq[Nrq-2].head == nil){
 		skipscheds++;
 		rq = &runq[p->priority];
@@ -848,7 +849,7 @@ tsleep(Rendez *r, int (*fn)(void*), void *arg, ulong ms)
 		nexterror();
 	}
 	sleep(r, tfn, arg);
-	if (up->tt)
+	if(up->tt)
 		timerdel(up);
 	up->twhen = 0;
 	poperror();