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:
Robert Watson 2004-01-16 20:29:23 +00:00
parent 09c84ba407
commit bafc8f255a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124597

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