summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-05-16 01:52:19 +0430
committerAndreas Kling <kling@serenityos.org>2020-05-17 11:58:08 +0200
commit9d54f21859e9d37b80e8afcbdf99215c53a4f278 (patch)
tree47db0260d0214d4e4dc445741212e41d09dd263a /Kernel/Process.cpp
parent1c4f38749ee5608bca776ef3f1e7d5b65184049c (diff)
downloadserenity-9d54f21859e9d37b80e8afcbdf99215c53a4f278.zip
Kernel: wait() should not block if WNOHANG is specified
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp5
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;