* When a process forks, enable tracing in the new process if needed. */
| 580 | * When a process forks, enable tracing in the new process if needed. |
| 581 | */ |
| 582 | void |
| 583 | ktrprocfork(struct proc *p1, struct proc *p2) |
| 584 | { |
| 585 | |
| 586 | MPASS(p2->p_tracevp == NULL); |
| 587 | MPASS(p2->p_traceflag == 0); |
| 588 | |
| 589 | if (p1->p_traceflag == 0) |
| 590 | return; |
| 591 | |
| 592 | PROC_LOCK(p1); |
| 593 | mtx_lock(&ktrace_mtx); |
| 594 | if (p1->p_traceflag & KTRFAC_INHERIT) { |
| 595 | p2->p_traceflag = p1->p_traceflag; |
| 596 | if ((p2->p_tracevp = p1->p_tracevp) != NULL) { |
| 597 | VREF(p2->p_tracevp); |
| 598 | KASSERT(p1->p_tracecred != NULL, |
| 599 | ("ktrace vnode with no cred")); |
| 600 | p2->p_tracecred = crhold(p1->p_tracecred); |
| 601 | } |
| 602 | } |
| 603 | mtx_unlock(&ktrace_mtx); |
| 604 | PROC_UNLOCK(p1); |
| 605 | |
| 606 | ktrprocctor(p2); |
| 607 | } |
| 608 | |
| 609 | /* |
| 610 | * When a thread returns, drain any asynchronous records generated by the |
no test coverage detected