summaryrefslogtreecommitdiff
path: root/lib/libc/devctl
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
commitfc00c656c96528112d05cf0edf8631bd5eaea446 (patch)
treea6e0e6c588191a8bd1c64afc3b7a258e3e66c236 /lib/libc/devctl
Add build system scaffolding and libc headers
Diffstat (limited to 'lib/libc/devctl')
-rw-r--r--lib/libc/devctl/posix_devctl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/libc/devctl/posix_devctl.c b/lib/libc/devctl/posix_devctl.c
new file mode 100644
index 00000000..bc8e7331
--- /dev/null
+++ b/lib/libc/devctl/posix_devctl.c
@@ -0,0 +1,17 @@
+#include <libc.h>
+#include <devctl.h>
+#include <errno.h>
+#include <syscall.h>
+
+int posix_devctl(int fildes, int dcmd, void *restrict dev_data_ptr,
+ size_t unused nbyte, int *restrict dev_info_ptr)
+{
+ long r;
+
+ if ((r = syscall(ioctl, fildes, dcmd, dev_data_ptr)) < 0)
+ return errno;
+
+ *dev_info_ptr = r;
+
+ return 0;
+}