kernel: dont block allocating kstack for new processes
Have newproc() fail returning nil if we can't allocate the kernel stack instead of locking up in smalloc().
This commit is contained in:
parent
4c7745b202
commit
a557c515c8
1 changed files with 1 additions and 3 deletions
|
@ -634,7 +634,7 @@ newproc(void)
|
||||||
|
|
||||||
lock(&procalloc);
|
lock(&procalloc);
|
||||||
p = procalloc.free;
|
p = procalloc.free;
|
||||||
if(p == nil){
|
if(p == nil || (p->kstack == nil && (p->kstack = malloc(KSTACK)) == nil)){
|
||||||
unlock(&procalloc);
|
unlock(&procalloc);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -655,8 +655,6 @@ newproc(void)
|
||||||
p->nlocks = 0;
|
p->nlocks = 0;
|
||||||
p->delaysched = 0;
|
p->delaysched = 0;
|
||||||
p->trace = 0;
|
p->trace = 0;
|
||||||
if(p->kstack == nil)
|
|
||||||
p->kstack = smalloc(KSTACK);
|
|
||||||
|
|
||||||
/* sched params */
|
/* sched params */
|
||||||
p->mp = nil;
|
p->mp = nil;
|
||||||
|
|
Loading…
Reference in a new issue