about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeremy Soller <jackpot51@gmail.com>2016-12-20 15:26:58 -0700
committerJeremy Soller <jackpot51@gmail.com>2016-12-20 15:26:58 -0700
commite55596fa2011254fc29e7b386fb36416c79cf17f (patch)
tree1324f595eb13c1be23720e56539b93bfe2f56e9e
parent01157e6b3cf3acd2c555d36e272c7ad05d837868 (diff)
downloadrust-e55596fa2011254fc29e7b386fb36416c79cf17f.tar.gz
rust-e55596fa2011254fc29e7b386fb36416c79cf17f.zip
Move rt into sys::rt, fix tidy
-rw-r--r--src/libstd/rt.rs5
-rw-r--r--src/libstd/sys/redox/mod.rs2
-rw-r--r--src/libstd/sys/redox/net/netc.rs10
-rw-r--r--src/libstd/sys/redox/rt.rs (renamed from src/libstd/sys/redox/start.rs)26
-rw-r--r--src/libstd/sys/redox/syscall/arch/arm.rs13
-rw-r--r--src/libstd/sys/redox/syscall/arch/x86.rs13
-rw-r--r--src/libstd/sys/redox/syscall/arch/x86_64.rs16
-rw-r--r--src/libstd/sys/redox/syscall/call.rs21
-rw-r--r--src/libstd/sys/redox/syscall/data.rs94
-rw-r--r--src/libstd/sys/redox/syscall/error.rs10
-rw-r--r--src/libstd/sys/redox/syscall/flag.rs10
-rw-r--r--src/libstd/sys/redox/syscall/mod.rs14
-rw-r--r--src/libstd/sys/redox/syscall/number.rs10
-rw-r--r--src/libstd/sys/redox/syscall/scheme.rs232
-rw-r--r--src/libstd/sys/unix/mod.rs1
-rw-r--r--src/libstd/sys/unix/rt.rs11
-rw-r--r--src/libstd/sys/windows/mod.rs1
-rw-r--r--src/libstd/sys/windows/rt.rs11
18 files changed, 163 insertions, 337 deletions
diff --git a/src/libstd/rt.rs b/src/libstd/rt.rs
index abaa6358645..1f2b94239a8 100644
--- a/src/libstd/rt.rs
+++ b/src/libstd/rt.rs
@@ -26,9 +26,8 @@
 pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count};
 
 // Reexport the start module on platforms that provide it
-#[unstable(feature = "start_fn", issue="0")]
-#[cfg(target_os = "redox")]
-pub use sys::start::*;
+#[unstable(feature = "sys_rt", issue="0")]
+pub use sys::rt::*;
 
 #[cfg(not(test))]
 #[lang = "start"]
diff --git a/src/libstd/sys/redox/mod.rs b/src/libstd/sys/redox/mod.rs
index fce1cb364fa..d4811a3444f 100644
--- a/src/libstd/sys/redox/mod.rs
+++ b/src/libstd/sys/redox/mod.rs
@@ -29,9 +29,9 @@ pub mod path;
 pub mod pipe;
 pub mod process;
 pub mod rand;
+pub mod rt;
 pub mod rwlock;
 pub mod stack_overflow;
-pub mod start;
 pub mod stdio;
 pub mod syscall;
 pub mod thread;
diff --git a/src/libstd/sys/redox/net/netc.rs b/src/libstd/sys/redox/net/netc.rs
index 78045c54fb2..03e1c9fffa4 100644
--- a/src/libstd/sys/redox/net/netc.rs
+++ b/src/libstd/sys/redox/net/netc.rs
@@ -1,3 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 pub type in_addr_t = u32;
 pub type in_port_t = u16;
 
diff --git a/src/libstd/sys/redox/start.rs b/src/libstd/sys/redox/rt.rs
index 87f58a4773c..0e854989c12 100644
--- a/src/libstd/sys/redox/start.rs
+++ b/src/libstd/sys/redox/rt.rs
@@ -1,6 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Defintion of functions like _start for the linker
+
 use sys::syscall::exit;
 
-#[unstable(feature = "start_fn", issue = "0")]
+#[unstable(feature = "sys_rt", issue = "0")]
 #[no_mangle]
 #[naked]
 #[cfg(target_arch = "x86")]
@@ -15,7 +27,7 @@ pub unsafe fn _start() {
     let _ = exit(0);
 }
 
-#[unstable(feature = "start_fn", issue = "0")]
+#[unstable(feature = "sys_rt", issue = "0")]
 #[no_mangle]
 #[naked]
 #[cfg(target_arch = "x86_64")]
@@ -30,7 +42,7 @@ pub unsafe fn _start() {
     let _ = exit(0);
 }
 
-#[unstable(feature = "start_fn", issue = "0")]
+#[unstable(feature = "sys_rt", issue = "0")]
 #[no_mangle]
 pub unsafe extern "C" fn _start_stack(stack: *const usize){
     extern "C" {
@@ -45,7 +57,7 @@ pub unsafe extern "C" fn _start_stack(stack: *const usize){
 /// Memcpy
 ///
 /// Copy N bytes of memory from one location to another.
-#[unstable(feature = "start_fn", issue = "0")]
+#[unstable(feature = "sys_rt", issue = "0")]
 #[no_mangle]
 pub unsafe extern fn memcpy(dest: *mut u8, src: *const u8,
                             n: usize) -> *mut u8 {
@@ -61,7 +73,7 @@ pub unsafe extern fn memcpy(dest: *mut u8, src: *const u8,
 /// Memmove
 ///
 /// Copy N bytes of memory from src to dest. The memory areas may overlap.
-#[unstable(feature = "start_fn", issue = "0")]
+#[unstable(feature = "sys_rt", issue = "0")]
 #[no_mangle]
 pub unsafe extern fn memmove(dest: *mut u8, src: *const u8,
                              n: usize) -> *mut u8 {
@@ -85,7 +97,7 @@ pub unsafe extern fn memmove(dest: *mut u8, src: *const u8,
 /// Memset
 ///
 /// Fill a block of memory with a specified value.
-#[unstable(feature = "start_fn", issue = "0")]
+#[unstable(feature = "sys_rt", issue = "0")]
 #[no_mangle]
 pub unsafe extern fn memset(dest: *mut u8, c: i32, n: usize) -> *mut u8 {
     let mut i = 0;
@@ -100,7 +112,7 @@ pub unsafe extern fn memset(dest: *mut u8, c: i32, n: usize) -> *mut u8 {
 /// Memcmp
 ///
 /// Compare two blocks of memory.
-#[unstable(feature = "start_fn", issue = "0")]
+#[unstable(feature = "sys_rt", issue = "0")]
 #[no_mangle]
 pub unsafe extern fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
     let mut i = 0;
diff --git a/src/libstd/sys/redox/syscall/arch/arm.rs b/src/libstd/sys/redox/syscall/arch/arm.rs
index 6e8bc2c0e63..9fb3961486d 100644
--- a/src/libstd/sys/redox/syscall/arch/arm.rs
+++ b/src/libstd/sys/redox/syscall/arch/arm.rs
@@ -1,3 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 use super::error::{Error, Result};
 
 pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
@@ -61,7 +71,8 @@ pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) ->
     Error::demux(a)
 }
 
-pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result<usize> {
+pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
+                       -> Result<usize> {
     asm!("swi $$0"
         : "={r0}"(a)
         : "{r7}"(a), "{r0}"(b), "{r1}"(c), "{r2}"(d), "{r3}"(e), "{r4}"(f)
diff --git a/src/libstd/sys/redox/syscall/arch/x86.rs b/src/libstd/sys/redox/syscall/arch/x86.rs
index 4bb6060c43e..724a6b927f4 100644
--- a/src/libstd/sys/redox/syscall/arch/x86.rs
+++ b/src/libstd/sys/redox/syscall/arch/x86.rs
@@ -1,3 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 use super::error::{Error, Result};
 
 pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
@@ -61,7 +71,8 @@ pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) ->
     Error::demux(a)
 }
 
-pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result<usize> {
+pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
+                       -> Result<usize> {
     asm!("int 0x80"
         : "={eax}"(a)
         : "{eax}"(a), "{ebx}"(b), "{ecx}"(c), "{edx}"(d), "{esi}"(e), "{edi}"(f)
diff --git a/src/libstd/sys/redox/syscall/arch/x86_64.rs b/src/libstd/sys/redox/syscall/arch/x86_64.rs
index 6c1f96adef9..a321c31f207 100644
--- a/src/libstd/sys/redox/syscall/arch/x86_64.rs
+++ b/src/libstd/sys/redox/syscall/arch/x86_64.rs
@@ -1,3 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 use super::error::{Error, Result};
 
 pub unsafe fn syscall0(mut a: usize) -> Result<usize> {
@@ -25,7 +35,8 @@ pub unsafe fn syscall1_clobber(mut a: usize, b: usize) -> Result<usize> {
     asm!("int 0x80"
         : "={rax}"(a)
         : "{rax}"(a), "{rbx}"(b)
-        : "memory", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
+        : "memory", "rbx", "rcx", "rdx", "rsi", "rdi", "r8",
+          "r9", "r10", "r11", "r12", "r13", "r14", "r15"
         : "intel", "volatile");
 
     Error::demux(a)
@@ -61,7 +72,8 @@ pub unsafe fn syscall4(mut a: usize, b: usize, c: usize, d: usize, e: usize) ->
     Error::demux(a)
 }
 
-pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -> Result<usize> {
+pub unsafe fn syscall5(mut a: usize, b: usize, c: usize, d: usize, e: usize, f: usize)
+                       -> Result<usize> {
     asm!("int 0x80"
         : "={rax}"(a)
         : "{rax}"(a), "{rbx}"(b), "{rcx}"(c), "{rdx}"(d), "{rsi}"(e), "{rdi}"(f)
diff --git a/src/libstd/sys/redox/syscall/call.rs b/src/libstd/sys/redox/syscall/call.rs
index 939ebf51072..f58c240f31e 100644
--- a/src/libstd/sys/redox/syscall/call.rs
+++ b/src/libstd/sys/redox/syscall/call.rs
@@ -1,3 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 use super::arch::*;
 use super::data::{Stat, StatVfs, TimeSpec};
 use super::error::Result;
@@ -63,7 +73,8 @@ pub fn dup(fd: usize, buf: &[u8]) -> Result<usize> {
 
 /// Replace the current process with a new executable
 pub fn execve(path: &str, args: &[[usize; 2]]) -> Result<usize> {
-    unsafe { syscall4(SYS_EXECVE, path.as_ptr() as usize, path.len(), args.as_ptr() as usize, args.len()) }
+    unsafe { syscall4(SYS_EXECVE, path.as_ptr() as usize, path.len(),
+                                  args.as_ptr() as usize, args.len()) }
 }
 
 /// Exit the current process
@@ -116,8 +127,9 @@ pub fn ftruncate(fd: usize, len: usize) -> Result<usize> {
     unsafe { syscall2(SYS_FTRUNCATE, fd, len) }
 }
 
-/// Fast userspace mutex - TODO: Document
-pub unsafe fn futex(addr: *mut i32, op: usize, val: i32, val2: usize, addr2: *mut i32) -> Result<usize> {
+/// Fast userspace mutex
+pub unsafe fn futex(addr: *mut i32, op: usize, val: i32, val2: usize, addr2: *mut i32)
+                    -> Result<usize> {
     syscall5(SYS_FUTEX, addr as usize, op, (val as isize) as usize, val2, addr2 as usize)
 }
 
@@ -188,7 +200,8 @@ pub fn mkns(schemes: &[[usize; 2]]) -> Result<usize> {
 
 /// Sleep for the time specified in `req`
 pub fn nanosleep(req: &TimeSpec, rem: &mut TimeSpec) -> Result<usize> {
-    unsafe { syscall2(SYS_NANOSLEEP, req as *const TimeSpec as usize, rem as *mut TimeSpec as usize) }
+    unsafe { syscall2(SYS_NANOSLEEP, req as *const TimeSpec as usize,
+                                     rem as *mut TimeSpec as usize) }
 }
 
 /// Open a file
diff --git a/src/libstd/sys/redox/syscall/data.rs b/src/libstd/sys/redox/syscall/data.rs
index 240690befde..223167d6bf7 100644
--- a/src/libstd/sys/redox/syscall/data.rs
+++ b/src/libstd/sys/redox/syscall/data.rs
@@ -1,61 +1,17 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 use core::ops::{Deref, DerefMut};
 use core::{mem, slice};
 
 #[derive(Copy, Clone, Debug, Default)]
-pub struct Event {
-    pub id: usize,
-    pub flags: usize,
-    pub data: usize
-}
-
-impl Deref for Event {
-    type Target = [u8];
-    fn deref(&self) -> &[u8] {
-        unsafe {
-            slice::from_raw_parts(self as *const Event as *const u8, mem::size_of::<Event>()) as &[u8]
-        }
-    }
-}
-
-impl DerefMut for Event {
-    fn deref_mut(&mut self) -> &mut [u8] {
-        unsafe {
-            slice::from_raw_parts_mut(self as *mut Event as *mut u8, mem::size_of::<Event>()) as &mut [u8]
-        }
-    }
-}
-
-#[derive(Copy, Clone, Debug, Default)]
-#[repr(packed)]
-pub struct Packet {
-    pub id: u64,
-    pub pid: usize,
-    pub uid: u32,
-    pub gid: u32,
-    pub a: usize,
-    pub b: usize,
-    pub c: usize,
-    pub d: usize
-}
-
-impl Deref for Packet {
-    type Target = [u8];
-    fn deref(&self) -> &[u8] {
-        unsafe {
-            slice::from_raw_parts(self as *const Packet as *const u8, mem::size_of::<Packet>()) as &[u8]
-        }
-    }
-}
-
-impl DerefMut for Packet {
-    fn deref_mut(&mut self) -> &mut [u8] {
-        unsafe {
-            slice::from_raw_parts_mut(self as *mut Packet as *mut u8, mem::size_of::<Packet>()) as &mut [u8]
-        }
-    }
-}
-
-#[derive(Copy, Clone, Debug, Default)]
 #[repr(packed)]
 pub struct Stat {
     pub st_dev: u64,
@@ -87,34 +43,8 @@ impl Deref for Stat {
 impl DerefMut for Stat {
     fn deref_mut(&mut self) -> &mut [u8] {
         unsafe {
-            slice::from_raw_parts_mut(self as *mut Stat as *mut u8, mem::size_of::<Stat>()) as &mut [u8]
-        }
-    }
-}
-
-#[derive(Copy, Clone, Debug, Default)]
-#[repr(packed)]
-pub struct StatVfs {
-    pub f_bsize: u32,
-    pub f_blocks: u64,
-    pub f_bfree: u64,
-    pub f_bavail: u64,
-    //TODO: More fields https://linux.die.net/man/2/statvfs
-}
-
-impl Deref for StatVfs {
-    type Target = [u8];
-    fn deref(&self) -> &[u8] {
-        unsafe {
-            slice::from_raw_parts(self as *const StatVfs as *const u8, mem::size_of::<StatVfs>()) as &[u8]
-        }
-    }
-}
-
-impl DerefMut for StatVfs {
-    fn deref_mut(&mut self) -> &mut [u8] {
-        unsafe {
-            slice::from_raw_parts_mut(self as *mut StatVfs as *mut u8, mem::size_of::<StatVfs>()) as &mut [u8]
+            slice::from_raw_parts_mut(self as *mut Stat as *mut u8,
+                                      mem::size_of::<Stat>()) as &mut [u8]
         }
     }
 }
diff --git a/src/libstd/sys/redox/syscall/error.rs b/src/libstd/sys/redox/syscall/error.rs
index 7cbcbe98765..d8d78d55016 100644
--- a/src/libstd/sys/redox/syscall/error.rs
+++ b/src/libstd/sys/redox/syscall/error.rs
@@ -1,3 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 use core::{fmt, result};
 
 #[derive(Eq, PartialEq)]
diff --git a/src/libstd/sys/redox/syscall/flag.rs b/src/libstd/sys/redox/syscall/flag.rs
index 97ff8e2d79a..9f0d3e6f779 100644
--- a/src/libstd/sys/redox/syscall/flag.rs
+++ b/src/libstd/sys/redox/syscall/flag.rs
@@ -1,3 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 pub const CLONE_VM: usize = 0x100;
 pub const CLONE_FS: usize = 0x200;
 pub const CLONE_FILES: usize = 0x400;
diff --git a/src/libstd/sys/redox/syscall/mod.rs b/src/libstd/sys/redox/syscall/mod.rs
index 34a35b967b1..ce789c269a7 100644
--- a/src/libstd/sys/redox/syscall/mod.rs
+++ b/src/libstd/sys/redox/syscall/mod.rs
@@ -1,10 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 pub use self::arch::*;
 pub use self::call::*;
 pub use self::data::*;
 pub use self::error::*;
 pub use self::flag::*;
 pub use self::number::*;
-pub use self::scheme::*;
 
 #[cfg(target_arch = "arm")]
 #[path="arch/arm.rs"]
@@ -32,6 +41,3 @@ pub mod flag;
 
 /// Call numbers used by each system call
 pub mod number;
-
-/// A trait useful for scheme handlers
-pub mod scheme;
diff --git a/src/libstd/sys/redox/syscall/number.rs b/src/libstd/sys/redox/syscall/number.rs
index 719c8af218f..358746cd20a 100644
--- a/src/libstd/sys/redox/syscall/number.rs
+++ b/src/libstd/sys/redox/syscall/number.rs
@@ -1,3 +1,13 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
 pub const SYS_CLASS: usize =    0xF000_0000;
 pub const SYS_CLASS_PATH: usize=0x1000_0000;
 pub const SYS_CLASS_FILE: usize=0x2000_0000;
diff --git a/src/libstd/sys/redox/syscall/scheme.rs b/src/libstd/sys/redox/syscall/scheme.rs
deleted file mode 100644
index d322f0b5a9c..00000000000
--- a/src/libstd/sys/redox/syscall/scheme.rs
+++ /dev/null
@@ -1,232 +0,0 @@
-use core::{mem, slice};
-
-use super::*;
-
-pub trait Scheme {
-    fn handle(&self, packet: &mut Packet) {
-        packet.a = Error::mux(match packet.a {
-            SYS_OPEN => self.open(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.d, packet.uid, packet.gid),
-            SYS_CHMOD => self.chmod(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.d as u16, packet.uid, packet.gid),
-            SYS_RMDIR => self.rmdir(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.uid, packet.gid),
-            SYS_UNLINK => self.unlink(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.uid, packet.gid),
-
-            SYS_DUP => self.dup(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }),
-            SYS_READ => self.read(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }),
-            SYS_WRITE => self.write(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }),
-            SYS_LSEEK => self.seek(packet.b, packet.c, packet.d),
-            SYS_FCNTL => self.fcntl(packet.b, packet.c, packet.d),
-            SYS_FEVENT => self.fevent(packet.b, packet.c),
-            SYS_FMAP => self.fmap(packet.b, packet.c, packet.d),
-            SYS_FPATH => self.fpath(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }),
-            SYS_FSTAT => if packet.d >= mem::size_of::<Stat>() { self.fstat(packet.b, unsafe { &mut *(packet.c as *mut Stat) }) } else { Err(Error::new(EFAULT)) },
-            SYS_FSTATVFS => if packet.d >= mem::size_of::<StatVfs>() { self.fstatvfs(packet.b, unsafe { &mut *(packet.c as *mut StatVfs) }) } else { Err(Error::new(EFAULT)) },
-            SYS_FSYNC => self.fsync(packet.b),
-            SYS_FTRUNCATE => self.ftruncate(packet.b, packet.c),
-            SYS_CLOSE => self.close(packet.b),
-
-            _ => Err(Error::new(ENOSYS))
-        });
-    }
-
-    /* Scheme operations */
-
-    #[allow(unused_variables)]
-    fn open(&self, path: &[u8], flags: usize, uid: u32, gid: u32) -> Result<usize> {
-        Err(Error::new(ENOENT))
-    }
-
-    #[allow(unused_variables)]
-    fn chmod(&self, path: &[u8], mode: u16, uid: u32, gid: u32) -> Result<usize> {
-        Err(Error::new(ENOENT))
-    }
-
-    #[allow(unused_variables)]
-    fn rmdir(&self, path: &[u8], uid: u32, gid: u32) -> Result<usize> {
-        Err(Error::new(ENOENT))
-    }
-
-    #[allow(unused_variables)]
-    fn unlink(&self, path: &[u8], uid: u32, gid: u32) -> Result<usize> {
-        Err(Error::new(ENOENT))
-    }
-
-    /* Resource operations */
-    #[allow(unused_variables)]
-    fn dup(&self, old_id: usize, buf: &[u8]) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn read(&self, id: usize, buf: &mut [u8]) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn write(&self, id: usize, buf: &[u8]) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn seek(&self, id: usize, pos: usize, whence: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fcntl(&self, id: usize, cmd: usize, arg: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fevent(&self, id: usize, flags: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fmap(&self, id: usize, offset: usize, size: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fpath(&self, id: usize, buf: &mut [u8]) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fstat(&self, id: usize, stat: &mut Stat) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fstatvfs(&self, id: usize, stat: &mut StatVfs) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fsync(&self, id: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn ftruncate(&self, id: usize, len: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn close(&self, id: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-}
-
-pub trait SchemeMut {
-    fn handle(&mut self, packet: &mut Packet) {
-        packet.a = Error::mux(match packet.a {
-            SYS_OPEN => self.open(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.d, packet.uid, packet.gid),
-            SYS_CHMOD => self.chmod(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.d as u16, packet.uid, packet.gid),
-            SYS_RMDIR => self.rmdir(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.uid, packet.gid),
-            SYS_UNLINK => self.unlink(unsafe { slice::from_raw_parts(packet.b as *const u8, packet.c) }, packet.uid, packet.gid),
-
-            SYS_DUP => self.dup(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }),
-            SYS_READ => self.read(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }),
-            SYS_WRITE => self.write(packet.b, unsafe { slice::from_raw_parts(packet.c as *const u8, packet.d) }),
-            SYS_LSEEK => self.seek(packet.b, packet.c, packet.d),
-            SYS_FCNTL => self.fcntl(packet.b, packet.c, packet.d),
-            SYS_FEVENT => self.fevent(packet.b, packet.c),
-            SYS_FMAP => self.fmap(packet.b, packet.c, packet.d),
-            SYS_FPATH => self.fpath(packet.b, unsafe { slice::from_raw_parts_mut(packet.c as *mut u8, packet.d) }),
-            SYS_FSTAT => if packet.d >= mem::size_of::<Stat>() { self.fstat(packet.b, unsafe { &mut *(packet.c as *mut Stat) }) } else { Err(Error::new(EFAULT)) },
-            SYS_FSTATVFS => if packet.d >= mem::size_of::<StatVfs>() { self.fstatvfs(packet.b, unsafe { &mut *(packet.c as *mut StatVfs) }) } else { Err(Error::new(EFAULT)) },
-            SYS_FSYNC => self.fsync(packet.b),
-            SYS_FTRUNCATE => self.ftruncate(packet.b, packet.c),
-            SYS_CLOSE => self.close(packet.b),
-
-            _ => Err(Error::new(ENOSYS))
-        });
-    }
-
-    /* Scheme operations */
-    #[allow(unused_variables)]
-    fn open(&mut self, path: &[u8], flags: usize, uid: u32, gid: u32) -> Result<usize> {
-        Err(Error::new(ENOENT))
-    }
-
-    #[allow(unused_variables)]
-    fn chmod(&self, path: &[u8], mode: u16, uid: u32, gid: u32) -> Result<usize> {
-        Err(Error::new(ENOENT))
-    }
-
-    #[allow(unused_variables)]
-    fn rmdir(&mut self, path: &[u8], uid: u32, gid: u32) -> Result<usize> {
-        Err(Error::new(ENOENT))
-    }
-
-    #[allow(unused_variables)]
-    fn unlink(&mut self, path: &[u8], uid: u32, gid: u32) -> Result<usize> {
-        Err(Error::new(ENOENT))
-    }
-
-    /* Resource operations */
-    #[allow(unused_variables)]
-    fn dup(&mut self, old_id: usize, buf: &[u8]) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn read(&mut self, id: usize, buf: &mut [u8]) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn write(&mut self, id: usize, buf: &[u8]) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn seek(&mut self, id: usize, pos: usize, whence: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fcntl(&mut self, id: usize, cmd: usize, arg: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fevent(&mut self, id: usize, flags: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fmap(&mut self, id: usize, offset: usize, size: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fpath(&mut self, id: usize, buf: &mut [u8]) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fstat(&mut self, id: usize, stat: &mut Stat) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fstatvfs(&self, id: usize, stat: &mut StatVfs) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn fsync(&mut self, id: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn ftruncate(&mut self, id: usize, len: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-
-    #[allow(unused_variables)]
-    fn close(&mut self, id: usize) -> Result<usize> {
-        Err(Error::new(EBADF))
-    }
-}
diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs
index fd7dc17cccd..5e14b392bdc 100644
--- a/src/libstd/sys/unix/mod.rs
+++ b/src/libstd/sys/unix/mod.rs
@@ -50,6 +50,7 @@ pub mod path;
 pub mod pipe;
 pub mod process;
 pub mod rand;
+pub mod rt;
 pub mod rwlock;
 pub mod stack_overflow;
 pub mod thread;
diff --git a/src/libstd/sys/unix/rt.rs b/src/libstd/sys/unix/rt.rs
new file mode 100644
index 00000000000..188e31cb5d7
--- /dev/null
+++ b/src/libstd/sys/unix/rt.rs
@@ -0,0 +1,11 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Stub for placing functions like _start for the linker
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index defc41c5f46..52d256630a5 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -36,6 +36,7 @@ pub mod path;
 pub mod pipe;
 pub mod process;
 pub mod rand;
+pub mod rt;
 pub mod rwlock;
 pub mod stack_overflow;
 pub mod thread;
diff --git a/src/libstd/sys/windows/rt.rs b/src/libstd/sys/windows/rt.rs
new file mode 100644
index 00000000000..188e31cb5d7
--- /dev/null
+++ b/src/libstd/sys/windows/rt.rs
@@ -0,0 +1,11 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Stub for placing functions like _start for the linker