ref: a557c515c8c9c01fdb4f6cc850665be05accd84c
parent: 4c7745b202cf94203ac92a897f4bbb6792abe508
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Oct 16 09:12:59 EDT 2021
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().
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -634,7 +634,7 @@
lock(&procalloc);
p = procalloc.free;
- if(p == nil){
+ if(p == nil || (p->kstack == nil && (p->kstack = malloc(KSTACK)) == nil)){
unlock(&procalloc);
return nil;
}
@@ -655,8 +655,6 @@
p->nlocks = 0;
p->delaysched = 0;
p->trace = 0;
- if(p->kstack == nil)
- p->kstack = smalloc(KSTACK);
/* sched params */
p->mp = nil;