mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
Kernel: Change wait blocking to Process-only blocking
This prevents zombies created by multi-threaded applications and brings our model back to closer to what other OSs do. This also means that SIGSTOP needs to halt all threads, and SIGCONT needs to resume those threads.
This commit is contained in:
@@ -577,7 +577,7 @@ KResultOr<String> Process::get_syscall_path_argument(const Syscall::StringArgume
|
||||
return get_syscall_path_argument(path.characters, path.length);
|
||||
}
|
||||
|
||||
void Process::finalize(Thread& last_thread)
|
||||
void Process::finalize()
|
||||
{
|
||||
ASSERT(Thread::current() == g_finalizer);
|
||||
#ifdef PROCESS_DEBUG
|
||||
@@ -627,7 +627,7 @@ void Process::finalize(Thread& last_thread)
|
||||
}
|
||||
}
|
||||
|
||||
unblock_waiters(last_thread, Thread::WaitBlocker::UnblockFlags::Terminated);
|
||||
unblock_waiters(Thread::WaitBlocker::UnblockFlags::Terminated);
|
||||
|
||||
{
|
||||
ScopedSpinLock lock(m_lock);
|
||||
@@ -647,10 +647,10 @@ void Process::disowned_by_waiter(Process& process)
|
||||
m_wait_block_condition.disowned_by_waiter(process);
|
||||
}
|
||||
|
||||
void Process::unblock_waiters(Thread& thread, Thread::WaitBlocker::UnblockFlags flags, u8 signal)
|
||||
void Process::unblock_waiters(Thread::WaitBlocker::UnblockFlags flags, u8 signal)
|
||||
{
|
||||
if (auto parent = Process::from_pid(ppid()))
|
||||
parent->m_wait_block_condition.unblock(thread, flags, signal);
|
||||
parent->m_wait_block_condition.unblock(*this, flags, signal);
|
||||
}
|
||||
|
||||
void Process::die()
|
||||
@@ -877,4 +877,21 @@ OwnPtr<Process::ELFBundle> Process::elf_bundle() const
|
||||
return bundle;
|
||||
}
|
||||
|
||||
void Process::start_tracing_from(ProcessID tracer)
|
||||
{
|
||||
m_tracer = ThreadTracer::create(tracer);
|
||||
}
|
||||
|
||||
void Process::stop_tracing()
|
||||
{
|
||||
m_tracer = nullptr;
|
||||
}
|
||||
|
||||
void Process::tracer_trap(Thread& thread, const RegisterState& regs)
|
||||
{
|
||||
ASSERT(m_tracer.ptr());
|
||||
m_tracer->set_regs(regs);
|
||||
thread.send_urgent_signal_to_self(SIGTRAP);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user