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

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

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