diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2023-05-13 18:39:05 +0200 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-05-19 23:31:20 +0200 |
commit | 41b45d5599070bd9d68a4b6796ac93f3b0969c4f (patch) | |
tree | 3428d6119bac1ca6bb2a9da9f39024f52840ad0a /Userland/Applications | |
parent | fbb4887d9c65d21a7dfa30d39110bdd89c1b442c (diff) | |
download | serenity-41b45d5599070bd9d68a4b6796ac93f3b0969c4f.zip |
SystemMonitor: Prefer File::read_until_eof over DeprecatedFile
Because MemoryStatsWidget::refresh is run nearly directly by the
EventLoop, the only real alternative to crashing would be to cancel the
update, and keep the old data. That doesn't sound sufficiently better to
warrant being implemented.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp index 75e9229f54..6b38516c4d 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -9,7 +9,6 @@ #include "GraphWidget.h" #include <AK/JsonObject.h> #include <AK/NumberFormat.h> -#include <LibCore/DeprecatedFile.h> #include <LibCore/Object.h> #include <LibGUI/BoxLayout.h> #include <LibGUI/Label.h> @@ -102,11 +101,9 @@ static inline u64 page_count_to_bytes(size_t count) void MemoryStatsWidget::refresh() { - auto proc_memstat = Core::DeprecatedFile::construct("/sys/kernel/memstat"); - if (!proc_memstat->open(Core::OpenMode::ReadOnly)) - VERIFY_NOT_REACHED(); + auto proc_memstat = Core::File::open("/sys/kernel/memstat"sv, Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors(); - auto file_contents = proc_memstat->read_all(); + auto file_contents = proc_memstat->read_until_eof().release_value_but_fixme_should_propagate_errors(); auto json_result = JsonValue::from_string(file_contents).release_value_but_fixme_should_propagate_errors(); auto const& json = json_result.as_object(); |