mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
Kernel: disown should unblock any potential waiters
This is necessary because if a process changes the state to Stopped or resumes from that state, a wait entry is created in the parent process. So, if a child process does this before disown is called, we need to clear those entries to avoid leaking references/zombies that won't be cleaned up until the former parent exits. This also should solve an even more unlikely corner case where another thread is waiting on a pid that is being disowned by another thread.
This commit is contained in:
parent
bcb9363a97
commit
4bbee00650
5 changed files with 55 additions and 1 deletions
|
@ -644,7 +644,8 @@ public:
|
|||
enum class UnblockFlags {
|
||||
Terminated,
|
||||
Stopped,
|
||||
Continued
|
||||
Continued,
|
||||
Disowned
|
||||
};
|
||||
|
||||
WaitBlocker(int wait_options, idtype_t id_type, pid_t id, KResultOr<siginfo_t>& result);
|
||||
|
@ -658,6 +659,7 @@ public:
|
|||
bool is_wait() const { return !(m_wait_options & WNOWAIT); }
|
||||
|
||||
private:
|
||||
void do_was_disowned();
|
||||
void do_set_result(const siginfo_t&);
|
||||
|
||||
const int m_wait_options;
|
||||
|
@ -681,6 +683,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
void disowned_by_waiter(Process&);
|
||||
bool unblock(Thread&, WaitBlocker::UnblockFlags, u8);
|
||||
void try_unblock(WaitBlocker&);
|
||||
void finalize();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue