summaryrefslogtreecommitdiff
path: root/LibC/ioctl.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-16 13:11:21 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-16 13:13:50 +0100
commitc99f8af66da3464447e3f310cddb21f63d59292a (patch)
treec68dd546d5e20a3df0162a4a22af1e2954d2a871 /LibC/ioctl.cpp
parent2529925fe9e41a4cceb436e5bc830c07810d6716 (diff)
downloadserenity-c99f8af66da3464447e3f310cddb21f63d59292a.zip
Add ioctl() and reimplement tcsetpgrp/tcsetpgrp as ioctls.
Diffstat (limited to 'LibC/ioctl.cpp')
-rw-r--r--LibC/ioctl.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/LibC/ioctl.cpp b/LibC/ioctl.cpp
new file mode 100644
index 0000000000..dcfc7ce7a4
--- /dev/null
+++ b/LibC/ioctl.cpp
@@ -0,0 +1,19 @@
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <Kernel/Syscall.h>
+
+extern "C" {
+
+int ioctl(int fd, unsigned request, ...)
+{
+ va_list ap;
+ va_start(ap, request);
+ unsigned arg = va_arg(ap, unsigned);
+ int rc = Syscall::invoke(Syscall::SC_ioctl, (dword)fd, (dword)request, (dword)arg);
+ __RETURN_WITH_ERRNO(rc, rc, -1);
+}
+
+}
+