+ struct proc_info* proc = thread->process;
+ if (proc->thread_count == 1) {
+ terminate_proc_only(thread->process, 0);
+ }
+}
+
+void
+terminate_current_thread(ptr_t val) {
+ terminate_thread(current_thread, val);
+}
+
+void
+terminate_proccess(struct proc_info* proc, int exit_code) {
+ assert(!kernel_process(proc));
+
+ if (proc->pid == 1) {
+ panick("Attempt to kill init");
+ }
+
+ terminate_proc_only(proc, exit_code);
+
+ struct thread *pos, *n;
+ llist_for_each(pos, n, &__current->threads, proc_sibs) {
+ pos->state = PS_TERMNAT;
+ }
+}
+
+void
+terminate_current(int exit_code)
+{
+ terminate_proccess(__current, exit_code);