1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

lsirq: Port to Core::Stream

This commit is contained in:
Sam Atkins 2022-09-14 15:49:33 +01:00 committed by Linus Groh
parent 2be7f9f42d
commit 9e4689f4c8

View file

@ -7,7 +7,7 @@
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@ -17,11 +17,11 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::unveil("/sys/kernel/interrupts", "r"));
TRY(Core::System::unveil(nullptr, nullptr));
auto proc_interrupts = TRY(Core::File::open("/sys/kernel/interrupts", Core::OpenMode::ReadOnly));
auto proc_interrupts = TRY(Core::Stream::File::open("/sys/kernel/interrupts"sv, Core::Stream::OpenMode::Read));
TRY(Core::System::pledge("stdio"));
auto file_contents = proc_interrupts->read_all();
auto file_contents = TRY(proc_interrupts->read_all());
auto json = TRY(JsonValue::from_string(file_contents));
auto cpu_count = json.as_array().at(0).as_object().get("per_cpu_call_counts"sv).as_array().size();