diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index a3b7a3e1bf..46766b0c90 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -2,6 +2,7 @@ * Copyright (c) 2021-2022, Andreas Kling * Copyright (c) 2021, Kenneth Myhra * Copyright (c) 2021, Sam Atkins + * Copyright (c) 2022, Matthias Zimmerman * * SPDX-License-Identifier: BSD-2-Clause */ @@ -15,6 +16,7 @@ #include #include #include +#include #include #include @@ -741,6 +743,18 @@ ErrorOr uname() return uts; } +ErrorOr adjtime(const struct timeval* delta, struct timeval* old_delta) +{ +#ifdef __serenity__ + int rc = syscall(SC_adjtime, delta, old_delta); + HANDLE_SYSCALL_RETURN_VALUE("adjtime"sv, rc, {}); +#else + if (::adjtime(delta, old_delta) < 0) + return Error::from_syscall("adjtime"sv, -errno); + return {}; +#endif +} + ErrorOr socket(int domain, int type, int protocol) { auto fd = ::socket(domain, type, protocol); diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 5b3e7a1c6c..c13a938d55 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +113,7 @@ ErrorOr unlink(StringView path); ErrorOr utime(StringView path, Optional); ErrorOr uname(); ErrorOr> pipe2(int flags); +ErrorOr adjtime(const struct timeval* delta, struct timeval* old_delta); ErrorOr socket(int domain, int type, int protocol); ErrorOr bind(int sockfd, struct sockaddr const*, socklen_t);