diff --git a/src/platform/src/linux/mod.rs b/src/platform/src/linux/mod.rs
index 692e5f684473bb2912d12c76264bacbfe1dbe02f..f4b0116cb91792bd2a656d4472263f8949379b59 100644
--- a/src/platform/src/linux/mod.rs
+++ b/src/platform/src/linux/mod.rs
@@ -84,6 +84,10 @@ pub fn fchown(fildes: c_int, owner: uid_t, group: gid_t) -> c_int {
     e(unsafe { syscall!(FCHOWN, fildes, owner, group) }) as c_int
 }
 
+pub fn flock(fd: c_int, operation: c_int) -> c_int {
+    e(unsafe { syscall!(FLOCK, fd, operation) }) as c_int
+}
+
 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int {
     let empty_cstr: *const c_char = unsafe { ::cstr_from_bytes_with_nul_unchecked(b"\0") };
     e(unsafe { syscall!(NEWFSTATAT, fildes, empty_cstr, buf, AT_EMPTY_PATH) }) as c_int
diff --git a/src/platform/src/redox/mod.rs b/src/platform/src/redox/mod.rs
index 1c13ff2dfaa925422aad9e7407e1adb6f9b728da..80a29e95bb4545774c8c971994be26df519cf18a 100644
--- a/src/platform/src/redox/mod.rs
+++ b/src/platform/src/redox/mod.rs
@@ -226,6 +226,11 @@ pub fn fcntl(fd: c_int, cmd: c_int, args: c_int) -> c_int {
     e(syscall::fcntl(fd as usize, cmd as usize, args as usize)) as c_int
 }
 
+pub fn flock(_fd: c_int, _operation: c_int) -> c_int {
+    // TODO: Redox does not have file locking yet
+    0
+}
+
 pub fn fork() -> pid_t {
     e(unsafe { syscall::clone(0) }) as pid_t
 }
diff --git a/src/platform/src/types.rs b/src/platform/src/types.rs
index 2713023473f2c694aefbdce279a6276a3ef23582..dbd5364b57c719011ceee36f5eb22544f9f7d4cc 100644
--- a/src/platform/src/types.rs
+++ b/src/platform/src/types.rs
@@ -1,3 +1,4 @@
+use core::mem;
 #[cfg(target_os = "redox")]
 use syscall::data::TimeSpec as redox_timespec;
 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
diff --git a/src/sys_file/Cargo.toml b/src/sys_file/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..1853666e93b14d74899f8d5f6600f38ab44075a2
--- /dev/null
+++ b/src/sys_file/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "sys_file"
+version = "0.1.0"
+authors = ["jD91mZM2 <me@krake.one>"]
+
+[build-dependencies]
+cbindgen = { path = "../../cbindgen" }
+
+[dependencies]
+platform = { path = "../platform" }
diff --git a/src/sys_file/build.rs b/src/sys_file/build.rs
new file mode 100644
index 0000000000000000000000000000000000000000..1009eaeebbc9f6cfe10e902e95529492e91fe529
--- /dev/null
+++ b/src/sys_file/build.rs
@@ -0,0 +1,11 @@
+extern crate cbindgen;
+
+use std::{env, fs};
+
+fn main() {
+    let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
+    fs::create_dir_all("../../target/include").expect("failed to create include directory");
+    cbindgen::generate(crate_dir)
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/sys/file.h");
+}
diff --git a/src/sys_file/cbindgen.toml b/src/sys_file/cbindgen.toml
new file mode 100644
index 0000000000000000000000000000000000000000..457c5dfcabec5eadff04ee90ace680c3a402a0ac
--- /dev/null
+++ b/src/sys_file/cbindgen.toml
@@ -0,0 +1,6 @@
+include_guard = "_SYS_FILE_H"
+language = "C"
+style = "Tag"
+
+[enum]
+prefix_with_name = true
diff --git a/src/sys_file/src/lib.rs b/src/sys_file/src/lib.rs
new file mode 100644
index 0000000000000000000000000000000000000000..2ffb3e04bcdf2cd93fbf0428e30d9e6b555200f5
--- /dev/null
+++ b/src/sys_file/src/lib.rs
@@ -0,0 +1,21 @@
+//! sys/file.h implementation
+
+#![no_std]
+
+extern crate platform;
+
+use platform::types::*;
+
+pub const LOCK_SH: usize = 1;
+pub const LOCK_EX: usize = 1 << 1;
+pub const LOCK_NB: usize = 1 << 2;
+pub const LOCK_UN: usize = 1 << 3;
+
+pub const L_SET: usize = 0;
+pub const L_INCR: usize = 1;
+pub const L_XTND: usize = 2;
+
+#[no_mangle]
+pub extern "C" fn flock(fd: c_int, operation: c_int) -> c_int {
+    platform::flock(fd, operation)
+}
diff --git a/src/sys_ioctl/cbindgen.toml b/src/sys_ioctl/cbindgen.toml
index fb4982cc5f86a66a015a1db2f91ecfde0c31abf9..65ae4ea043e8b964cd9521226ebb629d3172f61d 100644
--- a/src/sys_ioctl/cbindgen.toml
+++ b/src/sys_ioctl/cbindgen.toml
@@ -1,5 +1,4 @@
-sys_includes = []
-include_guard = "_IOCTL_H"
+include_guard = "_SYS_IOCTL_H"
 language = "C"
 
 # WORKAROUND: