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