summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-11 21:29:25 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2022-01-12 16:09:09 +0200
commiteb5f6cd1088a084d030db38893b4817612886d7f (patch)
tree8444bb8e4c1d4f25fbda55971ff40b032fefcb47
parent4e7d307166c1589737cff2d5df48dcec676afc66 (diff)
downloadserenity-eb5f6cd1088a084d030db38893b4817612886d7f.zip
Kernel: Use try_serialize_absolute_path in ProcFSOverallProcesses
-rw-r--r--Kernel/GlobalProcessExposed.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/Kernel/GlobalProcessExposed.cpp b/Kernel/GlobalProcessExposed.cpp
index 378e73e1e1..846154f867 100644
--- a/Kernel/GlobalProcessExposed.cpp
+++ b/Kernel/GlobalProcessExposed.cpp
@@ -453,7 +453,7 @@ private:
JsonObjectSerializer<KBufferBuilder> json { builder };
// Keep this in sync with CProcessStatistics.
- auto build_process = [&](JsonArraySerializer<KBufferBuilder>& array, const Process& process) {
+ auto build_process = [&](JsonArraySerializer<KBufferBuilder>& array, const Process& process) -> ErrorOr<void> {
auto process_object = array.add_object();
if (process.is_user_process()) {
@@ -493,7 +493,7 @@ private:
process_object.add("ppid", process.ppid().value());
process_object.add("nfds", process.fds().open_count());
process_object.add("name", process.name());
- process_object.add("executable", process.executable() ? process.executable()->absolute_path() : "");
+ process_object.add("executable", process.executable() ? TRY(process.executable()->try_serialize_absolute_path())->view() : ""sv);
process_object.add("tty", process.tty() ? process.tty()->tty_name().view() : "notty"sv);
process_object.add("amount_virtual", process.address_space().amount_virtual());
process_object.add("amount_resident", process.address_space().amount_resident());
@@ -530,17 +530,20 @@ private:
thread_object.add("ipv4_socket_read_bytes", thread.ipv4_socket_read_bytes());
thread_object.add("ipv4_socket_write_bytes", thread.ipv4_socket_write_bytes());
});
+
+ return {};
};
SpinlockLocker lock(g_scheduler_lock);
{
{
auto array = json.add_array("processes");
- build_process(array, *Scheduler::colonel());
- Process::all_instances().with([&](auto& processes) {
+ TRY(build_process(array, *Scheduler::colonel()));
+ TRY(Process::all_instances().with([&](auto& processes) -> ErrorOr<void> {
for (auto& process : processes)
- build_process(array, process);
- });
+ TRY(build_process(array, process));
+ return {};
+ }));
}
auto total_time_scheduled = Scheduler::get_total_time_scheduled();