diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-10-17 11:28:05 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-10-24 14:21:57 -0700 |
| commit | 59d45b8fe793d369ddf600cce0f212f9b6165a30 (patch) | |
| tree | 8a122f5327091943ac63d898291249dc1aa45498 /src/libstd | |
| parent | b46f60a72968bd62560c0230b2e5dc63f107f468 (diff) | |
| download | rust-59d45b8fe793d369ddf600cce0f212f9b6165a30.tar.gz rust-59d45b8fe793d369ddf600cce0f212f9b6165a30.zip | |
Don't attempt to export uv functions directly
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/rt/io/stdio.rs | 14 | ||||
| -rw-r--r-- | src/libstd/rt/rtio.rs | 1 | ||||
| -rw-r--r-- | src/libstd/rt/uv/pipe.rs | 12 | ||||
| -rw-r--r-- | src/libstd/rt/uv/tty.rs | 15 | ||||
| -rw-r--r-- | src/libstd/rt/uv/uvio.rs | 4 | ||||
| -rw-r--r-- | src/libstd/rt/uv/uvll.rs | 46 |
6 files changed, 47 insertions, 45 deletions
diff --git a/src/libstd/rt/io/stdio.rs b/src/libstd/rt/io/stdio.rs index a3cbe87431d..52838425422 100644 --- a/src/libstd/rt/io/stdio.rs +++ b/src/libstd/rt/io/stdio.rs @@ -115,13 +115,6 @@ impl StdReader { Err(e) => io_error::cond.raise(e), } } - - /// Resets the mode of this stream back to its original state. - /// - /// # Failure - /// - /// This function cannot fail. - pub fn reset_mode(&mut self) { self.inner.reset_mode(); } } impl Reader for StdReader { @@ -177,13 +170,6 @@ impl StdWriter { Err(e) => io_error::cond.raise(e), } } - - /// Resets the mode of this stream back to its original state. - /// - /// # Failure - /// - /// This function cannot fail. - pub fn reset_mode(&mut self) { self.inner.reset_mode(); } } impl Writer for StdWriter { diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index 897bf328f23..924d9c4bff1 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -186,7 +186,6 @@ pub trait RtioTTY { fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>; fn write(&mut self, buf: &[u8]) -> Result<(), IoError>; fn set_raw(&mut self, raw: bool) -> Result<(), IoError>; - fn reset_mode(&mut self); fn get_winsize(&mut self) -> Result<(int, int), IoError>; } diff --git a/src/libstd/rt/uv/pipe.rs b/src/libstd/rt/uv/pipe.rs index 2ad5079e5d5..74b9312954c 100644 --- a/src/libstd/rt/uv/pipe.rs +++ b/src/libstd/rt/uv/pipe.rs @@ -40,7 +40,7 @@ impl Pipe { #[fixed_stack_segment] #[inline(never)] pub fn open(&mut self, file: libc::c_int) -> Result<(), uv::UvError> { - match unsafe { uvll::uv_pipe_open(self.native_handle(), file) } { + match unsafe { uvll::pipe_open(self.native_handle(), file) } { 0 => Ok(()), n => Err(uv::UvError(n)) } @@ -49,7 +49,7 @@ impl Pipe { #[fixed_stack_segment] #[inline(never)] pub fn bind(&mut self, name: &CString) -> Result<(), uv::UvError> { do name.with_ref |name| { - match unsafe { uvll::uv_pipe_bind(self.native_handle(), name) } { + match unsafe { uvll::pipe_bind(self.native_handle(), name) } { 0 => Ok(()), n => Err(uv::UvError(n)) } @@ -68,10 +68,10 @@ impl Pipe { let name = do name.with_ref |p| { p }; unsafe { - uvll::uv_pipe_connect(connect.native_handle(), - self.native_handle(), - name, - connect_cb) + uvll::pipe_connect(connect.native_handle(), + self.native_handle(), + name, + connect_cb) } extern "C" fn connect_cb(req: *uvll::uv_connect_t, status: libc::c_int) { diff --git a/src/libstd/rt/uv/tty.rs b/src/libstd/rt/uv/tty.rs index 4c9a08f95bf..f44c5ae8eff 100644 --- a/src/libstd/rt/uv/tty.rs +++ b/src/libstd/rt/uv/tty.rs @@ -29,8 +29,8 @@ impl TTY { assert!(handle.is_not_null()); let ret = unsafe { - uvll::uv_tty_init(loop_.native_handle(), handle, fd as libc::c_int, - readable as libc::c_int) + uvll::tty_init(loop_.native_handle(), handle, fd as libc::c_int, + readable as libc::c_int) }; match ret { 0 => { @@ -52,17 +52,12 @@ impl TTY { #[fixed_stack_segment] #[inline(never)] pub fn set_mode(&self, raw: bool) -> Result<(), uv::UvError> { let raw = raw as libc::c_int; - match unsafe { uvll::uv_tty_set_mode(self.native_handle(), raw) } { + match unsafe { uvll::tty_set_mode(self.native_handle(), raw) } { 0 => Ok(()), n => Err(uv::UvError(n)) } } - #[fixed_stack_segment] #[inline(never)] - pub fn reset_mode(&self) { - unsafe { uvll::uv_tty_reset_mode(self.native_handle()) } - } - #[fixed_stack_segment] #[inline(never)] #[allow(unused_mut)] pub fn get_winsize(&self) -> Result<(int, int), uv::UvError> { let mut width: libc::c_int = 0; @@ -70,8 +65,8 @@ impl TTY { let widthptr: *libc::c_int = &width; let heightptr: *libc::c_int = &width; - match unsafe { uvll::uv_tty_get_winsize(self.native_handle(), - widthptr, heightptr) } { + match unsafe { uvll::tty_get_winsize(self.native_handle(), + widthptr, heightptr) } { 0 => Ok((width as int, height as int)), n => Err(uv::UvError(n)) } diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs index 96719e98972..3858b64915a 100644 --- a/src/libstd/rt/uv/uvio.rs +++ b/src/libstd/rt/uv/uvio.rs @@ -1829,10 +1829,6 @@ impl RtioTTY for UvTTY { } } - fn reset_mode(&mut self) { - do self.home_for_io |self_| { self_.tty.reset_mode() } - } - fn get_winsize(&mut self) -> Result<(int, int), IoError> { do self.home_for_io |self_| { match self_.tty.get_winsize() { diff --git a/src/libstd/rt/uv/uvll.rs b/src/libstd/rt/uv/uvll.rs index 8ef1d1768b8..e78b2579779 100644 --- a/src/libstd/rt/uv/uvll.rs +++ b/src/libstd/rt/uv/uvll.rs @@ -959,6 +959,33 @@ pub unsafe fn freeaddrinfo(ai: *addrinfo) { #[fixed_stack_segment]; #[inline(never)]; rust_uv_freeaddrinfo(ai); } +pub unsafe fn pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int { + #[fixed_stack_segment]; #[inline(never)]; + rust_uv_pipe_open(pipe, file) +} +pub unsafe fn pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int { + #[fixed_stack_segment]; #[inline(never)]; + rust_uv_pipe_bind(pipe, name) +} +pub unsafe fn pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t, + name: *c_char, cb: uv_connect_cb) { + #[fixed_stack_segment]; #[inline(never)]; + rust_uv_pipe_connect(req, handle, name, cb) +} +pub unsafe fn tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int, + readable: c_int) -> c_int { + #[fixed_stack_segment]; #[inline(never)]; + rust_uv_tty_init(loop_ptr, tty, fd, readable) +} +pub unsafe fn tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int { + #[fixed_stack_segment]; #[inline(never)]; + rust_uv_tty_set_mode(tty, mode) +} +pub unsafe fn tty_get_winsize(tty: *uv_tty_t, width: *c_int, + height: *c_int) -> c_int { + #[fixed_stack_segment]; #[inline(never)]; + rust_uv_tty_get_winsize(tty, width, height) +} pub struct uv_err_data { priv err_name: ~str, @@ -1104,16 +1131,15 @@ extern { stream: *uv_stream_t); fn rust_uv_pipe_init(loop_ptr: *c_void, p: *uv_pipe_t, ipc: c_int) -> c_int; - pub fn uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int; - pub fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int; - pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t, - name: *c_char, cb: uv_connect_cb); - pub fn uv_tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int, - readable: c_int) -> c_int; - pub fn uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int; - pub fn uv_tty_reset_mode(tty: *uv_tty_t); - pub fn uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int, - height: *c_int) -> c_int; + fn rust_uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int; + fn rust_uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int; + fn rust_uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t, + name: *c_char, cb: uv_connect_cb); + fn rust_uv_tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int, + readable: c_int) -> c_int; + fn rust_uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int; + fn rust_uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int, + height: *c_int) -> c_int; // These should all really be constants... #[rust_stack] pub fn rust_SOCK_STREAM() -> c_int; |
