mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:24:58 +00:00

There's no need to have separate syscall for this kind of functionality, as we can just have a device node in /dev, called "beep", that allows writing tone generation packets to emulate the same behavior. In addition to that, we remove LibC sysbeep function, as this function was never being used by any C program nor it was standardized in any way. Instead, we move the userspace implementation to LibCore.
19 lines
506 B
C++
19 lines
506 B
C++
/*
|
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibCore/ArgsParser.h>
|
|
#include <LibCore/System.h>
|
|
#include <LibMain/Main.h>
|
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
{
|
|
Optional<size_t> tone;
|
|
Core::ArgsParser args_parser;
|
|
args_parser.add_option(tone, "Beep tone", "beep-tone", 'f', "Beep tone (frequency in Hz)");
|
|
args_parser.parse(arguments);
|
|
TRY(Core::System::beep(tone.value_or(440)));
|
|
return 0;
|
|
}
|