diff --git a/common/Cargo.toml b/common/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..3b6ffb52567397590c5db63686996dd2bf66e0de
--- /dev/null
+++ b/common/Cargo.toml
@@ -0,0 +1,4 @@
+[package]
+name = "common"
+version = "0.1.0"
+authors = ["Jeremy Soller <jackpot51@gmail.com>"]
diff --git a/common/src/lib.rs b/common/src/lib.rs
new file mode 100644
index 0000000000000000000000000000000000000000..ecb19b8e28113be8ec7e187b4d53cad9368c9c19
--- /dev/null
+++ b/common/src/lib.rs
@@ -0,0 +1,60 @@
+//! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html
+
+#![no_std]
+#![allow(non_camel_case_types)]
+
+// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
+// more optimization opportunities around it recognizing things like
+// malloc/free.
+#[repr(u8)]
+pub enum c_void {
+    // Two dummy variants so the #[repr] attribute can be used.
+    #[doc(hidden)]
+    __variant1,
+    #[doc(hidden)]
+    __variant2,
+}
+
+pub type int8_t = i8;
+pub type int16_t = i16;
+pub type int32_t = i32;
+pub type int64_t = i64;
+pub type uint8_t = u8;
+pub type uint16_t = u16;
+pub type uint32_t = u32;
+pub type uint64_t = u64;
+
+pub type c_schar = i8;
+pub type c_uchar = u8;
+pub type c_short = i16;
+pub type c_ushort = u16;
+pub type c_int = i32;
+pub type c_uint = u32;
+pub type c_float = f32;
+pub type c_double = f64;
+pub type c_longlong = i64;
+pub type c_ulonglong = u64;
+pub type intmax_t = i64;
+pub type uintmax_t = u64;
+
+pub type size_t = usize;
+pub type ptrdiff_t = isize;
+pub type intptr_t = isize;
+pub type uintptr_t = usize;
+pub type ssize_t = isize;
+
+pub type c_char = i8;
+pub type c_long = i64;
+pub type c_ulong = u64;
+
+pub type wchar_t = i16;
+
+pub type off_t = c_long;
+pub type mode_t = u16;
+pub type time_t = i64;
+pub type pid_t = usize;
+pub type gid_t = usize;
+pub type uid_t = usize;
+
+pub type useconds_t = i32;
+pub type suseconds_t = i64;
diff --git a/fcntl/Cargo.toml b/fcntl/Cargo.toml
index c8e3ff555c4e5c3a4bda90dcdd022b074b83b19b..ca316750d4da17417e87685e5b18bb485b3cd6de 100644
--- a/fcntl/Cargo.toml
+++ b/fcntl/Cargo.toml
@@ -8,4 +8,4 @@ build = "build.rs"
 cbindgen = "0.5"
 
 [dependencies]
-libc = { version = "0.2", default-features = false }
+common = { path = "../common" }
diff --git a/fcntl/src/lib.rs b/fcntl/src/lib.rs
index 71c57871595cc9dd3841fb1407e29fe8ce101b9c..b68a5929bb61d4ddd1da0b096dac620ee761adc4 100644
--- a/fcntl/src/lib.rs
+++ b/fcntl/src/lib.rs
@@ -2,9 +2,9 @@
 
 #![no_std]
 
-extern crate libc;
+extern crate common;
 
-use libc::*;
+pub use common::*;
 
 pub const F_DUPFD: c_int = 0;
 pub const F_GETFD: c_int = 1;
diff --git a/include/stdbool.h b/include/stdbool.h
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/include/stdint.h b/include/stdint.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7fa66c949c5809098ab20c263611b6cb894c8e9
--- /dev/null
+++ b/include/stdint.h
@@ -0,0 +1,7 @@
+#ifndef _STDINT_H
+#define _STDINT_H
+
+typedef int int32_t;
+typedef int intptr_t;
+
+#endif /* _STDINT_H */
diff --git a/include/stdlib.h b/include/stdlib.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5f3b03cb3f9c5997b113cf2bb969d1e9d031a12
--- /dev/null
+++ b/include/stdlib.h
@@ -0,0 +1,6 @@
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#include <sys/types.h>
+
+#endif /* _STDLIB_H */
diff --git a/include/sys/types.h b/include/sys/types.h
new file mode 100644
index 0000000000000000000000000000000000000000..416f51149b97d6646bb11f5ef507dfd46ffb6a30
--- /dev/null
+++ b/include/sys/types.h
@@ -0,0 +1,16 @@
+#ifndef _SYS_TYPES_H
+#define _SYS_TYPES_H
+
+typedef int gid_t;
+typedef int uid_t;
+
+typedef long off_t;
+
+typedef int pid_t;
+
+typedef unsigned long size_t;
+typedef long ssize_t;
+
+typedef int useconds_t;
+
+#endif /* _SYS_TYPES_H */
diff --git a/src/lib.rs b/src/lib.rs
index 4e4e661e2fa1b464eb0c5ace462fe80319d1a88a..4c84deb54906e604414626a022cfbab623a10f23 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,14 @@
 #![no_std]
+#![feature(lang_items)]
 
 extern crate fcntl;
 extern crate unistd;
 
 pub use fcntl::*;
 pub use unistd::*;
+
+#[lang = "panic_fmt"]
+#[no_mangle]
+pub extern "C" fn rust_begin_unwind(fmt: ::core::fmt::Arguments, file: &str, line: u32) -> ! {
+    loop {}
+}
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..7cd82ddb60121c7156bc78719a5ea4d4facfeaab
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1 @@
+/write
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..84981286b1357861e2f8f591651e338d2247ab9b
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,5 @@
+write: write.c
+	gcc -nostdinc -nostdlib -I ../include -I ../target/include $< ../target/debug/libc.a -o $@
+
+clean:
+	rm -f write
diff --git a/tests/write.c b/tests/write.c
new file mode 100644
index 0000000000000000000000000000000000000000..0349a5c09408edb5574056d3d0181af69745f8bf
--- /dev/null
+++ b/tests/write.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+
+void _start(void) {
+    write(STDOUT_FILENO, "Hello World!\n", 14);
+}
diff --git a/unistd/Cargo.toml b/unistd/Cargo.toml
index 9d3813b9dede3cf9f87e21e17dfdb1dd97902380..9e2a47095183070e0c6ed9b6194532b882e9687f 100644
--- a/unistd/Cargo.toml
+++ b/unistd/Cargo.toml
@@ -8,4 +8,4 @@ build = "build.rs"
 cbindgen = "0.5"
 
 [dependencies]
-libc = { version = "0.2", default-features = false }
+common = { path = "../common" }
diff --git a/unistd/src/lib.rs b/unistd/src/lib.rs
index d85c6723797bc1bdf921e2ed507b5ad3439c67f2..642965125b74d38b5812f9db2dc55fef5a3a7d9a 100644
--- a/unistd/src/lib.rs
+++ b/unistd/src/lib.rs
@@ -2,9 +2,9 @@
 
 #![no_std]
 
-extern crate libc;
+extern crate common;
 
-use libc::*;
+pub use common::*;
 
 pub const NULL: c_int = 0;