@@ -107,20 +107,32 @@ pub struct uv_buf_t {
107
107
pub len : uv_buf_len_t ,
108
108
}
109
109
110
+ #[ cfg( unix) ]
111
+ pub type uv_os_socket_t = c_int ;
112
+
110
113
// see libuv/include/uv-win.h
111
114
#[ cfg( windows) ]
112
115
pub struct uv_buf_t {
113
116
pub len : uv_buf_len_t ,
114
117
pub base : * mut u8 ,
115
118
}
116
119
120
+ #[ cfg( windows) ]
121
+ pub type uv_os_socket_t = libc:: SOCKET ;
122
+
117
123
#[ repr( C ) ]
118
124
pub enum uv_run_mode {
119
125
RUN_DEFAULT = 0 ,
120
126
RUN_ONCE ,
121
127
RUN_NOWAIT ,
122
128
}
123
129
130
+ #[ repr( C ) ]
131
+ pub enum uv_poll_event {
132
+ UV_READABLE = 1 ,
133
+ UV_WRITABLE = 2 ,
134
+ }
135
+
124
136
pub struct uv_process_options_t {
125
137
pub exit_cb : uv_exit_cb ,
126
138
pub file : * const libc:: c_char ,
@@ -148,6 +160,7 @@ pub type uv_loop_t = c_void;
148
160
pub type uv_idle_t = c_void ;
149
161
pub type uv_tcp_t = c_void ;
150
162
pub type uv_udp_t = c_void ;
163
+ pub type uv_poll_t = c_void ;
151
164
pub type uv_connect_t = c_void ;
152
165
pub type uv_connection_t = c_void ;
153
166
pub type uv_write_t = c_void ;
@@ -231,6 +244,9 @@ pub type uv_udp_recv_cb = extern "C" fn(handle: *mut uv_udp_t,
231
244
addr : * const sockaddr ,
232
245
flags : c_uint ) ;
233
246
pub type uv_close_cb = extern "C" fn ( handle : * mut uv_handle_t ) ;
247
+ pub type uv_poll_cb = extern "C" fn ( handle : * mut uv_poll_t ,
248
+ status : c_int ,
249
+ events : c_int ) ;
234
250
pub type uv_walk_cb = extern "C" fn ( handle : * mut uv_handle_t ,
235
251
arg : * mut c_void ) ;
236
252
pub type uv_async_cb = extern "C" fn ( handle : * mut uv_async_t ) ;
@@ -649,6 +665,11 @@ extern {
649
665
pub fn uv_fs_lstat ( handle : * mut uv_loop_t , req : * mut uv_fs_t ,
650
666
file : * const c_char , cb : uv_fs_cb ) -> c_int ;
651
667
668
+ // poll bindings
669
+ pub fn uv_poll_init_socket ( l : * mut uv_loop_t , h : * mut uv_poll_t , s : uv_os_socket_t ) -> c_int ;
670
+ pub fn uv_poll_start ( h : * mut uv_poll_t , events : c_int , cb : uv_poll_cb ) -> c_int ;
671
+ pub fn uv_poll_stop ( h : * mut uv_poll_t ) -> c_int ;
672
+
652
673
// getaddrinfo
653
674
pub fn uv_getaddrinfo ( loop_ : * mut uv_loop_t , req : * mut uv_getaddrinfo_t ,
654
675
getaddrinfo_cb : uv_getaddrinfo_cb ,
0 commit comments