From d8ebcaede8fd968ea81f34a9b8fe164103ebf450 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 6 Jan 2023 09:13:40 +0200 Subject: Kernel: Add helper function to check if a Process is in jail Use this helper function in various places to replace the old code of acquiring the SpinlockProtected> of a Process to do that validation. --- Kernel/Process.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Kernel/Process.h') diff --git a/Kernel/Process.h b/Kernel/Process.h index 90b3e3ed76..67f257636d 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -240,6 +240,11 @@ public: SpinlockProtected, LockRank::Process>& jail() { return m_attached_jail; } + bool is_currently_in_jail() const + { + return m_attached_jail.with([&](auto& jail) -> bool { return !jail.is_null(); }); + } + NonnullRefPtr credentials() const; bool is_dumpable() const -- cgit v1.2.3