syscalls: ioctl

This commit is contained in:
Matheus
2023-07-05 20:19:36 -03:00
parent 50597114d1
commit f76046a56b
8 changed files with 51 additions and 8 deletions
+12 -4
View File
@@ -133,10 +133,10 @@ index 0000000..e5b087a
+
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
new file mode 100644
index 0000000..f72940e
index 0000000..8c06e96
--- /dev/null
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
@@ -0,0 +1,260 @@
@@ -0,0 +1,267 @@
+#include <bits/ensure.h>
+#include <mlibc/debug.hpp>
+#include <mlibc/all-sysdeps.hpp>
@@ -192,6 +192,13 @@ index 0000000..f72940e
+ return 0;
+ }
+
+ int sys_ioctl(int fd, unsigned long request, void *arg, int *result) {
+ long ret;
+ long err = syscall(SYSCALL_IOCTL, &ret, fd, request, (uint64_t)arg);
+ *result = ret;
+ return err;
+ }
+
+ int sys_unlinkat(int fd, const char *path, int flags) {
+ long ret;
+ return syscall(SYSCALL_UNLINKAT, &ret, fd, (uint64_t)path, flags);
@@ -416,10 +423,10 @@ index 0000000..990eca0
+#endif
diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
new file mode 100644
index 0000000..89e809e
index 0000000..294c8ab
--- /dev/null
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
@@ -0,0 +1,49 @@
@@ -0,0 +1,50 @@
+#ifndef _SYSCALL_H_INCLUDE
+#define _SYSCALL_H_INCLUDE
+
@@ -449,6 +456,7 @@ index 0000000..89e809e
+#define SYSCALL_ISATTY 23
+#define SYSCALL_FACCESSAT 24
+#define SYSCALL_UNLINKAT 25
+#define SYSCALL_IOCTL 26
+
+#include <stddef.h>
+#include <stdint.h>