* Reclaim a proc after use. */
| 226 | * Reclaim a proc after use. |
| 227 | */ |
| 228 | static void |
| 229 | proc_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). |
nothing calls this directly
no test coverage detected