| 154 | } |
| 155 | |
| 156 | void |
| 157 | kproc_exit(int ecode) |
| 158 | { |
| 159 | struct thread *td; |
| 160 | struct proc *p; |
| 161 | |
| 162 | td = curthread; |
| 163 | p = td->td_proc; |
| 164 | |
| 165 | /* |
| 166 | * Reparent curthread from proc0 to init so that the zombie |
| 167 | * is harvested. |
| 168 | */ |
| 169 | sx_xlock(&proctree_lock); |
| 170 | PROC_LOCK(p); |
| 171 | proc_reparent(p, initproc, true); |
| 172 | PROC_UNLOCK(p); |
| 173 | sx_xunlock(&proctree_lock); |
| 174 | |
| 175 | /* |
| 176 | * Wakeup anyone waiting for us to exit. |
| 177 | */ |
| 178 | wakeup(p); |
| 179 | |
| 180 | /* Buh-bye! */ |
| 181 | exit1(td, ecode, 0); |
| 182 | } |
| 183 | |
| 184 | /* |
| 185 | * Advise a kernel process to suspend (or resume) in its main loop. |
no test coverage detected