FreeBSD/sys/kern/sys_procdesc.c
/*
 * When a new process is forked by pdfork(), a file descriptor is allocated
 * by the fork code first, then the process is forked, and then we get a
 * chance to set up the process descriptor.  Failure is not permitted at this
 * point, so procdesc_new() must succeed.
 */
When a new process is forked by pdfork(), a file descriptor is allocated
by the fork code first, then the process is forked, and then we get a
chance to set up the process descriptor.  Failure is not permitted at this
point, so procdesc_new() must succeed.
When a new process is forked by pdfork () a file descriptor is allocated by the fork code first then the process is forked and then we get a chance to set up the process descriptor . Failure is not permitted at this point so procdesc_new () must succeed .
void
procdesc_new(struct proc *p, int flags)
{
	struct procdesc *pd;
	pd = uma_zalloc(procdesc_zone, M_WAITOK | M_ZERO);
	pd->pd_proc = p;
	pd->pd_pid = p->p_pid;
	p->p_procdesc = pd;
	pd->pd_flags = 0;
	if (flags & PD_DAEMON)
		pd->pd_flags |= PDF_DAEMON;
	PROCDESC_LOCK_INIT(pd);
	knlist_init_mtx(&pd->pd_selinfo.si_note, &pd->pd_lock);
	refcount_init(&pd->pd_refcount, 2);
}
void procdesc_new ( struct proc * p , int flags ) { struct procdesc * pd ; pd = uma_zalloc ( procdesc_zone , M_WAITOK | M_ZERO ) ; pd -> pd_proc = p ; pd -> pd_pid = p -> p_pid ; p -> p_procdesc = pd ; pd -> pd_flags = 0 ; if ( flags & PD_DAEMON ) pd -> pd_flags |= PDF_DAEMON ; PROCDESC_LOCK_INIT ( pd ) ; knlist_init_mtx ( & pd -> pd_selinfo . si_note , & pd -> pd_lock ) ; refcount_init ( & pd -> pd_refcount , 2 ) ; }
When a new process is forked by pdfork(), a file descriptor is allocated
 by the fork code first, then the process is forked, and then we get a
 chance to set up the process descriptor.
When a new process is forked by pdfork () a file descriptor is allocated by the fork code first then the process is forked and then we get a chance to set up the process descriptor .
/*
	 * Process descriptors start out with two references: one from their
	 * struct file, and the other from their struct proc.
	 */