diff --git a/platform/src/linux/mod.rs b/platform/src/linux/mod.rs
index 8e06078cd3a218be6781fd536a0835fbf3159767..63328414ada88bba327679976028ca14eb1113be 100644
--- a/platform/src/linux/mod.rs
+++ b/platform/src/linux/mod.rs
@@ -4,7 +4,11 @@ const AT_FDCWD: c_int = -100;
 
 pub fn brk(addr: *const c_void) -> c_int {
     unsafe {
-        syscall!(BRK, addr) as c_int
+        let newbrk = syscall!(BRK, addr);
+        if newbrk < addr as usize {
+            return -1
+        }
+        0
     }
 }
 
diff --git a/src/stdio/src/lib.rs b/src/stdio/src/lib.rs
index eb20b34308c3fac7865d653e4605c6c1c507bec0..529097c2fc611fb0105453af5e4af06b2a001ac0 100644
--- a/src/stdio/src/lib.rs
+++ b/src/stdio/src/lib.rs
@@ -190,13 +190,6 @@ pub extern "C" fn getchar_unlocked() -> c_int {
     unimplemented!();
 }
 
-#[no_mangle]
-pub extern "C" fn getopt(argc: c_int,
-                  argv: *const *const c_char,
-                  optstring: c_char) -> c_int {
-    unimplemented!();
-}
-
 #[no_mangle]
 pub extern "C" fn gets(s: *mut c_char)
      -> *mut c_char {
diff --git a/src/unistd/src/lib.rs b/src/unistd/src/lib.rs
index 62334071f6209fb2459a3dab589d390457610c14..bc57fb4116237fe5da1425266b4251f9ab3d393a 100644
--- a/src/unistd/src/lib.rs
+++ b/src/unistd/src/lib.rs
@@ -74,16 +74,6 @@ pub extern "C" fn crypt(key: *const c_char, salt: *const c_char) -> *mut c_char
     unimplemented!();
 }
 
-#[no_mangle]
-pub extern "C" fn ctermid(s: *mut c_char) -> *mut c_char {
-    unimplemented!();
-}
-
-#[no_mangle]
-pub extern "C" fn cuserid(s: *mut c_char) -> *mut c_char {
-    unimplemented!();
-}
-
 #[no_mangle]
 pub extern "C" fn dup(fildes: c_int) -> c_int {
     platform::dup(fildes)
diff --git a/tests/.gitignore b/tests/.gitignore
index 45f2b7aa2e3388931915959530fdb5e1a8940745..8b20545d33ca2e51d0797104928be31ed7149475 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,7 +1,13 @@
 /alloc
 /args
+/brk
+/chdir
 /create
 /create.out
+/dup
+/dup.out
+/fchdir
+/fsync
 /math
 /printf
 /write
diff --git a/tests/Makefile b/tests/Makefile
index f3a5ff7366692c77f4d108082d76f0fa692d36b0..d2a82908e02f62e3dde746d08c9750bc3c72edd0 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,7 +1,12 @@
 BINS=\
 	alloc \
+	brk \
 	args \
+	chdir \
 	create \
+	dup \
+	fchdir \
+	fsync \
 	math \
 	printf \
 	write
diff --git a/tests/alloc.c b/tests/alloc.c
index 99f11ff75fb8c28a60fc6a7db5ca9f45914369b6..a9fee5ee1be8a7c1f1ef519338ec418ff592ded4 100644
--- a/tests/alloc.c
+++ b/tests/alloc.c
@@ -9,4 +9,12 @@ int main(int argc, char ** argv) {
         ptr[i] = (char)i;
     }
     free(ptr);
+
+    char * ptrc = (char *)calloc(256,1);
+    printf("calloc %p\n", ptrc);
+    for(int i = 0; i < 256; i++) {
+        ptrc[i] = (char)i;
+    }
+    free(ptrc);
+
 }
diff --git a/tests/brk.c b/tests/brk.c
new file mode 100644
index 0000000000000000000000000000000000000000..a6f1e358fc7c72cd9eb025d416e4e753c80985fa
--- /dev/null
+++ b/tests/brk.c
@@ -0,0 +1,8 @@
+#include <unistd.h>
+#include <stdio.h>
+
+int main(int argc, char** argv) {
+    int status = brk((void*)100);
+    printf("brk exited with status code %d\n", status);
+}
+
diff --git a/tests/chdir.c b/tests/chdir.c
new file mode 100644
index 0000000000000000000000000000000000000000..38eb4467088eb1d4184f02a2e78b7895a990c582
--- /dev/null
+++ b/tests/chdir.c
@@ -0,0 +1,15 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char** argv) {
+    char* cwd1 = malloc(4096*sizeof(char));//(char*) calloc(4096 + 1, sizeof(char));
+    getcwd(cwd1, 4096);
+    printf("initial cwd: %s\n", cwd1);
+    free(cwd1);
+    chdir("..");
+    char* cwd2 = malloc(4096*sizeof(char));//(char*) calloc(4096 + 1, sizeof(char));
+    getcwd(cwd2, 4096);
+    printf("final cwd: %s\n", cwd2);
+    free(cwd2);
+}
diff --git a/tests/dup.c b/tests/dup.c
new file mode 100644
index 0000000000000000000000000000000000000000..1a5a32555b3bd214b38a8e283ca489a459aa717a
--- /dev/null
+++ b/tests/dup.c
@@ -0,0 +1,16 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+int main(int argc, char** argv) {
+    creat("dup.out", 0777);
+    int fd1 = open("dup.out", 0, 0);
+    int fd2 = dup(fd1);
+    printf("fd %d duped into fd %d\n", fd1, fd2);
+    close(fd1);
+    close(fd2);
+    int fd3 = open("dup.out", 0x0002, 0x1000);
+    dup2(fd3, 1);
+    printf("hello fd %d", fd3);
+    close(fd3);
+}
diff --git a/tests/fchdir.c b/tests/fchdir.c
new file mode 100644
index 0000000000000000000000000000000000000000..b7786423244ebf1495a6b4d3a58867363a3400d2
--- /dev/null
+++ b/tests/fchdir.c
@@ -0,0 +1,11 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+int main (int argc, char** argv) {
+    int fd = open("..", 0, 0);
+    int status;
+    status = fchdir(fd);
+    printf("fchdir exited with status code %d\n", status);
+    close(fd);
+}
diff --git a/tests/fsync.c b/tests/fsync.c
new file mode 100644
index 0000000000000000000000000000000000000000..a86887185e2da22410e0daed7a89492dc705eeca
--- /dev/null
+++ b/tests/fsync.c
@@ -0,0 +1,11 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+int main (int argc, char** argv) {
+    int fd = open(".", 0, 0);
+    int status;
+    status = fsync(fd);
+    printf("fsync exited with status code %d\n", status);
+    close(fd);
+}