diff options
author | Andreas Kling <awesomekling@gmail.com> | 2020-01-11 21:07:00 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2020-01-11 21:33:12 +0100 |
commit | b36608f47cbc5eeb87e80d038d9798ac9cc3ab85 (patch) | |
tree | 2813f98ee9352e063904a8e8c013dbec0c69467b | |
parent | 2f880a047fc4466bbcc19da7c1fdf3c33f2ff2cd (diff) | |
download | serenity-b36608f47cbc5eeb87e80d038d9798ac9cc3ab85.zip |
ProcFS: Expose process pledge promises in /proc/all
-rw-r--r-- | Kernel/FileSystem/ProcFS.cpp | 11 |
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()); |