|
@@ -96,7 +96,6 @@ void sys__exit(int exitcode)
|
|
|
p->exitcode = exitcode;
|
|
|
DEBUG(DB_SYSCALL,"Syscall: _exit(%d)\n",exitcode);
|
|
|
KASSERT(curproc->p_addrspace != NULL);
|
|
|
- kprintf("TRYING TO DESTROY CWD\n");
|
|
|
/* VFS fields */
|
|
|
if (p->p_cwd)
|
|
|
{
|
|
@@ -104,7 +103,6 @@ void sys__exit(int exitcode)
|
|
|
p->p_cwd = NULL;
|
|
|
}
|
|
|
|
|
|
- kprintf("DESTROYED CWD\n");
|
|
|
as_deactivate();
|
|
|
as = curproc_setas(NULL);
|
|
|
as_destroy(as);
|
|
@@ -118,6 +116,13 @@ void sys__exit(int exitcode)
|
|
|
/* note: curproc cannot be used after this call */
|
|
|
proc_remthread(curthread);
|
|
|
|
|
|
+ int x = listpop(p->kids);
|
|
|
+ while (x)
|
|
|
+ {
|
|
|
+ processes->pids[x]->parent = NULL;
|
|
|
+ x = listpop(p->kids);
|
|
|
+ }
|
|
|
+
|
|
|
listelete(p->kids);
|
|
|
threadarray_cleanup(&p->p_threads);
|
|
|
spinlock_cleanup(&p->p_lock);
|
|
@@ -126,23 +131,15 @@ void sys__exit(int exitcode)
|
|
|
cv_broadcast(p->waiting, p->waitlock);
|
|
|
lock_release(p->waitlock);
|
|
|
|
|
|
- kprintf("This is the parent: %p\n", p->parent);
|
|
|
- if (p->parent)
|
|
|
- {
|
|
|
- kprintf("This is the exitcode: %d\n", p->parent->exitcode);
|
|
|
- }
|
|
|
if (!(p->parent)) proc_destroy(p);
|
|
|
- else if (p->parent->exitcode != -1)
|
|
|
+ else if (p->parent->exitcode >= 0)
|
|
|
{
|
|
|
- kprintf("This is the exitcode: %d\n", p->parent->exitcode);
|
|
|
proc_destroy(p);
|
|
|
}
|
|
|
|
|
|
/* if this is the last user process in the system, proc_destroy()
|
|
|
will wake up the kernel menu thread */
|
|
|
//proc_destroy(p);
|
|
|
-
|
|
|
- kprintf("Exiting\n");
|
|
|
thread_exit();
|
|
|
/* thread_exit() does not return, so we should never get here */
|
|
|
panic("return from thread_exit in sys_exit\n");
|