blob: f49bf866879a931f4f4a94548d4dbf0d8361d8b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/*
* Copyright (c) 2021, Peter Elliott <pelliott@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/JsonObject.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
ErrorOr<int> serenity_main(Main::Arguments)
{
TRY(Core::System::pledge("stdio rpath"));
auto file = TRY(Core::Stream::File::open("/sys/kernel/cpuinfo"sv, Core::Stream::OpenMode::Read));
auto buffer = TRY(file->read_all());
auto json = TRY(JsonValue::from_string(buffer));
auto const& cpuinfo_array = json.as_array();
outln("{}", cpuinfo_array.size());
return 0;
}
|