@@ -109,20 +109,32 @@ pub struct uv_buf_t {
109109 pub len : uv_buf_len_t ,
110110}
111111
112+ #[ cfg( unix) ]
113+ pub type uv_os_socket_t = c_int ;
114+
112115// see libuv/include/uv-win.h
113116#[ cfg( windows) ]
114117pub struct uv_buf_t {
115118 pub len : uv_buf_len_t ,
116119 pub base : * mut u8 ,
117120}
118121
122+ #[ cfg( windows) ]
123+ pub type uv_os_socket_t = libc:: SOCKET ;
124+
119125#[ repr( C ) ]
120126pub enum uv_run_mode {
121127 RUN_DEFAULT = 0 ,
122128 RUN_ONCE ,
123129 RUN_NOWAIT ,
124130}
125131
132+ #[ repr( C ) ]
133+ pub enum uv_poll_event {
134+ UV_READABLE = 1 ,
135+ UV_WRITABLE = 2 ,
136+ }
137+
126138pub struct uv_process_options_t {
127139 pub exit_cb : uv_exit_cb ,
128140 pub file : * const libc:: c_char ,
@@ -150,6 +162,7 @@ pub type uv_loop_t = c_void;
150162pub type uv_idle_t = c_void ;
151163pub type uv_tcp_t = c_void ;
152164pub type uv_udp_t = c_void ;
165+ pub type uv_poll_t = c_void ;
153166pub type uv_connect_t = c_void ;
154167pub type uv_connection_t = c_void ;
155168pub type uv_write_t = c_void ;
@@ -233,6 +246,9 @@ pub type uv_udp_recv_cb = extern "C" fn(handle: *mut uv_udp_t,
233246 addr : * const sockaddr ,
234247 flags : c_uint ) ;
235248pub type uv_close_cb = extern "C" fn ( handle : * mut uv_handle_t ) ;
249+ pub type uv_poll_cb = extern "C" fn ( handle : * mut uv_poll_t ,
250+ status : c_int ,
251+ events : c_int ) ;
236252pub type uv_walk_cb = extern "C" fn ( handle : * mut uv_handle_t ,
237253 arg : * mut c_void ) ;
238254pub type uv_async_cb = extern "C" fn ( handle : * mut uv_async_t ) ;
@@ -651,6 +667,11 @@ extern {
651667 pub fn uv_fs_lstat ( handle : * mut uv_loop_t , req : * mut uv_fs_t ,
652668 file : * const c_char , cb : uv_fs_cb ) -> c_int ;
653669
670+ // poll bindings
671+ pub fn uv_poll_init_socket ( l : * mut uv_loop_t , h : * mut uv_poll_t , s : uv_os_socket_t ) -> c_int ;
672+ pub fn uv_poll_start ( h : * mut uv_poll_t , events : c_int , cb : uv_poll_cb ) -> c_int ;
673+ pub fn uv_poll_stop ( h : * mut uv_poll_t ) -> c_int ;
674+
654675 // getaddrinfo
655676 pub fn uv_getaddrinfo ( loop_ : * mut uv_loop_t , req : * mut uv_getaddrinfo_t ,
656677 getaddrinfo_cb : uv_getaddrinfo_cb ,
0 commit comments