Panic if proc0 hasn't been created and we try to call kthread_create.
This prevents a more mysterious crash later. XXX The long term solution is defer creation of these things until XXX proc0 lives
This commit is contained in:
parent
97f3b45bca
commit
4b6e07c491
@ -30,6 +30,7 @@
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/resourcevar.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <sys/wait.h>
|
||||
@ -68,6 +69,10 @@ kthread_create(void (*func)(void *), void *arg,
|
||||
va_list ap;
|
||||
struct proc *p2;
|
||||
|
||||
if (!proc0.p_stats || proc0.p_stats->p_start.tv_sec == 0) {
|
||||
panic("kthread_create called too soon");
|
||||
}
|
||||
|
||||
error = fork1(&proc0, RFMEM | RFFDG | RFPROC, &p2);
|
||||
if (error)
|
||||
return error;
|
||||
|
Loading…
Reference in New Issue
Block a user