diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-10-16 13:12:59 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-10-16 13:12:59 +0000 |
commit | a557c515c8c9c01fdb4f6cc850665be05accd84c (patch) | |
tree | b266507ae5fbdd4d29e80b93b04e6b271a891fbe /sys/src/9/port/proc.c | |
parent | 4c7745b202cf94203ac92a897f4bbb6792abe508 (diff) |
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().
Diffstat (limited to 'sys/src/9/port/proc.c')
-rw-r--r-- | sys/src/9/port/proc.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/src/9/port/proc.c b/sys/src/9/port/proc.c index 782abc795..401a462b1 100644 --- a/sys/src/9/port/proc.c +++ b/sys/src/9/port/proc.c @@ -634,7 +634,7 @@ newproc(void) 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 @@ newproc(void) p->nlocks = 0; p->delaysched = 0; p->trace = 0; - if(p->kstack == nil) - p->kstack = smalloc(KSTACK); /* sched params */ p->mp = nil; |