diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 3cddacc95e..23ad53b603 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -648,6 +648,19 @@ ErrorOr utime(StringView path, Optional maybe_buf) #endif } +ErrorOr uname() +{ + utsname uts; +#ifdef __serenity__ + int rc = syscall(SC_uname, &uts); + HANDLE_SYSCALL_RETURN_VALUE("uname"sv, rc, uts); +#else + if (::uname(&uts) < 0) + return Error::from_syscall("uname"sv, -errno); +#endif + return uts; +} + 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 8630e58485..12727b3928 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -97,6 +98,7 @@ ErrorOr mkstemp(Span pattern); ErrorOr fchmod(int fd, mode_t mode); ErrorOr rename(StringView old_path, StringView new_path); ErrorOr utime(StringView path, Optional); +ErrorOr uname(); ErrorOr> pipe2(int flags); ErrorOr socket(int domain, int type, int protocol);