summaryrefslogtreecommitdiff
path: root/Kernel/Process.h
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2023-01-06 09:13:40 +0200
committerLinus Groh <mail@linusgroh.de>2023-01-06 17:29:47 +0100
commitd8ebcaede8fd968ea81f34a9b8fe164103ebf450 (patch)
tree4426206cbbe1d94d335c36377ce8e2a2dad00dca /Kernel/Process.h
parent6b3688147fd74b301944b368a896767e49915faa (diff)
downloadserenity-d8ebcaede8fd968ea81f34a9b8fe164103ebf450.zip
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<RefPtr<Jail>> of a Process to do that validation.
Diffstat (limited to 'Kernel/Process.h')
-rw-r--r--Kernel/Process.h5
1 files changed, 5 insertions, 0 deletions
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<RefPtr<Jail>, 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> credentials() const;
bool is_dumpable() const