summaryrefslogtreecommitdiff
path: root/userland/libc/fcntl
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-10-03 16:08:46 +0200
committerAnton Kling <anton@kling.gg>2024-10-03 16:09:12 +0200
commit372c633aa22d826bc515213ad4211791440f60f8 (patch)
treeb2de66c9bf612a0a149c65786335a6cebde37840 /userland/libc/fcntl
parent226d861c9ebb7f09f95665d07d9ab5c6b7ed7d6f (diff)
libc: Add sendfile and queue
Diffstat (limited to 'userland/libc/fcntl')
-rw-r--r--userland/libc/fcntl/fcntl.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/userland/libc/fcntl/fcntl.c b/userland/libc/fcntl/fcntl.c
new file mode 100644
index 0000000..0a4be9e
--- /dev/null
+++ b/userland/libc/fcntl/fcntl.c
@@ -0,0 +1,15 @@
+#include <fcntl.h>
+#include <stdarg.h>
+#include <syscall.h>
+
+int fcntl(int fd, int cmd, ...) {
+ int arg = 0;
+
+ if ((F_GETFL == cmd) || (F_SETFL == cmd)) {
+ va_list ap;
+ va_start(ap, cmd);
+ arg = va_arg(ap, int);
+ va_end(ap);
+ }
+ RC_ERRNO(syscall(SYS_FCNTL, fd, cmd, arg, 0, 0));
+}