FreeBSD/sys/kern/kern_ktrace.c
/*
 * When a process forks, enable tracing in the new process if needed.
 */
When a process forks, enable tracing in the new process if needed.
When a process forks enable tracing in the new process if needed .
void
ktrprocfork(struct proc *p1, struct proc *p2)
{
	PROC_LOCK(p1);
	mtx_lock(&ktrace_mtx);
	KASSERT(p2->p_tracevp == NULL, ("new process has a ktrace vnode"));
	if (p1->p_traceflag & KTRFAC_INHERIT) {
		p2->p_traceflag = p1->p_traceflag;
		if ((p2->p_tracevp = p1->p_tracevp) != NULL) {
			VREF(p2->p_tracevp);
			KASSERT(p1->p_tracecred != NULL,
			    ("ktrace vnode with no cred"));
			p2->p_tracecred = crhold(p1->p_tracecred);
		}
	}
	mtx_unlock(&ktrace_mtx);
	PROC_UNLOCK(p1);
	ktrprocctor(p2);
}
void ktrprocfork ( struct proc * p1 , struct proc * p2 ) { PROC_LOCK ( p1 ) ; mtx_lock ( & ktrace_mtx ) ; KASSERT ( p2 -> p_tracevp == NULL , ( " " ) ) ; if ( p1 -> p_traceflag & KTRFAC_INHERIT ) { p2 -> p_traceflag = p1 -> p_traceflag ; if ( ( p2 -> p_tracevp = p1 -> p_tracevp ) != NULL ) { VREF ( p2 -> p_tracevp ) ; KASSERT ( p1 -> p_tracecred != NULL , ( " " ) ) ; p2 -> p_tracecred = crhold ( p1 -> p_tracecred ) ; } } mtx_unlock ( & ktrace_mtx ) ; PROC_UNLOCK ( p1 ) ; ktrprocctor ( p2 ) ; }
When a process forks, enable tracing in the new process if needed.
When a process forks enable tracing in the new process if needed .