diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index b0198294fe..17c6fd5cc0 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -229,4 +230,15 @@ ErrorOr gethostname() return String(&hostname[0]); } +ErrorOr ioctl(int fd, unsigned request, ...) +{ + va_list ap; + va_start(ap, request); + FlatPtr arg = va_arg(ap, FlatPtr); + va_end(ap); + if (::ioctl(fd, request, arg) < 0) + return Error::from_syscall("ioctl"sv, -errno); + return {}; +} + } diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 121867701c..2dc6665975 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -36,5 +36,6 @@ ErrorOr dup(int source_fd); ErrorOr dup2(int source_fd, int destination_fd); ErrorOr ptsname(int fd); ErrorOr gethostname(); +ErrorOr ioctl(int fd, unsigned request, ...); }