summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2020-01-11 21:07:00 +0100
committerAndreas Kling <awesomekling@gmail.com>2020-01-11 21:33:12 +0100
commitb36608f47cbc5eeb87e80d038d9798ac9cc3ab85 (patch)
tree2813f98ee9352e063904a8e8c013dbec0c69467b
parent2f880a047fc4466bbcc19da7c1fdf3c33f2ff2cd (diff)
downloadserenity-b36608f47cbc5eeb87e80d038d9798ac9cc3ab85.zip
ProcFS: Expose process pledge promises in /proc/all
-rw-r--r--Kernel/FileSystem/ProcFS.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index 48ad237893..e14c8d65ba 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -758,6 +758,17 @@ Optional<KBuffer> procfs$all(InodeIdentifier)
// Keep this in sync with CProcessStatistics.
auto build_process = [&](const Process& process) {
auto process_object = array.add_object();
+
+ StringBuilder pledge_builder;
+#define __ENUMERATE_PLEDGE_PROMISE(promise) \
+ if (process.has_promised(Pledge::promise)) { \
+ pledge_builder.append(#promise " "); \
+ }
+ ENUMERATE_PLEDGE_PROMISES
+#undef __ENUMERATE_PLEDGE_PROMISE
+
+ process_object.add("pledge", pledge_builder.to_string());
+
process_object.add("pid", process.pid());
process_object.add("pgid", process.tty() ? process.tty()->pgid() : 0);
process_object.add("pgp", process.pgid());