diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-05-16 01:52:19 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-17 11:58:08 +0200 |
commit | 9d54f21859e9d37b80e8afcbdf99215c53a4f278 (patch) | |
tree | 47db0260d0214d4e4dc445741212e41d09dd263a | |
parent | 1c4f38749ee5608bca776ef3f1e7d5b65184049c (diff) | |
download | serenity-9d54f21859e9d37b80e8afcbdf99215c53a4f278.zip |
Kernel: wait() should not block if WNOHANG is specified
-rw-r--r-- | Kernel/Process.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index e910533efb..84cc455a73 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -2466,8 +2466,9 @@ KResultOr<siginfo_t> Process::do_waitid(idtype_t idtype, int id, int options) return KResult(-EINVAL); } - if (Thread::current->block<Thread::WaitBlocker>(options, waitee_pid) != Thread::BlockResult::WokeNormally) - return KResult(-EINTR); + if (!(options & WNOHANG)) + if (Thread::current->block<Thread::WaitBlocker>(options, waitee_pid) != Thread::BlockResult::WokeNormally) + return KResult(-EINTR); InterruptDisabler disabler; |