about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-11-05 23:29:11 -0800
committerAlex Crichton <alex@alexcrichton.com>2013-11-10 01:37:11 -0800
commit5e6bbc6bfa82f3ad0a014df24b40cbc042f24035 (patch)
tree08a64c33bf88ad4c750db52f5f64e0717302b91f /src
parentb545751597a8cdeee4554338318f0ed6339634fd (diff)
downloadrust-5e6bbc6bfa82f3ad0a014df24b40cbc042f24035.tar.gz
rust-5e6bbc6bfa82f3ad0a014df24b40cbc042f24035.zip
Assorted test fixes and merge conflicts
Diffstat (limited to 'src')
-rw-r--r--src/librustuv/file.rs78
-rw-r--r--src/librustuv/net.rs57
-rw-r--r--src/librustuv/pipe.rs102
-rw-r--r--src/librustuv/process.rs12
-rw-r--r--src/librustuv/signal.rs2
-rw-r--r--src/librustuv/timer.rs8
-rw-r--r--src/librustuv/tty.rs10
-rw-r--r--src/libstd/rt/io/fs.rs9
8 files changed, 134 insertions, 144 deletions
diff --git a/src/librustuv/file.rs b/src/librustuv/file.rs
index 3b4760e0ff4..ac89ef38e8e 100644
--- a/src/librustuv/file.rs
+++ b/src/librustuv/file.rs
@@ -95,27 +95,6 @@ impl FsRequest {
         }
     }
 
-    pub fn close(loop_: &Loop, fd: c_int, sync: bool) -> Result<(), UvError> {
-        if sync {
-            execute_nop(|req, cb| unsafe {
-                uvll::uv_fs_close(loop_.handle, req, fd, cb)
-            })
-        } else {
-            unsafe {
-                let req = uvll::malloc_req(uvll::UV_FS);
-                uvll::uv_fs_close(loop_.handle, req, fd, close_cb);
-                return Ok(());
-            }
-
-            extern fn close_cb(req: *uvll::uv_fs_t) {
-                unsafe {
-                    uvll::uv_fs_req_cleanup(req);
-                    uvll::free_req(req);
-                }
-            }
-        }
-    }
-
     pub fn mkdir(loop_: &Loop, path: &CString, mode: c_int)
         -> Result<(), UvError>
     {
@@ -240,10 +219,12 @@ impl FsRequest {
     pub fn utime(loop_: &Loop, path: &CString, atime: u64, mtime: u64)
         -> Result<(), UvError>
     {
+        // libuv takes seconds
+        let atime = atime as libc::c_double / 1000.0;
+        let mtime = mtime as libc::c_double / 1000.0;
         execute_nop(|req, cb| unsafe {
             uvll::uv_fs_utime(loop_.handle, req, path.with_ref(|p| p),
-                              atime as libc::c_double, mtime as libc::c_double,
-                              cb)
+                              atime, mtime, cb)
         })
     }
 
@@ -368,12 +349,12 @@ impl FileWatcher {
     }
 
     fn base_read(&mut self, buf: &mut [u8], offset: i64) -> Result<int, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         let r = FsRequest::read(&self.loop_, self.fd, buf, offset);
         r.map_err(uv_error_to_io_error)
     }
     fn base_write(&mut self, buf: &[u8], offset: i64) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         let r = FsRequest::write(&self.loop_, self.fd, buf, offset);
         r.map_err(uv_error_to_io_error)
     }
@@ -397,14 +378,26 @@ impl FileWatcher {
 
 impl Drop for FileWatcher {
     fn drop(&mut self) {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         match self.close {
             rtio::DontClose => {}
             rtio::CloseAsynchronously => {
-                FsRequest::close(&self.loop_, self.fd, false);
+                unsafe {
+                    let req = uvll::malloc_req(uvll::UV_FS);
+                    uvll::uv_fs_close(self.loop_.handle, req, self.fd, close_cb);
+                }
+
+                extern fn close_cb(req: *uvll::uv_fs_t) {
+                    unsafe {
+                        uvll::uv_fs_req_cleanup(req);
+                        uvll::free_req(req);
+                    }
+                }
             }
             rtio::CloseSynchronously => {
-                FsRequest::close(&self.loop_, self.fd, true);
+                execute_nop(|req, cb| unsafe {
+                    uvll::uv_fs_close(self.loop_.handle, req, self.fd, cb)
+                });
             }
         }
     }
@@ -439,15 +432,15 @@ impl rtio::RtioFileStream for FileWatcher {
         self_.seek_common(0, SEEK_CUR)
     }
     fn fsync(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         FsRequest::fsync(&self.loop_, self.fd).map_err(uv_error_to_io_error)
     }
     fn datasync(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         FsRequest::datasync(&self.loop_, self.fd).map_err(uv_error_to_io_error)
     }
     fn truncate(&mut self, offset: i64) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         let r = FsRequest::truncate(&self.loop_, self.fd, offset);
         r.map_err(uv_error_to_io_error)
     }
@@ -482,10 +475,6 @@ mod test {
                 // write
                 let result = FsRequest::write(l, fd, "hello".as_bytes(), -1);
                 assert!(result.is_ok());
-
-                // close
-                let result = FsRequest::close(l, fd, true);
-                assert!(result.is_ok());
             }
 
             {
@@ -505,15 +494,10 @@ mod test {
                 assert!(nread > 0);
                 let read_str = str::from_utf8(read_mem.slice(0, nread as uint));
                 assert_eq!(read_str, ~"hello");
-
-                // close
-                let result = FsRequest::close(l, fd, true);
-                assert!(result.is_ok());
-
-                // unlink
-                let result = FsRequest::unlink(l, &path_str.to_c_str());
-                assert!(result.is_ok());
             }
+            // unlink
+            let result = FsRequest::unlink(l, &path_str.to_c_str());
+            assert!(result.is_ok());
         }
     }
 
@@ -570,12 +554,14 @@ mod test {
             let path = &"./tmp/double_create_dir".to_c_str();
             let mode = S_IWUSR | S_IRUSR;
 
+            let result = FsRequest::stat(l, path);
+            assert!(result.is_err(), "{:?}", result);
             let result = FsRequest::mkdir(l, path, mode as c_int);
-            assert!(result.is_ok());
+            assert!(result.is_ok(), "{:?}", result);
             let result = FsRequest::mkdir(l, path, mode as c_int);
-            assert!(result.is_err());
+            assert!(result.is_err(), "{:?}", result);
             let result = FsRequest::rmdir(l, path);
-            assert!(result.is_ok());
+            assert!(result.is_ok(), "{:?}", result);
         }
     }
 
diff --git a/src/librustuv/net.rs b/src/librustuv/net.rs
index 9fd771b9739..5d228cd7848 100644
--- a/src/librustuv/net.rs
+++ b/src/librustuv/net.rs
@@ -259,43 +259,43 @@ impl HomingIO for TcpWatcher {
 
 impl rtio::RtioSocket for TcpWatcher {
     fn socket_name(&mut self) -> Result<SocketAddr, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         socket_name(Tcp, self.handle)
     }
 }
 
 impl rtio::RtioTcpStream for TcpWatcher {
     fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.stream.read(buf).map_err(uv_error_to_io_error)
     }
 
     fn write(&mut self, buf: &[u8]) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.stream.write(buf).map_err(uv_error_to_io_error)
     }
 
     fn peer_name(&mut self) -> Result<SocketAddr, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         socket_name(TcpPeer, self.handle)
     }
 
     fn control_congestion(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_tcp_nodelay(self.handle, 0 as c_int)
         })
     }
 
     fn nodelay(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_tcp_nodelay(self.handle, 1 as c_int)
         })
     }
 
     fn keepalive(&mut self, delay_in_seconds: uint) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_tcp_keepalive(self.handle, 1 as c_int,
                                    delay_in_seconds as c_uint)
@@ -303,7 +303,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
     }
 
     fn letdie(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_tcp_keepalive(self.handle, 0 as c_int, 0 as c_uint)
         })
@@ -312,7 +312,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
 
 impl Drop for TcpWatcher {
     fn drop(&mut self) {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.stream.close();
     }
 }
@@ -356,7 +356,7 @@ impl UvHandle<uvll::uv_tcp_t> for TcpListener {
 
 impl rtio::RtioSocket for TcpListener {
     fn socket_name(&mut self) -> Result<SocketAddr, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         socket_name(Tcp, self.handle)
     }
 }
@@ -370,7 +370,7 @@ impl rtio::RtioTcpListener for TcpListener {
             incoming: incoming,
         };
 
-        let _m = acceptor.fire_missiles();
+        let _m = acceptor.fire_homing_missile();
         // XXX: the 128 backlog should be configurable
         match unsafe { uvll::uv_listen(acceptor.listener.handle, 128, listen_cb) } {
             0 => Ok(acceptor as ~rtio::RtioTcpAcceptor),
@@ -399,7 +399,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: c_int) {
 
 impl Drop for TcpListener {
     fn drop(&mut self) {
-        let (_m, sched) = self.fire_missiles_sched();
+        let (_m, sched) = self.fire_homing_missile_sched();
 
         do sched.deschedule_running_task_and_then |_, task| {
             self.closing_task = Some(task);
@@ -424,26 +424,26 @@ impl HomingIO for TcpAcceptor {
 
 impl rtio::RtioSocket for TcpAcceptor {
     fn socket_name(&mut self) -> Result<SocketAddr, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         socket_name(Tcp, self.listener.handle)
     }
 }
 
 impl rtio::RtioTcpAcceptor for TcpAcceptor {
     fn accept(&mut self) -> Result<~rtio::RtioTcpStream, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.incoming.recv()
     }
 
     fn accept_simultaneously(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_tcp_simultaneous_accepts(self.listener.handle, 1)
         })
     }
 
     fn dont_accept_simultaneously(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_tcp_simultaneous_accepts(self.listener.handle, 0)
         })
@@ -489,7 +489,7 @@ impl HomingIO for UdpWatcher {
 
 impl rtio::RtioSocket for UdpWatcher {
     fn socket_name(&mut self) -> Result<SocketAddr, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         socket_name(Udp, self.handle)
     }
 }
@@ -503,7 +503,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
             buf: Option<Buf>,
             result: Option<(ssize_t, SocketAddr)>,
         }
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
 
         return match unsafe {
             uvll::uv_udp_recv_start(self.handle, alloc_cb, recv_cb)
@@ -564,7 +564,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
     fn sendto(&mut self, buf: &[u8], dst: SocketAddr) -> Result<(), IoError> {
         struct Ctx { task: Option<BlockedTask>, result: c_int }
 
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
 
         let req = Request::new(uvll::UV_UDP_SEND);
         let buf = slice_to_uv_buf(buf);
@@ -607,7 +607,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
     }
 
     fn join_multicast(&mut self, multi: IpAddr) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             do multi.to_str().with_c_str |m_addr| {
                 uvll::uv_udp_set_membership(self.handle,
@@ -618,7 +618,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
     }
 
     fn leave_multicast(&mut self, multi: IpAddr) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             do multi.to_str().with_c_str |m_addr| {
                 uvll::uv_udp_set_membership(self.handle,
@@ -629,7 +629,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
     }
 
     fn loop_multicast_locally(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_udp_set_multicast_loop(self.handle,
                                             1 as c_int)
@@ -637,7 +637,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
     }
 
     fn dont_loop_multicast_locally(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_udp_set_multicast_loop(self.handle,
                                             0 as c_int)
@@ -645,7 +645,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
     }
 
     fn multicast_time_to_live(&mut self, ttl: int) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_udp_set_multicast_ttl(self.handle,
                                            ttl as c_int)
@@ -653,14 +653,14 @@ impl rtio::RtioUdpSocket for UdpWatcher {
     }
 
     fn time_to_live(&mut self, ttl: int) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_udp_set_ttl(self.handle, ttl as c_int)
         })
     }
 
     fn hear_broadcasts(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_udp_set_broadcast(self.handle,
                                        1 as c_int)
@@ -668,7 +668,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
     }
 
     fn ignore_broadcasts(&mut self) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         status_to_io_result(unsafe {
             uvll::uv_udp_set_broadcast(self.handle,
                                        0 as c_int)
@@ -679,7 +679,7 @@ impl rtio::RtioUdpSocket for UdpWatcher {
 impl Drop for UdpWatcher {
     fn drop(&mut self) {
         // Send ourselves home to close this handle (blocking while doing so).
-        let (_m, sched) = self.fire_missiles_sched();
+        let (_m, sched) = self.fire_homing_missile_sched();
         let mut slot = None;
         unsafe {
             uvll::set_data_for_uv_handle(self.handle, &slot);
@@ -693,6 +693,7 @@ impl Drop for UdpWatcher {
             let slot: &mut Option<BlockedTask> = unsafe {
                 cast::transmute(uvll::get_data_for_uv_handle(handle))
             };
+            unsafe { uvll::free_handle(handle) }
             let sched: ~Scheduler = Local::take();
             sched.resume_blocked_task_immediately(slot.take_unwrap());
         }
diff --git a/src/librustuv/pipe.rs b/src/librustuv/pipe.rs
index f79043797ae..1f28e043dfb 100644
--- a/src/librustuv/pipe.rs
+++ b/src/librustuv/pipe.rs
@@ -26,6 +26,7 @@ use uvll;
 pub struct PipeWatcher {
     stream: StreamWatcher,
     home: SchedHandle,
+    priv defused: bool,
 }
 
 pub struct PipeListener {
@@ -43,47 +44,43 @@ pub struct PipeAcceptor {
 // PipeWatcher implementation and traits
 
 impl PipeWatcher {
-    pub fn new(pipe: *uvll::uv_pipe_t) -> PipeWatcher {
-        PipeWatcher {
-            stream: StreamWatcher::new(pipe),
-            home: get_handle_to_current_scheduler!(),
-        }
-    }
-
-    pub fn alloc(loop_: &Loop, ipc: bool) -> *uvll::uv_pipe_t {
-        unsafe {
+    // Creates an uninitialized pipe watcher. The underlying uv pipe is ready to
+    // get bound to some other source (this is normally a helper method paired
+    // with another call).
+    pub fn new(loop_: &Loop, ipc: bool) -> PipeWatcher {
+        let handle = unsafe {
             let handle = uvll::malloc_handle(uvll::UV_NAMED_PIPE);
             assert!(!handle.is_null());
             let ipc = ipc as libc::c_int;
             assert_eq!(uvll::uv_pipe_init(loop_.handle, handle, ipc), 0);
             handle
+        };
+        PipeWatcher {
+            stream: StreamWatcher::new(handle),
+            home: get_handle_to_current_scheduler!(),
+            defused: false,
         }
     }
 
     pub fn open(loop_: &Loop, file: libc::c_int) -> Result<PipeWatcher, UvError>
     {
-        let handle = PipeWatcher::alloc(loop_, false);
-        match unsafe { uvll::uv_pipe_open(handle, file) } {
-            0 => Ok(PipeWatcher::new(handle)),
-            n => {
-                unsafe { uvll::uv_close(handle, pipe_close_cb) }
-                Err(UvError(n))
-            }
+        let pipe = PipeWatcher::new(loop_, false);
+        match unsafe { uvll::uv_pipe_open(pipe.handle(), file) } {
+            0 => Ok(pipe),
+            n => Err(UvError(n))
         }
     }
 
     pub fn connect(loop_: &Loop, name: &CString) -> Result<PipeWatcher, UvError>
     {
-        struct Ctx {
-            task: Option<BlockedTask>,
-            result: Option<Result<PipeWatcher, UvError>>,
-        }
-        let mut cx = Ctx { task: None, result: None };
+        struct Ctx { task: Option<BlockedTask>, result: libc::c_int, }
+        let mut cx = Ctx { task: None, result: 0 };
         let req = Request::new(uvll::UV_CONNECT);
+        let pipe = PipeWatcher::new(loop_, false);
         unsafe {
             uvll::set_data_for_req(req.handle, &cx as *Ctx);
             uvll::uv_pipe_connect(req.handle,
-                                  PipeWatcher::alloc(loop_, false),
+                                  pipe.handle(),
                                   name.with_ref(|p| p),
                                   connect_cb)
         }
@@ -93,38 +90,41 @@ impl PipeWatcher {
         do sched.deschedule_running_task_and_then |_, task| {
             cx.task = Some(task);
         }
-        assert!(cx.task.is_none());
-        return cx.result.take().expect("pipe connect needs a result");
+        return match cx.result {
+            0 => Ok(pipe),
+            n => Err(UvError(n))
+        };
 
         extern fn connect_cb(req: *uvll::uv_connect_t, status: libc::c_int) {
             let _req = Request::wrap(req);
             if status == uvll::ECANCELED { return }
             unsafe {
                 let cx: &mut Ctx = cast::transmute(uvll::get_data_for_req(req));
-                let stream = uvll::get_stream_handle_from_connect_req(req);
-                cx.result = Some(match status {
-                    0 => Ok(PipeWatcher::new(stream)),
-                    n => {
-                        uvll::free_handle(stream);
-                        Err(UvError(n))
-                    }
-                });
-
+                cx.result = status;
                 let sched: ~Scheduler = Local::take();
                 sched.resume_blocked_task_immediately(cx.task.take_unwrap());
             }
         }
     }
+
+    pub fn handle(&self) -> *uvll::uv_pipe_t { self.stream.handle }
+
+    // Unwraps the underlying uv pipe. This cancels destruction of the pipe and
+    // allows the pipe to get moved elsewhere
+    fn unwrap(mut self) -> *uvll::uv_pipe_t {
+        self.defused = true;
+        return self.stream.handle;
+    }
 }
 
 impl RtioPipe for PipeWatcher {
     fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.stream.read(buf).map_err(uv_error_to_io_error)
     }
 
     fn write(&mut self, buf: &[u8]) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.stream.write(buf).map_err(uv_error_to_io_error)
     }
 }
@@ -135,8 +135,10 @@ impl HomingIO for PipeWatcher {
 
 impl Drop for PipeWatcher {
     fn drop(&mut self) {
-        let _m = self.fire_missiles();
-        self.stream.close();
+        if !self.defused {
+            let _m = self.fire_homing_missile();
+            self.stream.close();
+        }
     }
 }
 
@@ -148,21 +150,21 @@ extern fn pipe_close_cb(handle: *uvll::uv_handle_t) {
 
 impl PipeListener {
     pub fn bind(loop_: &Loop, name: &CString) -> Result<~PipeListener, UvError> {
-        let pipe = PipeWatcher::alloc(loop_, false);
-        match unsafe { uvll::uv_pipe_bind(pipe, name.with_ref(|p| p)) } {
+        let pipe = PipeWatcher::new(loop_, false);
+        match unsafe { uvll::uv_pipe_bind(pipe.handle(), name.with_ref(|p| p)) } {
             0 => {
+                // If successful, unwrap the PipeWatcher because we control how
+                // we close the pipe differently. We can't rely on
+                // StreamWatcher's default close method.
                 let p = ~PipeListener {
                     home: get_handle_to_current_scheduler!(),
-                    pipe: pipe,
+                    pipe: pipe.unwrap(),
                     closing_task: None,
                     outgoing: Tube::new(),
                 };
                 Ok(p.install())
             }
-            n => {
-                unsafe { uvll::uv_close(pipe, pipe_close_cb) }
-                Err(UvError(n))
-            }
+            n => Err(UvError(n))
         }
     }
 }
@@ -176,7 +178,7 @@ impl RtioUnixListener for PipeListener {
             incoming: incoming,
         };
 
-        let _m = acceptor.fire_missiles();
+        let _m = acceptor.fire_homing_missile();
         // XXX: the 128 backlog should be configurable
         match unsafe { uvll::uv_listen(acceptor.listener.pipe, 128, listen_cb) } {
             0 => Ok(acceptor as ~RtioUnixAcceptor),
@@ -199,9 +201,9 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: libc::c_int) {
             let loop_ = Loop::wrap(unsafe {
                 uvll::get_loop_for_uv_handle(server)
             });
-            let client = PipeWatcher::alloc(&loop_, false);
-            assert_eq!(unsafe { uvll::uv_accept(server, client) }, 0);
-            Ok(~PipeWatcher::new(client) as ~RtioPipe)
+            let client = PipeWatcher::new(&loop_, false);
+            assert_eq!(unsafe { uvll::uv_accept(server, client.handle()) }, 0);
+            Ok(~client as ~RtioPipe)
         }
         uvll::ECANCELED => return,
         n => Err(uv_error_to_io_error(UvError(n)))
@@ -213,7 +215,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: libc::c_int) {
 
 impl Drop for PipeListener {
     fn drop(&mut self) {
-        let (_m, sched) = self.fire_missiles_sched();
+        let (_m, sched) = self.fire_homing_missile_sched();
 
         do sched.deschedule_running_task_and_then |_, task| {
             self.closing_task = Some(task);
@@ -234,7 +236,7 @@ extern fn listener_close_cb(handle: *uvll::uv_handle_t) {
 
 impl RtioUnixAcceptor for PipeAcceptor {
     fn accept(&mut self) -> Result<~RtioPipe, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.incoming.recv()
     }
 }
diff --git a/src/librustuv/process.rs b/src/librustuv/process.rs
index 20af8e21221..15d5ae1c33c 100644
--- a/src/librustuv/process.rs
+++ b/src/librustuv/process.rs
@@ -144,10 +144,10 @@ unsafe fn set_stdio(dst: *uvll::uv_stdio_container_t,
             if writable {
                 flags |= uvll::STDIO_WRITABLE_PIPE as libc::c_int;
             }
-            let pipe_handle = PipeWatcher::alloc(loop_, false);
+            let pipe = PipeWatcher::new(loop_, false);
             uvll::set_stdio_container_flags(dst, flags);
-            uvll::set_stdio_container_stream(dst, pipe_handle);
-            Some(PipeWatcher::new(pipe_handle))
+            uvll::set_stdio_container_stream(dst, pipe.handle());
+            Some(pipe)
         }
     }
 }
@@ -204,7 +204,7 @@ impl RtioProcess for Process {
     }
 
     fn kill(&mut self, signal: int) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         match unsafe {
             uvll::uv_process_kill(self.handle, signal as libc::c_int)
         } {
@@ -215,7 +215,7 @@ impl RtioProcess for Process {
 
     fn wait(&mut self) -> int {
         // Make sure (on the home scheduler) that we have an exit status listed
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         match self.exit_status {
             Some(*) => {}
             None => {
@@ -238,7 +238,7 @@ impl RtioProcess for Process {
 
 impl Drop for Process {
     fn drop(&mut self) {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         assert!(self.to_wake.is_none());
         self.close_async_();
     }
diff --git a/src/librustuv/signal.rs b/src/librustuv/signal.rs
index 3c5efe63f96..b7a37473fb9 100644
--- a/src/librustuv/signal.rs
+++ b/src/librustuv/signal.rs
@@ -73,7 +73,7 @@ impl RtioSignal for SignalWatcher {}
 
 impl Drop for SignalWatcher {
     fn drop(&mut self) {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.close_async_();
     }
 }
diff --git a/src/librustuv/timer.rs b/src/librustuv/timer.rs
index bf24ec405c2..df35a4892e9 100644
--- a/src/librustuv/timer.rs
+++ b/src/librustuv/timer.rs
@@ -66,7 +66,7 @@ impl UvHandle<uvll::uv_timer_t> for TimerWatcher {
 
 impl RtioTimer for TimerWatcher {
     fn sleep(&mut self, msecs: u64) {
-        let (_m, sched) = self.fire_missiles_sched();
+        let (_m, sched) = self.fire_homing_missile_sched();
         do sched.deschedule_running_task_and_then |_sched, task| {
             self.action = Some(WakeTask(task));
             self.start(msecs, 0);
@@ -77,7 +77,7 @@ impl RtioTimer for TimerWatcher {
     fn oneshot(&mut self, msecs: u64) -> PortOne<()> {
         let (port, chan) = oneshot();
 
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.action = Some(SendOnce(chan));
         self.start(msecs, 0);
 
@@ -87,7 +87,7 @@ impl RtioTimer for TimerWatcher {
     fn period(&mut self, msecs: u64) -> Port<()> {
         let (port, chan) = stream();
 
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.action = Some(SendMany(chan));
         self.start(msecs, msecs);
 
@@ -113,7 +113,7 @@ extern fn timer_cb(handle: *uvll::uv_timer_t, _status: c_int) {
 
 impl Drop for TimerWatcher {
     fn drop(&mut self) {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.action = None;
         self.stop();
         self.close_async_();
diff --git a/src/librustuv/tty.rs b/src/librustuv/tty.rs
index e224806cec1..c072ab51561 100644
--- a/src/librustuv/tty.rs
+++ b/src/librustuv/tty.rs
@@ -54,18 +54,18 @@ impl TtyWatcher {
 
 impl RtioTTY for TtyWatcher {
     fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.stream.read(buf).map_err(uv_error_to_io_error)
     }
 
     fn write(&mut self, buf: &[u8]) -> Result<(), IoError> {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.stream.write(buf).map_err(uv_error_to_io_error)
     }
 
     fn set_raw(&mut self, raw: bool) -> Result<(), IoError> {
         let raw = raw as libc::c_int;
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         match unsafe { uvll::uv_tty_set_mode(self.tty, raw) } {
             0 => Ok(()),
             n => Err(uv_error_to_io_error(UvError(n)))
@@ -79,7 +79,7 @@ impl RtioTTY for TtyWatcher {
         let widthptr: *libc::c_int = &width;
         let heightptr: *libc::c_int = &width;
 
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         match unsafe { uvll::uv_tty_get_winsize(self.tty,
                                                 widthptr, heightptr) } {
             0 => Ok((width as int, height as int)),
@@ -102,7 +102,7 @@ impl HomingIO for TtyWatcher {
 
 impl Drop for TtyWatcher {
     fn drop(&mut self) {
-        let _m = self.fire_missiles();
+        let _m = self.fire_homing_missile();
         self.stream.close();
     }
 }
diff --git a/src/libstd/rt/io/fs.rs b/src/libstd/rt/io/fs.rs
index f9e622b1f1e..06c07308cf6 100644
--- a/src/libstd/rt/io/fs.rs
+++ b/src/libstd/rt/io/fs.rs
@@ -589,7 +589,8 @@ pub fn rmdir_recursive(path: &Path) {
 
 /// Changes the timestamps for a file's last modification and access time.
 /// The file at the path specified will have its last access time set to
-/// `atime` and its modification time set to `mtime`.
+/// `atime` and its modification time set to `mtime`. The times specified should
+/// be in milliseconds.
 ///
 /// # Errors
 ///
@@ -1266,9 +1267,9 @@ mod test {
         let path = tmpdir.join("a");
         File::create(&path);
 
-        change_file_times(&path, 100, 200);
-        assert_eq!(path.stat().accessed, 100);
-        assert_eq!(path.stat().modified, 200);
+        change_file_times(&path, 1000, 2000);
+        assert_eq!(path.stat().accessed, 1000);
+        assert_eq!(path.stat().modified, 2000);
 
         rmdir_recursive(&tmpdir);
     }