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

Function proc_dtor

freebsd/kern/kern_proc.c:228–257  ·  view source on GitHub ↗

* Reclaim a proc after use. */

Source from the content-addressed store, hash-verified

226 * Reclaim a proc after use.
227 */
228static void
229proc_dtor(void *mem, int size, void *arg)
230{
231 struct proc *p;
232 struct thread *td;
233
234 /* INVARIANTS checks go here */
235 p = (struct proc *)mem;
236 td = FIRST_THREAD_IN_PROC(p);
237 if (td != NULL) {
238#ifdef INVARIANTS
239 KASSERT((p->p_numthreads == 1),
240 ("bad number of threads in exiting process"));
241 KASSERT(STAILQ_EMPTY(&p->p_ktr), ("proc_dtor: non-empty p_ktr"));
242#endif
243 /* Free all OSD associated to this thread. */
244 osd_thread_exit(td);
245 td_softdep_cleanup(td);
246 MPASS(td->td_su == NULL);
247
248 /* Make sure all thread destructors are executed */
249 EVENTHANDLER_DIRECT_INVOKE(thread_dtor, td);
250 }
251 EVENTHANDLER_DIRECT_INVOKE(process_dtor, p);
252#ifdef KDTRACE_HOOKS
253 kdtrace_proc_dtor(p);
254#endif
255 if (p->p_ksi != NULL)
256 KASSERT(! KSI_ONQ(p->p_ksi), ("SIGCHLD queue"));
257}
258
259/*
260 * Initialize type-stable parts of a proc (when newly created).

Callers

nothing calls this directly

Calls 2

td_softdep_cleanupFunction · 0.85
kdtrace_proc_dtorFunction · 0.85

Tested by

no test coverage detected