summaryrefslogtreecommitdiff
path: root/userland/libc/fcntl/fcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/fcntl/fcntl.c')
-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));
+}