diff --git a/kernel/src/thread/Thread.cpp b/kernel/src/thread/Thread.cpp index 1ad744a2..1e17f89c 100644 --- a/kernel/src/thread/Thread.cpp +++ b/kernel/src/thread/Thread.cpp @@ -98,6 +98,16 @@ Result> Thread::resolve_atfile(int dirfd, const String& pa unreachable(); } +enum class DefaultSignalAction +{ + Ignore, + Terminate, +}; + +static constexpr DefaultSignalAction default_actions[] = { + DefaultSignalAction::Terminate // SIGABRT +}; + void Thread::process_pending_signals(Registers* current_regs) { for (int i = 0; i < NSIG; i++) @@ -123,9 +133,15 @@ void Thread::process_pending_signals(Registers* current_regs) return; } - kinfoln("signal: using default behavior (handler=SIG_DFL) (terminating)"); - // FIXME: Add different default handlers for different signals and add signal exit codes. - exit_and_signal_parent(255); + kinfoln("signal: using default behavior (handler=SIG_DFL)"); + + auto action = default_actions[i]; + switch (action) + { + case DefaultSignalAction::Ignore: return; + // FIXME: Add signal exit codes. + case DefaultSignalAction::Terminate: exit_and_signal_parent(255); + } } // If we fail to deliver the signal (usually because there's not enough space on the stack), execute the // default action.