summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 61e388cc41..13f892acab 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -735,7 +735,7 @@ void Process::sys$exit(int status)
kprintf("sys$exit: %s(%u) exit with status %d\n", name().characters(), pid(), status);
#endif
- set_state(Dead);
+ die();
m_termination_status = status;
m_termination_signal = 0;
@@ -750,7 +750,7 @@ void Process::terminate_due_to_signal(byte signal)
dbgprintf("terminate_due_to_signal %s(%u) <- %u\n", name().characters(), pid(), signal);
m_termination_status = 0;
m_termination_signal = signal;
- set_state(Dead);
+ die();
}
void Process::send_signal(byte signal, Process* sender)
@@ -935,8 +935,8 @@ void Process::crash()
ASSERT_INTERRUPTS_DISABLED();
ASSERT(state() != Dead);
m_termination_signal = SIGSEGV;
- set_state(Dead);
dumpRegions();
+ die();
Scheduler::pick_next_and_switch_now();
ASSERT_NOT_REACHED();
}
@@ -2130,3 +2130,9 @@ int Process::sys$chmod(const char* pathname, mode_t mode)
return error;
return 0;
}
+
+void Process::die()
+{
+ set_state(Dead);
+ m_fds.clear();
+}