summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/beep.cpp
blob: 8d4accad33b09e6a72c8a36585828f5711ce91bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <Kernel/Devices/PCSpeaker.h>
#include <Kernel/Process.h>

namespace Kernel {

KResultOr<int> Process::sys$beep()
{
    PCSpeaker::tone_on(440);
    auto result = Thread::current()->sleep(Time::from_nanoseconds(200'000'000));
    PCSpeaker::tone_off();
    if (result.was_interrupted())
        return EINTR;
    return 0;
}

}