mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 20:24:57 +00:00
Kernel: Don't interrupt blocked syscalls to dispatch ignored signals.
This was just causing syscalls to return EINTR for no reason.
This commit is contained in:
parent
cda5a6eca3
commit
4d904340b4
2 changed files with 19 additions and 1 deletions
|
@ -224,13 +224,19 @@ bool Thread::tick()
|
|||
void Thread::send_signal(u8 signal, Process* sender)
|
||||
{
|
||||
ASSERT(signal < 32);
|
||||
InterruptDisabler disabler;
|
||||
|
||||
// FIXME: Figure out what to do for masked signals. Should we also ignore them here?
|
||||
if (should_ignore_signal(signal)) {
|
||||
dbg() << "signal " << signal << " was ignored by " << process();
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender)
|
||||
dbgprintf("signal: %s(%u) sent %d to %s(%u)\n", sender->name().characters(), sender->pid(), signal, process().name().characters(), pid());
|
||||
else
|
||||
dbgprintf("signal: kernel sent %d to %s(%u)\n", signal, process().name().characters(), pid());
|
||||
|
||||
InterruptDisabler disabler;
|
||||
m_pending_signals |= 1 << signal;
|
||||
}
|
||||
|
||||
|
@ -307,6 +313,17 @@ DefaultSignalAction default_signal_action(u8 signal)
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
bool Thread::should_ignore_signal(u8 signal) const
|
||||
{
|
||||
ASSERT(signal < 32);
|
||||
auto& action = m_signal_action_data[signal];
|
||||
if (action.handler_or_sigaction.is_null())
|
||||
return default_signal_action(signal) == DefaultSignalAction::Ignore;
|
||||
if (action.handler_or_sigaction.as_ptr() == SIG_IGN)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
ShouldUnblockThread Thread::dispatch_signal(u8 signal)
|
||||
{
|
||||
ASSERT_INTERRUPTS_DISABLED();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue