From 7801e38af16ff7aa27bdac92baa7abfe6ae47c3c Mon Sep 17 00:00:00 2001 From: Junior Rantila Date: Sun, 9 Jan 2022 06:14:43 +0100 Subject: [PATCH] LibCore: Add beep wrapper --- Userland/Libraries/LibCore/System.cpp | 9 +++++++++ Userland/Libraries/LibCore/System.h | 1 + 2 files changed, 10 insertions(+) diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 7a9df33728..c0b73dbbd5 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -26,6 +26,15 @@ namespace Core::System { #ifdef __serenity__ + +ErrorOr beep() +{ + auto rc = ::sysbeep(); + if (rc < 0) + return Error::from_syscall("beep", rc); + return {}; +} + ErrorOr pledge(StringView promises, StringView execpromises) { Syscall::SC_pledge_params params { diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 8a3a414860..40a1d0d888 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -30,6 +30,7 @@ namespace Core::System { #ifdef __serenity__ +ErrorOr beep(); ErrorOr pledge(StringView promises, StringView execpromises = {}); ErrorOr unveil(StringView path, StringView permissions); ErrorOr sendfd(int sockfd, int fd);