@@ -109,20 +109,32 @@ pub struct uv_buf_t {
109
109
pub len : uv_buf_len_t ,
110
110
}
111
111
112
+ #[ cfg( unix) ]
113
+ pub type uv_os_socket_t = c_int ;
114
+
112
115
// see libuv/include/uv-win.h
113
116
#[ cfg( windows) ]
114
117
pub struct uv_buf_t {
115
118
pub len : uv_buf_len_t ,
116
119
pub base : * mut u8 ,
117
120
}
118
121
122
+ #[ cfg( windows) ]
123
+ pub type uv_os_socket_t = libc:: SOCKET ;
124
+
119
125
#[ repr( C ) ]
120
126
pub enum uv_run_mode {
121
127
RUN_DEFAULT = 0 ,
122
128
RUN_ONCE ,
123
129
RUN_NOWAIT ,
124
130
}
125
131
132
+ #[ repr( C ) ]
133
+ pub enum uv_poll_event {
134
+ UV_READABLE = 1 ,
135
+ UV_WRITABLE = 2 ,
136
+ }
137
+
126
138
pub struct uv_process_options_t {
127
139
pub exit_cb : uv_exit_cb ,
128
140
pub file : * const libc:: c_char ,
@@ -150,6 +162,7 @@ pub type uv_loop_t = c_void;
150
162
pub type uv_idle_t = c_void ;
151
163
pub type uv_tcp_t = c_void ;
152
164
pub type uv_udp_t = c_void ;
165
+ pub type uv_poll_t = c_void ;
153
166
pub type uv_connect_t = c_void ;
154
167
pub type uv_connection_t = c_void ;
155
168
pub type uv_write_t = c_void ;
@@ -233,6 +246,9 @@ pub type uv_udp_recv_cb = extern "C" fn(handle: *mut uv_udp_t,
233
246
addr : * const sockaddr ,
234
247
flags : c_uint ) ;
235
248
pub 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 ) ;
236
252
pub type uv_walk_cb = extern "C" fn ( handle : * mut uv_handle_t ,
237
253
arg : * mut c_void ) ;
238
254
pub type uv_async_cb = extern "C" fn ( handle : * mut uv_async_t ) ;
@@ -651,6 +667,11 @@ extern {
651
667
pub fn uv_fs_lstat ( handle : * mut uv_loop_t , req : * mut uv_fs_t ,
652
668
file : * const c_char , cb : uv_fs_cb ) -> c_int ;
653
669
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
+
654
675
// getaddrinfo
655
676
pub fn uv_getaddrinfo ( loop_ : * mut uv_loop_t , req : * mut uv_getaddrinfo_t ,
656
677
getaddrinfo_cb : uv_getaddrinfo_cb ,
0 commit comments