diff --git a/include/bits/fcntl.h b/include/bits/fcntl.h
index 2e194030f6fdd68a0690d28575f8c140c15274b9..9c4a13b73f6584d2c97361a956d0ee493dc636a7 100644
--- a/include/bits/fcntl.h
+++ b/include/bits/fcntl.h
@@ -3,11 +3,20 @@
 
 int open(const char* filename, int flags, ...) {
     mode_t mode = 0;
-	va_list ap;
-	va_start(ap, flags);
+    va_list ap;
+    va_start(ap, flags);
     mode = va_arg(ap, mode_t);
-	va_end(ap);
+    va_end(ap);
     return sys_open(filename, flags, mode);
 }
 
+int fcntl(int fildes, int cmd, ...) {
+    int args = 0;
+    va_list ap;
+    va_start(ap, cmd);
+    args = va_arg(ap, int);
+    va_end(ap);
+    return sys_fcntl(fildes, cmd, args);
+}
+
 #endif
diff --git a/src/fcntl/src/lib.rs b/src/fcntl/src/lib.rs
index b2f0d54432bf74ec31a789907ac8bee808de016e..0c0fa43ce2e5f667bd9b4c3baa89fe8a037a9638 100644
--- a/src/fcntl/src/lib.rs
+++ b/src/fcntl/src/lib.rs
@@ -37,7 +37,7 @@ pub extern "C" fn creat(path: *const c_char, mode: mode_t) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int {
+pub extern "C" fn sys_fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int {
     platform::fcntl(fildes, cmd, arg)
 }
 
diff --git a/tests/Makefile b/tests/Makefile
index 819e781bcf2d0141061829f3db587212a54f2737..d7fafcdb2eb5b54690b6b79f32b755644c04a106 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -9,6 +9,7 @@ BINS=\
 	dup \
 	error \
 	fchdir \
+	fcntl \
 	fsync \
 	ftruncate \
 	getid \
diff --git a/tests/fcntl b/tests/fcntl
new file mode 100755
index 0000000000000000000000000000000000000000..4499cb1482f3157fa2e77cac3c4a42fcd72fedf3
Binary files /dev/null and b/tests/fcntl differ
diff --git a/tests/fcntl.c b/tests/fcntl.c
new file mode 100644
index 0000000000000000000000000000000000000000..f9293a5333dee9cb2387820cb43c20a409c24a12
--- /dev/null
+++ b/tests/fcntl.c
@@ -0,0 +1,13 @@
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int main() {
+    //Lose our fd and pull it again
+    creat("fcntl.out", 0777);
+    int newfd = open("fcntl.out", 0);
+    int newfd2 = fcntl(newfd, F_DUPFD, 0);
+    printf("fd %d duped into fd %d\n", newfd, newfd2);
+    close(newfd);
+    close(newfd2);
+}
diff --git a/tests/fcntl.out b/tests/fcntl.out
new file mode 100755
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391