KASSERT() that initproc->p_pid is 1. Very bad things happen if init's

pid isn't 1, and it can actually occur if kthread_create() is called
before SUB_SI_CREATE_INIT without RFHIGHPID.

Discussed with:	jhb
This commit is contained in:
rwatson 2004-01-16 20:29:23 +00:00
parent 78f05af0a5
commit cd9e066806

View File

@ -683,6 +683,7 @@ create_init(const void *udata __unused)
error = fork1(&thread0, RFFDG | RFPROC | RFSTOPPED, 0, &initproc);
if (error)
panic("cannot fork init: %d\n", error);
KASSERT(initproc->p_pid == 1, ("create_init: initproc->p_pid != 1"));
/* divorce init's credentials from the kernel's */
newcred = crget();
PROC_LOCK(initproc);