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
|
|
|
*/
|
|
|
|
|
2022-09-14 13:57:31 +03:00
|
|
|
#include <LibCore/Stream.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
|
|
|
|
2022-09-14 13:57:31 +03:00
|
|
|
auto file = TRY(Core::Stream::File::open("/sys/kernel/dmesg"sv, Core::Stream::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;
|
|
|
|
}
|