diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-23 16:06:56 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-24 00:25:22 +0100 |
commit | 8b7b726680313f17be50a9fbb577f14995c33218 (patch) | |
tree | a8feb7c85981ea36ef1bdd5915cd1867ac93d892 | |
parent | e7d4622ce098171f421ca55c4016f7641ef9dc03 (diff) | |
download | serenity-8b7b726680313f17be50a9fbb577f14995c33218.zip |
LibCore: Add kill() syscall wrapper
-rw-r--r-- | Userland/Libraries/LibCore/System.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/System.h | 1 |
2 files changed, 8 insertions, 0 deletions
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<ssize_t> write(int fd, void const* data, size_t data_size) return rc; } +ErrorOr<void> 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<void> ftruncate(int fd, off_t length); ErrorOr<struct stat> stat(StringView path); ErrorOr<ssize_t> read(int fd, void* buffer, size_t buffer_size); ErrorOr<ssize_t> write(int fd, void const* data, size_t data_size); +ErrorOr<void> kill(pid_t, int signal); } |