- struct proc *p = current_proc();
-
- ut = get_bsdthread_info(th);
- ut->uu_ar0 = (int *)pcb;
-
- /*
- * Delayed binding of thread credential to process credential.
- *
- * XXX This doesn't really belong here, but the i386 code has a
- * XXX number of seemingly gratuitous structural differences that
- * XXX make this the most appropriate place to do the work.
- */
- if (ut->uu_ucred != p->p_ucred &&
- (ut->uu_flag & UT_SETUID) == 0) {
- kauth_cred_t old = ut->uu_ucred;
- proc_lock(p);
- ut->uu_ucred = p->p_ucred;
- kauth_cred_ref(ut->uu_ucred);
- proc_unlock(p);
- if (old != NOCRED)
- kauth_cred_rele(old);
+ struct proc *p;
+ thread_t thr_act = current_thread();
+
+ ut = (struct uthread *)get_bsdthread_info(thr_act);
+ if (ut && (ut->uu_flag & UT_VFORK)) {
+ if (ut->uu_proc) {
+ p = ut->uu_proc;
+ if ((p->p_flag & P_INVFORK) == 0)
+ panic("returning child proc not under vfork");
+ if (p->p_vforkact != (void *)thr_act)
+ panic("returning child proc which is not cur_act");
+ return(p);
+ } else {
+ return (kernproc);
+ }