diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibCore/System.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/System.h | 1 |
2 files changed, 13 insertions, 0 deletions
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 <LibSystem/syscall.h> #include <fcntl.h> #include <stdarg.h> +#include <sys/ioctl.h> #include <sys/mman.h> #include <sys/socket.h> #include <unistd.h> @@ -229,4 +230,15 @@ ErrorOr<String> gethostname() return String(&hostname[0]); } +ErrorOr<void> 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<int> dup(int source_fd); ErrorOr<int> dup2(int source_fd, int destination_fd); ErrorOr<String> ptsname(int fd); ErrorOr<String> gethostname(); +ErrorOr<void> ioctl(int fd, unsigned request, ...); } |