2020-01-18 11:38:21 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
2021-09-11 12:20:47 +03:00
|
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
2022-01-25 04:26:25 +03:00
|
|
|
* Copyright (c) 2022, Alex Major
|
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:11:50 +03:00
|
|
|
#include <AK/DeprecatedString.h>
|
2023-02-09 05:02:46 +03:00
|
|
|
#include <LibCore/File.h>
|
2022-01-25 04:26:25 +03:00
|
|
|
#include <LibMain/Main.h>
|
2021-09-11 12:20:47 +03:00
|
|
|
#include <fcntl.h>
|
2019-07-19 14:08:26 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
2019-06-16 12:49:39 +03:00
|
|
|
|
2022-01-25 04:26:25 +03:00
|
|
|
ErrorOr<int> serenity_main(Main::Arguments)
|
2019-06-16 12:49:39 +03:00
|
|
|
{
|
2023-02-09 05:02:46 +03:00
|
|
|
auto file = TRY(Core::File::open("/sys/kernel/power_state"sv, Core::File::OpenMode::Write));
|
2022-01-25 04:26:25 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
const DeprecatedString file_contents = "2";
|
2023-03-01 19:24:50 +03:00
|
|
|
TRY(file->write_until_depleted(file_contents.bytes()));
|
2022-01-25 04:26:25 +03:00
|
|
|
file->close();
|
|
|
|
|
2021-09-11 12:20:47 +03:00
|
|
|
return 0;
|
2019-06-16 12:49:39 +03:00
|
|
|
}
|