From 8b7b726680313f17be50a9fbb577f14995c33218 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 23 Nov 2021 16:06:56 +0100 Subject: [PATCH] LibCore: Add kill() syscall wrapper --- Userland/Libraries/LibCore/System.cpp | 7 +++++++ Userland/Libraries/LibCore/System.h | 1 + 2 files changed, 8 insertions(+) diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index ad15a2437c..a3d4c1bf3d 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -164,4 +164,11 @@ ErrorOr write(int fd, void const* data, size_t data_size) return rc; } +ErrorOr kill(pid_t pid, int signal) +{ + if (::kill(pid, signal) < 0) + return Error::from_syscall("kill"sv, -errno); + return {}; +} + } diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index cbc6339d49..140da81ebb 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -28,5 +28,6 @@ ErrorOr ftruncate(int fd, off_t length); ErrorOr stat(StringView path); ErrorOr read(int fd, void* buffer, size_t buffer_size); ErrorOr write(int fd, void const* data, size_t data_size); +ErrorOr kill(pid_t, int signal); }