Skip to content

Commit 59d45b8

Browse files
committed
Don't attempt to export uv functions directly
1 parent b46f60a commit 59d45b8

File tree

8 files changed

+84
-52
lines changed

8 files changed

+84
-52
lines changed

src/libstd/rt/io/stdio.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,6 @@ impl StdReader {
115115
Err(e) => io_error::cond.raise(e),
116116
}
117117
}
118-
119-
/// Resets the mode of this stream back to its original state.
120-
///
121-
/// # Failure
122-
///
123-
/// This function cannot fail.
124-
pub fn reset_mode(&mut self) { self.inner.reset_mode(); }
125118
}
126119

127120
impl Reader for StdReader {
@@ -177,13 +170,6 @@ impl StdWriter {
177170
Err(e) => io_error::cond.raise(e),
178171
}
179172
}
180-
181-
/// Resets the mode of this stream back to its original state.
182-
///
183-
/// # Failure
184-
///
185-
/// This function cannot fail.
186-
pub fn reset_mode(&mut self) { self.inner.reset_mode(); }
187173
}
188174

189175
impl Writer for StdWriter {

src/libstd/rt/rtio.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ pub trait RtioTTY {
186186
fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
187187
fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
188188
fn set_raw(&mut self, raw: bool) -> Result<(), IoError>;
189-
fn reset_mode(&mut self);
190189
fn get_winsize(&mut self) -> Result<(int, int), IoError>;
191190
}
192191

src/libstd/rt/uv/pipe.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl Pipe {
4040

4141
#[fixed_stack_segment] #[inline(never)]
4242
pub fn open(&mut self, file: libc::c_int) -> Result<(), uv::UvError> {
43-
match unsafe { uvll::uv_pipe_open(self.native_handle(), file) } {
43+
match unsafe { uvll::pipe_open(self.native_handle(), file) } {
4444
0 => Ok(()),
4545
n => Err(uv::UvError(n))
4646
}
@@ -49,7 +49,7 @@ impl Pipe {
4949
#[fixed_stack_segment] #[inline(never)]
5050
pub fn bind(&mut self, name: &CString) -> Result<(), uv::UvError> {
5151
do name.with_ref |name| {
52-
match unsafe { uvll::uv_pipe_bind(self.native_handle(), name) } {
52+
match unsafe { uvll::pipe_bind(self.native_handle(), name) } {
5353
0 => Ok(()),
5454
n => Err(uv::UvError(n))
5555
}
@@ -68,10 +68,10 @@ impl Pipe {
6868
let name = do name.with_ref |p| { p };
6969

7070
unsafe {
71-
uvll::uv_pipe_connect(connect.native_handle(),
72-
self.native_handle(),
73-
name,
74-
connect_cb)
71+
uvll::pipe_connect(connect.native_handle(),
72+
self.native_handle(),
73+
name,
74+
connect_cb)
7575
}
7676

7777
extern "C" fn connect_cb(req: *uvll::uv_connect_t, status: libc::c_int) {

src/libstd/rt/uv/tty.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ impl TTY {
2929
assert!(handle.is_not_null());
3030

3131
let ret = unsafe {
32-
uvll::uv_tty_init(loop_.native_handle(), handle, fd as libc::c_int,
33-
readable as libc::c_int)
32+
uvll::tty_init(loop_.native_handle(), handle, fd as libc::c_int,
33+
readable as libc::c_int)
3434
};
3535
match ret {
3636
0 => {
@@ -52,26 +52,21 @@ impl TTY {
5252
#[fixed_stack_segment] #[inline(never)]
5353
pub fn set_mode(&self, raw: bool) -> Result<(), uv::UvError> {
5454
let raw = raw as libc::c_int;
55-
match unsafe { uvll::uv_tty_set_mode(self.native_handle(), raw) } {
55+
match unsafe { uvll::tty_set_mode(self.native_handle(), raw) } {
5656
0 => Ok(()),
5757
n => Err(uv::UvError(n))
5858
}
5959
}
6060

61-
#[fixed_stack_segment] #[inline(never)]
62-
pub fn reset_mode(&self) {
63-
unsafe { uvll::uv_tty_reset_mode(self.native_handle()) }
64-
}
65-
6661
#[fixed_stack_segment] #[inline(never)] #[allow(unused_mut)]
6762
pub fn get_winsize(&self) -> Result<(int, int), uv::UvError> {
6863
let mut width: libc::c_int = 0;
6964
let mut height: libc::c_int = 0;
7065
let widthptr: *libc::c_int = &width;
7166
let heightptr: *libc::c_int = &width;
7267

73-
match unsafe { uvll::uv_tty_get_winsize(self.native_handle(),
74-
widthptr, heightptr) } {
68+
match unsafe { uvll::tty_get_winsize(self.native_handle(),
69+
widthptr, heightptr) } {
7570
0 => Ok((width as int, height as int)),
7671
n => Err(uv::UvError(n))
7772
}

src/libstd/rt/uv/uvio.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,10 +1829,6 @@ impl RtioTTY for UvTTY {
18291829
}
18301830
}
18311831

1832-
fn reset_mode(&mut self) {
1833-
do self.home_for_io |self_| { self_.tty.reset_mode() }
1834-
}
1835-
18361832
fn get_winsize(&mut self) -> Result<(int, int), IoError> {
18371833
do self.home_for_io |self_| {
18381834
match self_.tty.get_winsize() {

src/libstd/rt/uv/uvll.rs

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,33 @@ pub unsafe fn freeaddrinfo(ai: *addrinfo) {
959959
#[fixed_stack_segment]; #[inline(never)];
960960
rust_uv_freeaddrinfo(ai);
961961
}
962+
pub unsafe fn pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int {
963+
#[fixed_stack_segment]; #[inline(never)];
964+
rust_uv_pipe_open(pipe, file)
965+
}
966+
pub unsafe fn pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int {
967+
#[fixed_stack_segment]; #[inline(never)];
968+
rust_uv_pipe_bind(pipe, name)
969+
}
970+
pub unsafe fn pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
971+
name: *c_char, cb: uv_connect_cb) {
972+
#[fixed_stack_segment]; #[inline(never)];
973+
rust_uv_pipe_connect(req, handle, name, cb)
974+
}
975+
pub unsafe fn tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
976+
readable: c_int) -> c_int {
977+
#[fixed_stack_segment]; #[inline(never)];
978+
rust_uv_tty_init(loop_ptr, tty, fd, readable)
979+
}
980+
pub unsafe fn tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int {
981+
#[fixed_stack_segment]; #[inline(never)];
982+
rust_uv_tty_set_mode(tty, mode)
983+
}
984+
pub unsafe fn tty_get_winsize(tty: *uv_tty_t, width: *c_int,
985+
height: *c_int) -> c_int {
986+
#[fixed_stack_segment]; #[inline(never)];
987+
rust_uv_tty_get_winsize(tty, width, height)
988+
}
962989

963990
pub struct uv_err_data {
964991
priv err_name: ~str,
@@ -1104,16 +1131,15 @@ extern {
11041131
stream: *uv_stream_t);
11051132
fn rust_uv_pipe_init(loop_ptr: *c_void, p: *uv_pipe_t, ipc: c_int) -> c_int;
11061133

1107-
pub fn uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
1108-
pub fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
1109-
pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
1110-
name: *c_char, cb: uv_connect_cb);
1111-
pub fn uv_tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
1112-
readable: c_int) -> c_int;
1113-
pub fn uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
1114-
pub fn uv_tty_reset_mode(tty: *uv_tty_t);
1115-
pub fn uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
1116-
height: *c_int) -> c_int;
1134+
fn rust_uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
1135+
fn rust_uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
1136+
fn rust_uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
1137+
name: *c_char, cb: uv_connect_cb);
1138+
fn rust_uv_tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
1139+
readable: c_int) -> c_int;
1140+
fn rust_uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
1141+
fn rust_uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
1142+
height: *c_int) -> c_int;
11171143

11181144
// These should all really be constants...
11191145
#[rust_stack] pub fn rust_SOCK_STREAM() -> c_int;

src/rt/rust_uv.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,3 +650,34 @@ extern "C" int rust_AI_NUMERICHOST() { return AI_NUMERICHOST; }
650650
extern "C" int rust_AI_NUMERICSERV() { return AI_NUMERICSERV; }
651651
extern "C" int rust_AI_PASSIVE() { return AI_PASSIVE; }
652652
extern "C" int rust_AI_V4MAPPED() { return AI_V4MAPPED; }
653+
654+
extern "C" int
655+
rust_uv_pipe_open(uv_pipe_t *pipe, int file) {
656+
return uv_pipe_open(pipe, file);
657+
}
658+
659+
extern "C" int
660+
rust_uv_pipe_bind(uv_pipe_t *pipe, char *name) {
661+
return uv_pipe_bind(pipe, name);
662+
}
663+
664+
extern "C" void
665+
rust_uv_pipe_connect(uv_connect_t *req, uv_pipe_t *handle,
666+
char *name, uv_connect_cb cb) {
667+
uv_pipe_connect(req, handle, name, cb);
668+
}
669+
670+
extern "C" int
671+
rust_uv_tty_init(uv_loop_t *loop, uv_tty_t *tty, int fd, int readable) {
672+
return uv_tty_init(loop, tty, fd, readable);
673+
}
674+
675+
extern "C" int
676+
rust_uv_tty_set_mode(uv_tty_t *tty, int mode) {
677+
return uv_tty_set_mode(tty, mode);
678+
}
679+
680+
extern "C" int
681+
rust_uv_tty_get_winsize(uv_tty_t *tty, int *width, int *height) {
682+
return uv_tty_get_winsize(tty, width, height);
683+
}

src/rt/rustrt.def.in

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,9 @@ rust_AI_NUMERICHOST
211211
rust_AI_NUMERICSERV
212212
rust_AI_PASSIVE
213213
rust_AI_V4MAPPED
214-
uv_pipe_open
215-
uv_pipe_bind
216-
uv_pipe_connect
217-
uv_tty_init
218-
uv_tty_set_mode
219-
uv_tty_reset_mode
220-
uv_tty_get_winsize
214+
rust_uv_pipe_open
215+
rust_uv_pipe_bind
216+
rust_uv_pipe_connect
217+
rust_uv_tty_init
218+
rust_uv_tty_set_mode
219+
rust_uv_tty_get_winsize

0 commit comments

Comments
 (0)