2020-01-18 11:38:21 +03:00
|
|
|
/*
|
2021-11-23 17:44:17 +03:00
|
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
2020-01-18 11:38:21 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 11:38:21 +03:00
|
|
|
*/
|
|
|
|
|
2023-02-09 05:02:46 +03:00
|
|
|
#include <LibCore/File.h>
|
2021-11-23 17:44:17 +03:00
|
|
|
#include <LibCore/System.h>
|
|
|
|
#include <LibMain/Main.h>
|
2019-01-29 00:40:55 +03:00
|
|
|
|
2021-11-23 17:44:17 +03:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments)
|
2019-01-29 00:40:55 +03:00
|
|
|
{
|
2021-11-28 01:26:34 +03:00
|
|
|
TRY(Core::System::pledge("stdio rpath"));
|
2022-10-14 21:56:19 +03:00
|
|
|
TRY(Core::System::unveil("/sys/kernel/dmesg", "r"));
|
2021-11-23 17:44:17 +03:00
|
|
|
TRY(Core::System::unveil(nullptr, nullptr));
|
2020-01-22 13:34:20 +03:00
|
|
|
|
2023-02-09 05:02:46 +03:00
|
|
|
auto file = TRY(Core::File::open("/sys/kernel/dmesg"sv, Core::File::OpenMode::Read));
|
2022-12-11 19:49:00 +03:00
|
|
|
auto buffer = TRY(file->read_until_eof());
|
2021-11-23 17:44:17 +03:00
|
|
|
out("{}", StringView { buffer });
|
2019-01-29 00:40:55 +03:00
|
|
|
return 0;
|
|
|
|
}
|