- p->p_stat = SRUN;
- p->p_flag = P_INMEM|P_SYSTEM;
- p->p_nice = NZERO;
- p->p_pptr = p;
- lockinit(&p->signal_lock, PVM, "signal", 0, 0);
- TAILQ_INIT(&p->p_uthlist);
- p->sigwait = FALSE;
- p->sigwait_thread = THREAD_NULL;
- p->exit_thread = THREAD_NULL;
-
- /* Create credentials. */
- lockinit(&cred0.pc_lock, PLOCK, "proc0 cred", 0, 0);
- cred0.p_refcnt = 1;
- p->p_cred = &cred0;
- p->p_ucred = crget();
- p->p_ucred->cr_ngroups = 1; /* group 0 */
+ kernproc->p_stat = SRUN;
+ kernproc->p_flag = P_SYSTEM;
+ kernproc->p_nice = NZERO;
+ kernproc->p_pptr = kernproc;
+
+ TAILQ_INIT(&kernproc->p_uthlist);
+ TAILQ_INSERT_TAIL(&kernproc->p_uthlist, ut, uu_list);
+
+ kernproc->sigwait = FALSE;
+ kernproc->sigwait_thread = THREAD_NULL;
+ kernproc->exit_thread = THREAD_NULL;
+ kernproc->p_csflags = CS_VALID;
+
+ /*
+ * Create credential. This also Initializes the audit information.
+ */
+ bsd_init_kprintf("calling bzero\n");
+ bzero(&temp_cred, sizeof(temp_cred));
+ temp_cred.cr_ngroups = 1;
+
+ temp_cred.cr_audit.as_aia_p = &audit_default_aia;
+ /* XXX the following will go away with cr_au */
+ temp_cred.cr_au.ai_auid = AU_DEFAUDITID;
+
+ bsd_init_kprintf("calling kauth_cred_create\n");
+ kernproc->p_ucred = kauth_cred_create(&temp_cred);
+
+ /* give the (already exisiting) initial thread a reference on it */
+ bsd_init_kprintf("calling kauth_cred_ref\n");
+ kauth_cred_ref(kernproc->p_ucred);
+ ut->uu_context.vc_ucred = kernproc->p_ucred;
+ ut->uu_context.vc_thread = current_thread();
+
+ TAILQ_INIT(&kernproc->p_aio_activeq);
+ TAILQ_INIT(&kernproc->p_aio_doneq);
+ kernproc->p_aio_total_count = 0;
+ kernproc->p_aio_active_count = 0;
+
+ bsd_init_kprintf("calling file_lock_init\n");
+ file_lock_init();
+
+#if CONFIG_MACF
+ mac_cred_label_associate_kernel(kernproc->p_ucred);
+ mac_task_label_update_cred (kernproc->p_ucred, (struct task *) kernproc->task);
+#endif