MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ktrprocexit

Function ktrprocexit

freebsd/kern/kern_ktrace.c:518–547  ·  view source on GitHub ↗

* When a process exits, drain per-process asynchronous trace records * and disable tracing. */

Source from the content-addressed store, hash-verified

516 * and disable tracing.
517 */
518void
519ktrprocexit(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
549static void
550ktrprocctor_entered(struct thread *td, struct proc *p)

Callers 1

exit1Function · 0.85

Calls 10

ktrace_enterFunction · 0.85
ktr_getrequest_enteredFunction · 0.85
ktr_enqueuerequestFunction · 0.85
ktr_drainFunction · 0.85
ktr_freeprocFunction · 0.85
ktrace_exitFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70
vreleFunction · 0.70
crfreeFunction · 0.70

Tested by

no test coverage detected