diff options
author | Andrew Kaster <andrewdkaster@gmail.com> | 2021-02-26 15:11:26 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-28 18:19:37 +0100 |
commit | 2930014c2a9c25d9751d958bfeb792134a6e8796 (patch) | |
tree | 7b091bb6f06442ec7f8151c841dd75acb4f4b1fd /Userland/Shell/Shell.cpp | |
parent | 8fc862f71045d43688406599063aaf1efc3ef70e (diff) | |
download | serenity-2930014c2a9c25d9751d958bfeb792134a6e8796.zip |
Shell: Remove WAITID_ONCE workaround
This hashmap is no longer necessary, and the shell works just fine
without it now. Remove the conditionally compiled code.
Diffstat (limited to 'Userland/Shell/Shell.cpp')
-rw-r--r-- | Userland/Shell/Shell.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 624550c8c7..840f24356c 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -59,12 +59,6 @@ extern char** environ; namespace Shell { -// FIXME: This should eventually be removed once we've established that -// waitpid() is not passed the same job twice. -#ifdef __serenity__ -# define ENSURE_WAITID_ONCE -#endif - void Shell::setup_signals() { if (m_should_reinstall_signal_handlers) { @@ -1602,9 +1596,6 @@ void Shell::custom_event(Core::CustomEvent& event) void Shell::notify_child_event() { -#ifdef ENSURE_WAITID_ONCE - static HashTable<pid_t> s_waited_for_pids; -#endif Vector<u64> disowned_jobs; // Workaround the fact that we can't receive *who* exactly changed state. // The child might still be alive (and even running) when this signal is dispatched to us @@ -1620,11 +1611,6 @@ void Shell::notify_child_event() for (auto& it : jobs) { auto job_id = it.key; auto& job = *it.value; -#ifdef ENSURE_WAITID_ONCE - // Theoretically, this should never trip, as jobs are removed from - // the job table when waitpid() succeeds *and* the child is dead. - VERIFY(!s_waited_for_pids.contains(job.pid())); -#endif int wstatus = 0; #if SH_DEBUG @@ -1658,18 +1644,6 @@ void Shell::notify_child_event() job.set_is_suspended(true); } found_child = true; -#ifdef ENSURE_WAITID_ONCE - // NOTE: This check is here to find bugs about our assumptions about waitpid(), - // it does not hold in general, and it definitely does not hold in the long run. - // Reasons that we would call waitpid() more than once: - // - PID reuse/wraparound: This will simply fail the assertion, ignored here. - // - Non-terminating unblocks: - // - Suspension: (e.g. via ^Z) - // - ? - // - ? - if (job.exited()) - s_waited_for_pids.set(child_pid); -#endif } if (job.should_be_disowned()) disowned_jobs.append(job_id); |