kernel: Interrupt waitpid (even when SIGCHLD is pending) when other signals are also pending
All checks were successful
Build and test / build (push) Successful in 1m36s
All checks were successful
Build and test / build (push) Successful in 1m36s
This fixes init not receiving the kill signal when running tests.
This commit is contained in:
parent
42afef5ccb
commit
d05d6fad0b
@ -26,7 +26,7 @@ Result<u64> sys_waitpid(Registers* regs, SyscallArgs args)
|
|||||||
|
|
||||||
wait_for_child:
|
wait_for_child:
|
||||||
if (!target->dead()) kernel_wait(pid);
|
if (!target->dead()) kernel_wait(pid);
|
||||||
if (current->interrupted && current->pending_signal() != SIGCHLD)
|
if (current->interrupted && (current->pending_signal_count() > 1 || current->pending_signal() != SIGCHLD))
|
||||||
{
|
{
|
||||||
kdbgln("signal: waitpid interrupted by signal");
|
kdbgln("signal: waitpid interrupted by signal");
|
||||||
if (current->will_ignore_pending_signal())
|
if (current->will_ignore_pending_signal())
|
||||||
@ -50,7 +50,7 @@ Result<u64> sys_waitpid(Registers* regs, SyscallArgs args)
|
|||||||
|
|
||||||
wait_for_any_child:
|
wait_for_any_child:
|
||||||
kernel_wait(pid);
|
kernel_wait(pid);
|
||||||
if (current->interrupted && current->pending_signal() != SIGCHLD)
|
if (current->interrupted && (current->pending_signal_count() > 1 || current->pending_signal() != SIGCHLD))
|
||||||
{
|
{
|
||||||
kdbgln("signal: waitpid interrupted by signal");
|
kdbgln("signal: waitpid interrupted by signal");
|
||||||
if (current->will_ignore_pending_signal())
|
if (current->will_ignore_pending_signal())
|
||||||
|
@ -277,6 +277,16 @@ void Thread::process_pending_signals(Registers* current_regs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Thread::pending_signal_count()
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
for (int i = 0; i < NSIG; i++)
|
||||||
|
{
|
||||||
|
if (pending_signals.get(i)) { result++; }
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
int Thread::pending_signal()
|
int Thread::pending_signal()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NSIG; i++)
|
for (int i = 0; i < NSIG; i++)
|
||||||
|
@ -208,6 +208,7 @@ struct Thread : public LinkedListNode<Thread>
|
|||||||
|
|
||||||
void process_pending_signals(Registers* current_regs);
|
void process_pending_signals(Registers* current_regs);
|
||||||
|
|
||||||
|
int pending_signal_count();
|
||||||
int pending_signal();
|
int pending_signal();
|
||||||
bool will_ignore_pending_signal();
|
bool will_ignore_pending_signal();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user