1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 17:55:06 +00:00

Kernel: Remove unneeded Thread::set_default_signal_dispositions

The `default_signal_action(u8 signal)` function already has the
full mapping. The only caveat being that now we need to make
sure the thread constructor and clear_signals() method do the work
of resetting the m_signal_action_data array, instead or relying on
the previous logic in set_default_signal_dispositions.
This commit is contained in:
Brian Gianforcaro 2021-02-21 02:03:49 -08:00 committed by Andreas Kling
parent df73a86875
commit a977cdd9ac
3 changed files with 5 additions and 13 deletions

View file

@ -84,7 +84,7 @@ Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Region> kernel_stac
}
if constexpr (THREAD_DEBUG)
dbgln("Created new thread {}({}:{})", m_process->name(), m_process->pid().value(), m_tid.value());
set_default_signal_dispositions();
m_fpu_state = (FPUState*)kmalloc_aligned<16>(sizeof(FPUState));
reset_fpu_state();
m_tss.iomapbase = sizeof(TSS32);
@ -547,6 +547,9 @@ void Thread::clear_signals()
m_signal_mask = 0;
m_pending_signals = 0;
m_have_any_unmasked_pending_signals.store(false, AK::memory_order_release);
Span<SignalActionData> action_data(m_signal_action_data);
action_data.fill({});
}
// Certain exceptions, such as SIGSEGV and SIGILL, put a
@ -842,14 +845,6 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
return DispatchSignalResult::Continue;
}
void Thread::set_default_signal_dispositions()
{
// FIXME: Set up all the right default actions. See signal(7).
memset(&m_signal_action_data, 0, sizeof(m_signal_action_data));
m_signal_action_data[SIGCHLD].handler_or_sigaction = VirtualAddress(SIG_IGN);
m_signal_action_data[SIGWINCH].handler_or_sigaction = VirtualAddress(SIG_IGN);
}
RegisterState& Thread::get_register_dump_from_stack()
{
auto* trap = current_trap();