* When a process exits, drain per-process asynchronous trace records * and disable tracing. */
| 516 | * and disable tracing. |
| 517 | */ |
| 518 | void |
| 519 | ktrprocexit(struct thread *td) |
| 520 | { |
| 521 | struct ktr_request *req; |
| 522 | struct proc *p; |
| 523 | struct ucred *cred; |
| 524 | struct vnode *vp; |
| 525 | |
| 526 | p = td->td_proc; |
| 527 | if (p->p_traceflag == 0) |
| 528 | return; |
| 529 | |
| 530 | ktrace_enter(td); |
| 531 | req = ktr_getrequest_entered(td, KTR_PROCDTOR); |
| 532 | if (req != NULL) |
| 533 | ktr_enqueuerequest(td, req); |
| 534 | sx_xlock(&ktrace_sx); |
| 535 | ktr_drain(td); |
| 536 | sx_xunlock(&ktrace_sx); |
| 537 | PROC_LOCK(p); |
| 538 | mtx_lock(&ktrace_mtx); |
| 539 | ktr_freeproc(p, &cred, &vp); |
| 540 | mtx_unlock(&ktrace_mtx); |
| 541 | PROC_UNLOCK(p); |
| 542 | if (vp != NULL) |
| 543 | vrele(vp); |
| 544 | if (cred != NULL) |
| 545 | crfree(cred); |
| 546 | ktrace_exit(td); |
| 547 | } |
| 548 | |
| 549 | static void |
| 550 | ktrprocctor_entered(struct thread *td, struct proc *p) |
no test coverage detected