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:
Warner Losh 2000-01-10 08:00:58 +00:00
parent 898cb2af53
commit 310086415a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55722

View File

@ -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;