(index<- ) ./librustuv/uvll.rs
git branch: * master 5200215 auto merge of #14035 : alexcrichton/rust/experimental, r=huonw
modified: Fri Apr 25 22:40:04 2014
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 /*!
12 * Low-level bindings to the libuv library.
13 *
14 * This module contains a set of direct, 'bare-metal' wrappers around
15 * the libuv C-API.
16 *
17 * We're not bothering yet to redefine uv's structs as Rust structs
18 * because they are quite large and change often between versions.
19 * The maintenance burden is just too high. Instead we use the uv's
20 * `uv_handle_size` and `uv_req_size` to find the correct size of the
21 * structs and allocate them on the heap. This can be revisited later.
22 *
23 * There are also a collection of helper functions to ease interacting
24 * with the low-level API.
25 *
26 * As new functionality, existent in uv.h, is added to the rust stdlib,
27 * the mappings should be added in this module.
28 */
29
30 #![allow(non_camel_case_types)] // C types
31
32 use libc::{size_t, c_int, c_uint, c_void, c_char, c_double};
33 use libc::{ssize_t, sockaddr, free, addrinfo};
34 use libc;
35 use std::rt::global_heap::malloc_raw;
36
37 #[cfg(test)]
38 use libc::uintptr_t;
39
40 pub use self::errors::{EACCES, ECONNREFUSED, ECONNRESET, EPIPE, ECONNABORTED,
41 ECANCELED, EBADF, ENOTCONN, ENOENT, EADDRNOTAVAIL};
42
43 pub static OK: c_int = 0;
44 pub static EOF: c_int = -4095;
45 pub static UNKNOWN: c_int = -4094;
46
47 // uv-errno.h redefines error codes for windows, but not for unix...
48 // https://github.com/joyent/libuv/blob/master/include/uv-errno.h
49
50 #[cfg(windows)]
51 pub mod errors {
52 use libc::c_int;
53
54 pub static EACCES: c_int = -4092;
55 pub static ECONNREFUSED: c_int = -4078;
56 pub static ECONNRESET: c_int = -4077;
57 pub static ENOENT: c_int = -4058;
58 pub static ENOTCONN: c_int = -4053;
59 pub static EPIPE: c_int = -4047;
60 pub static ECONNABORTED: c_int = -4079;
61 pub static ECANCELED: c_int = -4081;
62 pub static EBADF: c_int = -4083;
63 pub static EADDRNOTAVAIL: c_int = -4090;
64 }
65 #[cfg(not(windows))]
66 pub mod errors {
67 use libc;
68 use libc::c_int;
69
70 pub static EACCES: c_int = -libc::EACCES;
71 pub static ECONNREFUSED: c_int = -libc::ECONNREFUSED;
72 pub static ECONNRESET: c_int = -libc::ECONNRESET;
73 pub static ENOENT: c_int = -libc::ENOENT;
74 pub static ENOTCONN: c_int = -libc::ENOTCONN;
75 pub static EPIPE: c_int = -libc::EPIPE;
76 pub static ECONNABORTED: c_int = -libc::ECONNABORTED;
77 pub static ECANCELED : c_int = -libc::ECANCELED;
78 pub static EBADF : c_int = -libc::EBADF;
79 pub static EADDRNOTAVAIL : c_int = -libc::EADDRNOTAVAIL;
80 }
81
82 pub static PROCESS_SETUID: c_int = 1 << 0;
83 pub static PROCESS_SETGID: c_int = 1 << 1;
84 pub static PROCESS_WINDOWS_VERBATIM_ARGUMENTS: c_int = 1 << 2;
85 pub static PROCESS_DETACHED: c_int = 1 << 3;
86 pub static PROCESS_WINDOWS_HIDE: c_int = 1 << 4;
87
88 pub static STDIO_IGNORE: c_int = 0x00;
89 pub static STDIO_CREATE_PIPE: c_int = 0x01;
90 pub static STDIO_INHERIT_FD: c_int = 0x02;
91 pub static STDIO_INHERIT_STREAM: c_int = 0x04;
92 pub static STDIO_READABLE_PIPE: c_int = 0x10;
93 pub static STDIO_WRITABLE_PIPE: c_int = 0x20;
94
95 #[cfg(unix)]
96 pub type uv_buf_len_t = libc::size_t;
97 #[cfg(windows)]
98 pub type uv_buf_len_t = libc::c_ulong;
99
100 // see libuv/include/uv-unix.h
101 #[cfg(unix)]
102 pub struct uv_buf_t {
103 pub base: *u8,
104 pub len: uv_buf_len_t,
105 }
106
107 // see libuv/include/uv-win.h
108 #[cfg(windows)]
109 pub struct uv_buf_t {
110 pub len: uv_buf_len_t,
111 pub base: *u8,
112 }
113
114 #[repr(C)]
115 pub enum uv_run_mode {
116 RUN_DEFAULT = 0,
117 RUN_ONCE,
118 RUN_NOWAIT,
119 }
120
121 pub struct uv_process_options_t {
122 pub exit_cb: uv_exit_cb,
123 pub file: *libc::c_char,
124 pub args: **libc::c_char,
125 pub env: **libc::c_char,
126 pub cwd: *libc::c_char,
127 pub flags: libc::c_uint,
128 pub stdio_count: libc::c_int,
129 pub stdio: *uv_stdio_container_t,
130 pub uid: uv_uid_t,
131 pub gid: uv_gid_t,
132 }
133
134 // These fields are private because they must be interfaced with through the
135 // functions below.
136 pub struct uv_stdio_container_t {
137 flags: libc::c_int,
138 stream: *uv_stream_t,
139 }
140
141 pub type uv_handle_t = c_void;
142 pub type uv_req_t = c_void;
143 pub type uv_loop_t = c_void;
144 pub type uv_idle_t = c_void;
145 pub type uv_tcp_t = c_void;
146 pub type uv_udp_t = c_void;
147 pub type uv_connect_t = c_void;
148 pub type uv_connection_t = c_void;
149 pub type uv_write_t = c_void;
150 pub type uv_async_t = c_void;
151 pub type uv_timer_t = c_void;
152 pub type uv_stream_t = c_void;
153 pub type uv_fs_t = c_void;
154 pub type uv_udp_send_t = c_void;
155 pub type uv_getaddrinfo_t = c_void;
156 pub type uv_process_t = c_void;
157 pub type uv_pipe_t = c_void;
158 pub type uv_tty_t = c_void;
159 pub type uv_signal_t = c_void;
160 pub type uv_shutdown_t = c_void;
161
162 pub struct uv_timespec_t {
163 pub tv_sec: libc::c_long,
164 pub tv_nsec: libc::c_long
165 }
166
167 pub struct uv_stat_t {
168 pub st_dev: libc::uint64_t,
169 pub st_mode: libc::uint64_t,
170 pub st_nlink: libc::uint64_t,
171 pub st_uid: libc::uint64_t,
172 pub st_gid: libc::uint64_t,
173 pub st_rdev: libc::uint64_t,
174 pub st_ino: libc::uint64_t,
175 pub st_size: libc::uint64_t,
176 pub st_blksize: libc::uint64_t,
177 pub st_blocks: libc::uint64_t,
178 pub st_flags: libc::uint64_t,
179 pub st_gen: libc::uint64_t,
180 pub st_atim: uv_timespec_t,
181 pub st_mtim: uv_timespec_t,
182 pub st_ctim: uv_timespec_t,
183 pub st_birthtim: uv_timespec_t
184 }
185
186 impl uv_stat_t {
187 pub fn new() -> uv_stat_t {
188 uv_stat_t {
189 st_dev: 0,
190 st_mode: 0,
191 st_nlink: 0,
192 st_uid: 0,
193 st_gid: 0,
194 st_rdev: 0,
195 st_ino: 0,
196 st_size: 0,
197 st_blksize: 0,
198 st_blocks: 0,
199 st_flags: 0,
200 st_gen: 0,
201 st_atim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
202 st_mtim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
203 st_ctim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
204 st_birthtim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 }
205 }
206 }
207 pub fn is_file(&self) -> bool {
208 ((self.st_mode) & libc::S_IFMT as libc::uint64_t) == libc::S_IFREG as libc::uint64_t
209 }
210 pub fn is_dir(&self) -> bool {
211 ((self.st_mode) & libc::S_IFMT as libc::uint64_t) == libc::S_IFDIR as libc::uint64_t
212 }
213 }
214
215 pub type uv_idle_cb = extern "C" fn(handle: *uv_idle_t);
216 pub type uv_alloc_cb = extern "C" fn(stream: *uv_stream_t,
217 suggested_size: size_t,
218 buf: *mut uv_buf_t);
219 pub type uv_read_cb = extern "C" fn(stream: *uv_stream_t,
220 nread: ssize_t,
221 buf: *uv_buf_t);
222 pub type uv_udp_send_cb = extern "C" fn(req: *uv_udp_send_t,
223 status: c_int);
224 pub type uv_udp_recv_cb = extern "C" fn(handle: *uv_udp_t,
225 nread: ssize_t,
226 buf: *uv_buf_t,
227 addr: *sockaddr,
228 flags: c_uint);
229 pub type uv_close_cb = extern "C" fn(handle: *uv_handle_t);
230 pub type uv_walk_cb = extern "C" fn(handle: *uv_handle_t,
231 arg: *c_void);
232 pub type uv_async_cb = extern "C" fn(handle: *uv_async_t);
233 pub type uv_connect_cb = extern "C" fn(handle: *uv_connect_t,
234 status: c_int);
235 pub type uv_connection_cb = extern "C" fn(handle: *uv_connection_t,
236 status: c_int);
237 pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t);
238 pub type uv_write_cb = extern "C" fn(handle: *uv_write_t,
239 status: c_int);
240 pub type uv_getaddrinfo_cb = extern "C" fn(req: *uv_getaddrinfo_t,
241 status: c_int,
242 res: *addrinfo);
243 pub type uv_exit_cb = extern "C" fn(handle: *uv_process_t,
244 exit_status: i64,
245 term_signal: c_int);
246 pub type uv_signal_cb = extern "C" fn(handle: *uv_signal_t,
247 signum: c_int);
248 pub type uv_fs_cb = extern "C" fn(req: *uv_fs_t);
249 pub type uv_shutdown_cb = extern "C" fn(req: *uv_shutdown_t, status: c_int);
250
251 #[cfg(unix)] pub type uv_uid_t = libc::types::os::arch::posix88::uid_t;
252 #[cfg(unix)] pub type uv_gid_t = libc::types::os::arch::posix88::gid_t;
253 #[cfg(windows)] pub type uv_uid_t = libc::c_uchar;
254 #[cfg(windows)] pub type uv_gid_t = libc::c_uchar;
255
256 #[repr(C)]
257 #[deriving(Eq)]
258 pub enum uv_handle_type {
259 UV_UNKNOWN_HANDLE,
260 UV_ASYNC,
261 UV_CHECK,
262 UV_FS_EVENT,
263 UV_FS_POLL,
264 UV_HANDLE,
265 UV_IDLE,
266 UV_NAMED_PIPE,
267 UV_POLL,
268 UV_PREPARE,
269 UV_PROCESS,
270 UV_STREAM,
271 UV_TCP,
272 UV_TIMER,
273 UV_TTY,
274 UV_UDP,
275 UV_SIGNAL,
276 UV_FILE,
277 UV_HANDLE_TYPE_MAX
278 }
279
280 #[repr(C)]
281 #[cfg(unix)]
282 #[deriving(Eq)]
283 pub enum uv_req_type {
284 UV_UNKNOWN_REQ,
285 UV_REQ,
286 UV_CONNECT,
287 UV_WRITE,
288 UV_SHUTDOWN,
289 UV_UDP_SEND,
290 UV_FS,
291 UV_WORK,
292 UV_GETADDRINFO,
293 UV_REQ_TYPE_MAX
294 }
295
296 // uv_req_type may have additional fields defined by UV_REQ_TYPE_PRIVATE.
297 // See UV_REQ_TYPE_PRIVATE at libuv/include/uv-win.h
298 #[repr(C)]
299 #[cfg(windows)]
300 #[deriving(Eq)]
301 pub enum uv_req_type {
302 UV_UNKNOWN_REQ,
303 UV_REQ,
304 UV_CONNECT,
305 UV_WRITE,
306 UV_SHUTDOWN,
307 UV_UDP_SEND,
308 UV_FS,
309 UV_WORK,
310 UV_GETADDRINFO,
311 UV_ACCEPT,
312 UV_FS_EVENT_REQ,
313 UV_POLL_REQ,
314 UV_PROCESS_EXIT,
315 UV_READ,
316 UV_UDP_RECV,
317 UV_WAKEUP,
318 UV_SIGNAL_REQ,
319 UV_REQ_TYPE_MAX
320 }
321
322 #[repr(C)]
323 #[deriving(Eq)]
324 pub enum uv_membership {
325 UV_LEAVE_GROUP,
326 UV_JOIN_GROUP
327 }
328
329 pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
330 assert!(handle != UV_UNKNOWN_HANDLE && handle != UV_HANDLE_TYPE_MAX);
331 let size = uv_handle_size(handle);
332 malloc_raw(size as uint) as *c_void
333 }
334
335 pub unsafe fn free_handle(v: *c_void) {
336 free(v as *mut c_void)
337 }
338
339 pub unsafe fn malloc_req(req: uv_req_type) -> *c_void {
340 assert!(req != UV_UNKNOWN_REQ && req != UV_REQ_TYPE_MAX);
341 let size = uv_req_size(req);
342 malloc_raw(size as uint) as *c_void
343 }
344
345 pub unsafe fn free_req(v: *c_void) {
346 free(v as *mut c_void)
347 }
348
349 #[test]
350 fn handle_sanity_check() {
351 unsafe {
352 assert_eq!(UV_HANDLE_TYPE_MAX as uint, rust_uv_handle_type_max());
353 }
354 }
355
356 #[test]
357 fn request_sanity_check() {
358 unsafe {
359 assert_eq!(UV_REQ_TYPE_MAX as uint, rust_uv_req_type_max());
360 }
361 }
362
363 // FIXME Event loops ignore SIGPIPE by default.
364 pub unsafe fn loop_new() -> *c_void {
365 return rust_uv_loop_new();
366 }
367
368 pub unsafe fn uv_write(req: *uv_write_t,
369 stream: *uv_stream_t,
370 buf_in: &[uv_buf_t],
371 cb: uv_write_cb) -> c_int {
372 extern {
373 fn uv_write(req: *uv_write_t, stream: *uv_stream_t,
374 buf_in: *uv_buf_t, buf_cnt: c_int,
375 cb: uv_write_cb) -> c_int;
376 }
377
378 let buf_ptr = buf_in.as_ptr();
379 let buf_cnt = buf_in.len() as i32;
380 return uv_write(req, stream, buf_ptr, buf_cnt, cb);
381 }
382
383 pub unsafe fn uv_udp_send(req: *uv_udp_send_t,
384 handle: *uv_udp_t,
385 buf_in: &[uv_buf_t],
386 addr: *sockaddr,
387 cb: uv_udp_send_cb) -> c_int {
388 extern {
389 fn uv_udp_send(req: *uv_write_t, stream: *uv_stream_t,
390 buf_in: *uv_buf_t, buf_cnt: c_int, addr: *sockaddr,
391 cb: uv_udp_send_cb) -> c_int;
392 }
393
394 let buf_ptr = buf_in.as_ptr();
395 let buf_cnt = buf_in.len() as i32;
396 return uv_udp_send(req, handle, buf_ptr, buf_cnt, addr, cb);
397 }
398
399 pub unsafe fn get_udp_handle_from_send_req(send_req: *uv_udp_send_t) -> *uv_udp_t {
400 return rust_uv_get_udp_handle_from_send_req(send_req);
401 }
402
403 pub unsafe fn process_pid(p: *uv_process_t) -> c_int {
404
405 return rust_uv_process_pid(p);
406 }
407
408 pub unsafe fn set_stdio_container_flags(c: *uv_stdio_container_t,
409 flags: libc::c_int) {
410
411 rust_set_stdio_container_flags(c, flags);
412 }
413
414 pub unsafe fn set_stdio_container_fd(c: *uv_stdio_container_t,
415 fd: libc::c_int) {
416
417 rust_set_stdio_container_fd(c, fd);
418 }
419
420 pub unsafe fn set_stdio_container_stream(c: *uv_stdio_container_t,
421 stream: *uv_stream_t) {
422 rust_set_stdio_container_stream(c, stream);
423 }
424
425 // data access helpers
426 pub unsafe fn get_result_from_fs_req(req: *uv_fs_t) -> ssize_t {
427 rust_uv_get_result_from_fs_req(req)
428 }
429 pub unsafe fn get_ptr_from_fs_req(req: *uv_fs_t) -> *libc::c_void {
430 rust_uv_get_ptr_from_fs_req(req)
431 }
432 pub unsafe fn get_path_from_fs_req(req: *uv_fs_t) -> *c_char {
433 rust_uv_get_path_from_fs_req(req)
434 }
435 pub unsafe fn get_loop_from_fs_req(req: *uv_fs_t) -> *uv_loop_t {
436 rust_uv_get_loop_from_fs_req(req)
437 }
438 pub unsafe fn get_loop_from_getaddrinfo_req(req: *uv_getaddrinfo_t) -> *uv_loop_t {
439 rust_uv_get_loop_from_getaddrinfo_req(req)
440 }
441 pub unsafe fn get_loop_for_uv_handle<T>(handle: *T) -> *c_void {
442 return rust_uv_get_loop_for_uv_handle(handle as *c_void);
443 }
444 pub unsafe fn get_stream_handle_from_connect_req(connect: *uv_connect_t) -> *uv_stream_t {
445 return rust_uv_get_stream_handle_from_connect_req(connect);
446 }
447 pub unsafe fn get_stream_handle_from_write_req(write_req: *uv_write_t) -> *uv_stream_t {
448 return rust_uv_get_stream_handle_from_write_req(write_req);
449 }
450 pub unsafe fn get_data_for_uv_loop(loop_ptr: *c_void) -> *c_void {
451 rust_uv_get_data_for_uv_loop(loop_ptr)
452 }
453 pub unsafe fn set_data_for_uv_loop(loop_ptr: *c_void, data: *c_void) {
454 rust_uv_set_data_for_uv_loop(loop_ptr, data);
455 }
456 pub unsafe fn get_data_for_uv_handle<T>(handle: *T) -> *c_void {
457 return rust_uv_get_data_for_uv_handle(handle as *c_void);
458 }
459 pub unsafe fn set_data_for_uv_handle<T, U>(handle: *T, data: *U) {
460 rust_uv_set_data_for_uv_handle(handle as *c_void, data as *c_void);
461 }
462 pub unsafe fn get_data_for_req<T>(req: *T) -> *c_void {
463 return rust_uv_get_data_for_req(req as *c_void);
464 }
465 pub unsafe fn set_data_for_req<T, U>(req: *T, data: *U) {
466 rust_uv_set_data_for_req(req as *c_void, data as *c_void);
467 }
468 pub unsafe fn populate_stat(req_in: *uv_fs_t, stat_out: *uv_stat_t) {
469 rust_uv_populate_uv_stat(req_in, stat_out)
470 }
471 pub unsafe fn guess_handle(handle: c_int) -> c_int {
472 rust_uv_guess_handle(handle)
473 }
474
475
476 // uv_support is the result of compiling rust_uv.cpp
477 //
478 // Note that this is in a cfg'd block so it doesn't get linked during testing.
479 // There's a bit of a conundrum when testing in that we're actually assuming
480 // that the tests are running in a uv loop, but they were created from the
481 // statically linked uv to the original rustuv crate. When we create the test
482 // executable, on some platforms if we re-link against uv, it actually creates
483 // second copies of everything. We obviously don't want this, so instead of
484 // dying horribly during testing, we allow all of the test rustuv's references
485 // to get resolved to the original rustuv crate.
486 #[cfg(not(test))]
487 #[link(name = "uv_support", kind = "static")]
488 #[link(name = "uv", kind = "static")]
489 extern {}
490
491 extern {
492 fn rust_uv_loop_new() -> *c_void;
493
494 #[cfg(test)]
495 fn rust_uv_handle_type_max() -> uintptr_t;
496 #[cfg(test)]
497 fn rust_uv_req_type_max() -> uintptr_t;
498 fn rust_uv_get_udp_handle_from_send_req(req: *uv_udp_send_t) -> *uv_udp_t;
499
500 fn rust_uv_populate_uv_stat(req_in: *uv_fs_t, stat_out: *uv_stat_t);
501 fn rust_uv_get_result_from_fs_req(req: *uv_fs_t) -> ssize_t;
502 fn rust_uv_get_ptr_from_fs_req(req: *uv_fs_t) -> *libc::c_void;
503 fn rust_uv_get_path_from_fs_req(req: *uv_fs_t) -> *c_char;
504 fn rust_uv_get_loop_from_fs_req(req: *uv_fs_t) -> *uv_loop_t;
505 fn rust_uv_get_loop_from_getaddrinfo_req(req: *uv_fs_t) -> *uv_loop_t;
506 fn rust_uv_get_stream_handle_from_connect_req(req: *uv_connect_t) -> *uv_stream_t;
507 fn rust_uv_get_stream_handle_from_write_req(req: *uv_write_t) -> *uv_stream_t;
508 fn rust_uv_get_loop_for_uv_handle(handle: *c_void) -> *c_void;
509 fn rust_uv_get_data_for_uv_loop(loop_ptr: *c_void) -> *c_void;
510 fn rust_uv_set_data_for_uv_loop(loop_ptr: *c_void, data: *c_void);
511 fn rust_uv_get_data_for_uv_handle(handle: *c_void) -> *c_void;
512 fn rust_uv_set_data_for_uv_handle(handle: *c_void, data: *c_void);
513 fn rust_uv_get_data_for_req(req: *c_void) -> *c_void;
514 fn rust_uv_set_data_for_req(req: *c_void, data: *c_void);
515 fn rust_set_stdio_container_flags(c: *uv_stdio_container_t, flags: c_int);
516 fn rust_set_stdio_container_fd(c: *uv_stdio_container_t, fd: c_int);
517 fn rust_set_stdio_container_stream(c: *uv_stdio_container_t,
518 stream: *uv_stream_t);
519 fn rust_uv_process_pid(p: *uv_process_t) -> c_int;
520 fn rust_uv_guess_handle(fd: c_int) -> c_int;
521
522 // generic uv functions
523 pub fn uv_loop_delete(l: *uv_loop_t);
524 pub fn uv_ref(t: *uv_handle_t);
525 pub fn uv_unref(t: *uv_handle_t);
526 pub fn uv_handle_size(ty: uv_handle_type) -> size_t;
527 pub fn uv_req_size(ty: uv_req_type) -> size_t;
528 pub fn uv_run(l: *uv_loop_t, mode: uv_run_mode) -> c_int;
529 pub fn uv_close(h: *uv_handle_t, cb: uv_close_cb);
530 pub fn uv_walk(l: *uv_loop_t, cb: uv_walk_cb, arg: *c_void);
531 pub fn uv_buf_init(base: *c_char, len: c_uint) -> uv_buf_t;
532 pub fn uv_strerror(err: c_int) -> *c_char;
533 pub fn uv_err_name(err: c_int) -> *c_char;
534 pub fn uv_listen(s: *uv_stream_t, backlog: c_int,
535 cb: uv_connection_cb) -> c_int;
536 pub fn uv_accept(server: *uv_stream_t, client: *uv_stream_t) -> c_int;
537 pub fn uv_read_start(stream: *uv_stream_t,
538 on_alloc: uv_alloc_cb,
539 on_read: uv_read_cb) -> c_int;
540 pub fn uv_read_stop(stream: *uv_stream_t) -> c_int;
541 pub fn uv_shutdown(req: *uv_shutdown_t, handle: *uv_stream_t,
542 cb: uv_shutdown_cb) -> c_int;
543
544 // idle bindings
545 pub fn uv_idle_init(l: *uv_loop_t, i: *uv_idle_t) -> c_int;
546 pub fn uv_idle_start(i: *uv_idle_t, cb: uv_idle_cb) -> c_int;
547 pub fn uv_idle_stop(i: *uv_idle_t) -> c_int;
548
549 // async bindings
550 pub fn uv_async_init(l: *uv_loop_t, a: *uv_async_t,
551 cb: uv_async_cb) -> c_int;
552 pub fn uv_async_send(a: *uv_async_t);
553
554 // tcp bindings
555 pub fn uv_tcp_init(l: *uv_loop_t, h: *uv_tcp_t) -> c_int;
556 pub fn uv_tcp_connect(c: *uv_connect_t, h: *uv_tcp_t,
557 addr: *sockaddr, cb: uv_connect_cb) -> c_int;
558 pub fn uv_tcp_bind(t: *uv_tcp_t, addr: *sockaddr) -> c_int;
559 pub fn uv_tcp_nodelay(h: *uv_tcp_t, enable: c_int) -> c_int;
560 pub fn uv_tcp_keepalive(h: *uv_tcp_t, enable: c_int,
561 delay: c_uint) -> c_int;
562 pub fn uv_tcp_simultaneous_accepts(h: *uv_tcp_t, enable: c_int) -> c_int;
563 pub fn uv_tcp_getsockname(h: *uv_tcp_t, name: *mut sockaddr,
564 len: *mut c_int) -> c_int;
565 pub fn uv_tcp_getpeername(h: *uv_tcp_t, name: *mut sockaddr,
566 len: *mut c_int) -> c_int;
567
568 // udp bindings
569 pub fn uv_udp_init(l: *uv_loop_t, h: *uv_udp_t) -> c_int;
570 pub fn uv_udp_bind(h: *uv_udp_t, addr: *sockaddr, flags: c_uint) -> c_int;
571 pub fn uv_udp_recv_start(server: *uv_udp_t,
572 on_alloc: uv_alloc_cb,
573 on_recv: uv_udp_recv_cb) -> c_int;
574 pub fn uv_udp_set_membership(handle: *uv_udp_t, multicast_addr: *c_char,
575 interface_addr: *c_char,
576 membership: uv_membership) -> c_int;
577 pub fn uv_udp_recv_stop(server: *uv_udp_t) -> c_int;
578 pub fn uv_udp_set_multicast_loop(handle: *uv_udp_t, on: c_int) -> c_int;
579 pub fn uv_udp_set_multicast_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
580 pub fn uv_udp_set_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
581 pub fn uv_udp_set_broadcast(handle: *uv_udp_t, on: c_int) -> c_int;
582 pub fn uv_udp_getsockname(h: *uv_udp_t, name: *mut sockaddr,
583 len: *mut c_int) -> c_int;
584
585 // timer bindings
586 pub fn uv_timer_init(l: *uv_loop_t, t: *uv_timer_t) -> c_int;
587 pub fn uv_timer_start(t: *uv_timer_t, cb: uv_timer_cb,
588 timeout: libc::uint64_t,
589 repeat: libc::uint64_t) -> c_int;
590 pub fn uv_timer_stop(handle: *uv_timer_t) -> c_int;
591
592 // fs operations
593 pub fn uv_fs_open(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
594 flags: c_int, mode: c_int, cb: uv_fs_cb) -> c_int;
595 pub fn uv_fs_unlink(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
596 cb: uv_fs_cb) -> c_int;
597 pub fn uv_fs_write(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
598 bufs: *uv_buf_t, nbufs: c_uint,
599 offset: i64, cb: uv_fs_cb) -> c_int;
600 pub fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
601 bufs: *uv_buf_t, nbufs: c_uint,
602 offset: i64, cb: uv_fs_cb) -> c_int;
603 pub fn uv_fs_close(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
604 cb: uv_fs_cb) -> c_int;
605 pub fn uv_fs_stat(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
606 cb: uv_fs_cb) -> c_int;
607 pub fn uv_fs_fstat(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
608 cb: uv_fs_cb) -> c_int;
609 pub fn uv_fs_mkdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
610 mode: c_int, cb: uv_fs_cb) -> c_int;
611 pub fn uv_fs_rmdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
612 cb: uv_fs_cb) -> c_int;
613 pub fn uv_fs_readdir(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,
614 flags: c_int, cb: uv_fs_cb) -> c_int;
615 pub fn uv_fs_req_cleanup(req: *uv_fs_t);
616 pub fn uv_fs_fsync(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
617 cb: uv_fs_cb) -> c_int;
618 pub fn uv_fs_fdatasync(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
619 cb: uv_fs_cb) -> c_int;
620 pub fn uv_fs_ftruncate(handle: *uv_loop_t, req: *uv_fs_t, file: c_int,
621 offset: i64, cb: uv_fs_cb) -> c_int;
622 pub fn uv_fs_readlink(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
623 cb: uv_fs_cb) -> c_int;
624 pub fn uv_fs_symlink(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
625 dst: *c_char, flags: c_int, cb: uv_fs_cb) -> c_int;
626 pub fn uv_fs_rename(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
627 dst: *c_char, cb: uv_fs_cb) -> c_int;
628 pub fn uv_fs_utime(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
629 atime: c_double, mtime: c_double,
630 cb: uv_fs_cb) -> c_int;
631 pub fn uv_fs_link(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
632 dst: *c_char, cb: uv_fs_cb) -> c_int;
633 pub fn uv_fs_chown(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
634 uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) -> c_int;
635 pub fn uv_fs_chmod(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
636 mode: c_int, cb: uv_fs_cb) -> c_int;
637 pub fn uv_fs_lstat(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
638 cb: uv_fs_cb) -> c_int;
639
640 // getaddrinfo
641 pub fn uv_getaddrinfo(loop_: *uv_loop_t, req: *uv_getaddrinfo_t,
642 getaddrinfo_cb: uv_getaddrinfo_cb,
643 node: *c_char, service: *c_char,
644 hints: *addrinfo) -> c_int;
645 pub fn uv_freeaddrinfo(ai: *addrinfo);
646
647 // process spawning
648 pub fn uv_spawn(loop_ptr: *uv_loop_t, outptr: *uv_process_t,
649 options: *uv_process_options_t) -> c_int;
650 pub fn uv_process_kill(p: *uv_process_t, signum: c_int) -> c_int;
651 pub fn uv_kill(pid: c_int, signum: c_int) -> c_int;
652
653 // pipes
654 pub fn uv_pipe_init(l: *uv_loop_t, p: *uv_pipe_t, ipc: c_int) -> c_int;
655 pub fn uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
656 pub fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
657 pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
658 name: *c_char, cb: uv_connect_cb);
659
660 // tty
661 pub fn uv_tty_init(l: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
662 readable: c_int) -> c_int;
663 pub fn uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
664 pub fn uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
665 height: *c_int) -> c_int;
666
667 // signals
668 pub fn uv_signal_init(loop_: *uv_loop_t, handle: *uv_signal_t) -> c_int;
669 pub fn uv_signal_start(h: *uv_signal_t, cb: uv_signal_cb,
670 signum: c_int) -> c_int;
671 pub fn uv_signal_stop(handle: *uv_signal_t) -> c_int;
672 }
673
674 // libuv requires other native libraries on various platforms. These are all
675 // listed here (for each platform)
676
677 // libuv doesn't use pthread on windows
678 // android libc (bionic) provides pthread, so no additional link is required
679 #[cfg(not(windows), not(target_os = "android"))]
680 #[link(name = "pthread")]
681 extern {}
682
683 #[cfg(target_os = "linux")]
684 #[link(name = "rt")]
685 extern {}
686
687 #[cfg(target_os = "win32")]
688 #[link(name = "ws2_32")]
689 #[link(name = "psapi")]
690 #[link(name = "iphlpapi")]
691 extern {}
692
693 #[cfg(target_os = "freebsd")]
694 #[link(name = "kvm")]
695 extern {}
librustuv/uvll.rs:470:2-470:2 -fn- definition:
}
pub unsafe fn guess_handle(handle: c_int) -> c_int {
rust_uv_guess_handle(handle)
references:- 2librustuv/tty.rs:
41: // - https://github.com/joyent/libuv/issues/988
42: let guess = unsafe { uvll::guess_handle(fd) };
43: if guess != uvll::UV_TTY as libc::c_int {
--
117: fn isatty(&self) -> bool {
118: unsafe { uvll::guess_handle(self.fd) == uvll::UV_TTY as libc::c_int }
119: }
librustuv/uvll.rs:458:2-458:2 -fn- definition:
}
pub unsafe fn set_data_for_uv_handle<T, U>(handle: *T, data: *U) {
rust_uv_set_data_for_uv_handle(handle as *c_void, data as *c_void);
references:- 14librustuv/net.rs:
776: if data.is_null() { return None }
777: uvll::set_data_for_uv_handle(handle, 0 as *int);
778: &mut *(data as *mut UdpRecvCtx)
librustuv/idle.rs:
44: let data: *c_void = cast::transmute(box f);
45: uvll::set_data_for_uv_handle(handle, data);
46: assert_eq!(uvll::uv_idle_start(handle, onetime_cb), 0)
librustuv/timer.rs:
63: pub unsafe fn set_data<T>(&mut self, data: *T) {
64: uvll::set_data_for_uv_handle(self.handle, data);
65: }
librustuv/async.rs:
42: let payload: *u8 = cast::transmute(payload);
43: uvll::set_data_for_uv_handle(handle, payload);
44: }
librustuv/stream.rs:
117: if data.is_null() { return None }
118: uvll::set_data_for_uv_handle(self.handle, 0 as *int);
119: &mut *(data as *mut ReadContext)
librustuv/lib.rs:
155: let myptr = cast::transmute::<&Box<Self>, &*u8>(&self);
156: uvll::set_data_for_uv_handle(self.uv_handle(), *myptr);
157: }
--
168: unsafe {
169: uvll::set_data_for_uv_handle(self.uv_handle(), null::<()>());
170: uvll::uv_close(self.uv_handle() as *uvll::uv_handle_t, close_cb)
--
181: wait_until_woken_after(&mut slot, &self.uv_loop(), || {
182: uvll::set_data_for_uv_handle(self.uv_handle(), &slot);
183: })
librustuv/queue.rs:
125: let data = &*q as *QueuePool as *c_void;
126: uvll::set_data_for_uv_handle(handle, data);
127: }
librustuv/net.rs:
563: wait_until_woken_after(&mut cx.task, &loop_, || {
564: unsafe { uvll::set_data_for_uv_handle(handle, &cx) }
565: });
librustuv/uvll.rs:149:30-149:30 -NK_AS_STR_TODO- definition:
pub type uv_write_t = c_void;
pub type uv_async_t = c_void;
pub type uv_timer_t = c_void;
references:- 11231: arg: *c_void);
232: pub type uv_async_cb = extern "C" fn(handle: *uv_async_t);
233: pub type uv_connect_cb = extern "C" fn(handle: *uv_connect_t,
--
549: // async bindings
550: pub fn uv_async_init(l: *uv_loop_t, a: *uv_async_t,
551: cb: uv_async_cb) -> c_int;
552: pub fn uv_async_send(a: *uv_async_t);
librustuv/async.rs:
50: fn uv_handle(&self) -> *uvll::uv_async_t { self.handle }
51: unsafe fn from_uv_handle<'a>(_: &'a *uvll::uv_async_t) -> &'a mut AsyncWatcher {
52: fail!("async watchers can't be built from their handles");
--
56: extern fn async_cb(handle: *uvll::uv_async_t) {
57: let payload: &mut Payload = unsafe {
librustuv/queue.rs:
40: struct State {
41: handle: *uvll::uv_async_t,
42: lock: NativeMutex, // see comments in async_cb for why this is needed
--
142: pub fn handle(&self) -> *uvll::uv_async_t {
143: unsafe { (*self.queue.get()).handle }
librustuv/async.rs:
49: impl UvHandle<uvll::uv_async_t> for AsyncWatcher {
50: fn uv_handle(&self) -> *uvll::uv_async_t { self.handle }
51: unsafe fn from_uv_handle<'a>(_: &'a *uvll::uv_async_t) -> &'a mut AsyncWatcher {
librustuv/uvll.rs:155:36-155:36 -NK_AS_STR_TODO- definition:
pub type uv_getaddrinfo_t = c_void;
pub type uv_process_t = c_void;
pub type uv_pipe_t = c_void;
references:- 9242: res: *addrinfo);
243: pub type uv_exit_cb = extern "C" fn(handle: *uv_process_t,
244: exit_status: i64,
--
403: pub unsafe fn process_pid(p: *uv_process_t) -> c_int {
--
518: stream: *uv_stream_t);
519: fn rust_uv_process_pid(p: *uv_process_t) -> c_int;
520: fn rust_uv_guess_handle(fd: c_int) -> c_int;
--
647: // process spawning
648: pub fn uv_spawn(loop_ptr: *uv_loop_t, outptr: *uv_process_t,
649: options: *uv_process_options_t) -> c_int;
650: pub fn uv_process_kill(p: *uv_process_t, signum: c_int) -> c_int;
651: pub fn uv_kill(pid: c_int, signum: c_int) -> c_int;
librustuv/process.rs:
121: extern fn on_exit(handle: *uvll::uv_process_t,
122: exit_status: i64,
--
207: impl UvHandle<uvll::uv_process_t> for Process {
208: fn uv_handle(&self) -> *uvll::uv_process_t { self.handle }
209: }
librustuv/uvll.rs:142:28-142:28 -NK_AS_STR_TODO- definition:
pub type uv_req_t = c_void;
pub type uv_loop_t = c_void;
pub type uv_idle_t = c_void;
references:- 41librustuv/lib.rs:
librustuv/uvio.rs:
librustuv/lib.rs:
librustuv/uvll.rs:145:28-145:28 -NK_AS_STR_TODO- definition:
pub type uv_tcp_t = c_void;
pub type uv_udp_t = c_void;
pub type uv_connect_t = c_void;
references:- 20569: pub fn uv_udp_init(l: *uv_loop_t, h: *uv_udp_t) -> c_int;
570: pub fn uv_udp_bind(h: *uv_udp_t, addr: *sockaddr, flags: c_uint) -> c_int;
571: pub fn uv_udp_recv_start(server: *uv_udp_t,
--
573: on_recv: uv_udp_recv_cb) -> c_int;
574: pub fn uv_udp_set_membership(handle: *uv_udp_t, multicast_addr: *c_char,
575: interface_addr: *c_char,
576: membership: uv_membership) -> c_int;
577: pub fn uv_udp_recv_stop(server: *uv_udp_t) -> c_int;
578: pub fn uv_udp_set_multicast_loop(handle: *uv_udp_t, on: c_int) -> c_int;
--
581: pub fn uv_udp_set_broadcast(handle: *uv_udp_t, on: c_int) -> c_int;
582: pub fn uv_udp_getsockname(h: *uv_udp_t, name: *mut sockaddr,
583: len: *mut c_int) -> c_int;
librustuv/net.rs:
530: impl UvHandle<uvll::uv_udp_t> for UdpWatcher {
531: fn uv_handle(&self) -> *uvll::uv_udp_t { self.handle }
532: }
--
585: extern fn recv_cb(handle: *uvll::uv_udp_t, nread: ssize_t, buf: *Buf,
586: addr: *libc::sockaddr, _flags: c_uint) {
--
771: // there for more information
772: let handle = stream as *uvll::uv_udp_t;
773: assert_eq!(unsafe { uvll::uv_udp_recv_stop(handle) }, 0);
librustuv/uvll.rs:
580: pub fn uv_udp_set_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
581: pub fn uv_udp_set_broadcast(handle: *uv_udp_t, on: c_int) -> c_int;
582: pub fn uv_udp_getsockname(h: *uv_udp_t, name: *mut sockaddr,
librustuv/uvll.rs:143:29-143:29 -NK_AS_STR_TODO- definition:
pub type uv_loop_t = c_void;
pub type uv_idle_t = c_void;
pub type uv_tcp_t = c_void;
references:- 9546: pub fn uv_idle_start(i: *uv_idle_t, cb: uv_idle_cb) -> c_int;
547: pub fn uv_idle_stop(i: *uv_idle_t) -> c_int;
librustuv/idle.rs:
18: pub struct IdleWatcher {
19: handle: *uvll::uv_idle_t,
20: idle_flag: bool,
--
80: impl UvHandle<uvll::uv_idle_t> for IdleWatcher {
81: fn uv_handle(&self) -> *uvll::uv_idle_t { self.handle }
--
84: extern fn idle_cb(handle: *uvll::uv_idle_t) {
85: let idle: &mut IdleWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
librustuv/uvll.rs:
544: // idle bindings
545: pub fn uv_idle_init(l: *uv_loop_t, i: *uv_idle_t) -> c_int;
546: pub fn uv_idle_start(i: *uv_idle_t, cb: uv_idle_cb) -> c_int;
librustuv/uvll.rs:257:16-257:16 -enum- definition:
pub enum uv_handle_type {
UV_UNKNOWN_HANDLE,
UV_ASYNC,
references:- 6525: pub fn uv_unref(t: *uv_handle_t);
526: pub fn uv_handle_size(ty: uv_handle_type) -> size_t;
527: pub fn uv_req_size(ty: uv_req_type) -> size_t;
librustuv/lib.rs:
140: // FIXME(#8888) dummy self
141: fn alloc(_: Option<Self>, ty: uvll::uv_handle_type) -> *T {
142: unsafe {
librustuv/uvll.rs:
329: pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
330: assert!(handle != UV_UNKNOWN_HANDLE && handle != UV_HANDLE_TYPE_MAX);
librustuv/uvll.rs:247:54-247:54 -NK_AS_STR_TODO- definition:
signum: c_int);
pub type uv_fs_cb = extern "C" fn(req: *uv_fs_t);
pub type uv_shutdown_cb = extern "C" fn(req: *uv_shutdown_t, status: c_int);
references:- 23637: pub fn uv_fs_lstat(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
638: cb: uv_fs_cb) -> c_int;
librustuv/file.rs:
350: fn execute_nop(f: |*uvll::uv_fs_t, uvll::uv_fs_cb| -> c_int)
351: -> Result<(), UvError> {
librustuv/uvll.rs:
635: pub fn uv_fs_chmod(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
636: mode: c_int, cb: uv_fs_cb) -> c_int;
637: pub fn uv_fs_lstat(handle: *uv_loop_t, req: *uv_fs_t, file: *c_char,
librustuv/uvll.rs:153:27-153:27 -NK_AS_STR_TODO- definition:
pub type uv_fs_t = c_void;
pub type uv_udp_send_t = c_void;
pub type uv_getaddrinfo_t = c_void;
references:- 5497: fn rust_uv_req_type_max() -> uintptr_t;
498: fn rust_uv_get_udp_handle_from_send_req(req: *uv_udp_send_t) -> *uv_udp_t;
librustuv/net.rs:
663: // instead of streams.
664: extern fn send_cb(req: *uvll::uv_udp_send_t, status: c_int) {
665: let req = Request::wrap(req);
librustuv/uvll.rs:
221: buf: *uv_buf_t);
222: pub type uv_udp_send_cb = extern "C" fn(req: *uv_udp_send_t,
223: status: c_int);
librustuv/uvll.rs:237:59-237:59 -NK_AS_STR_TODO- definition:
pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t);
pub type uv_write_cb = extern "C" fn(handle: *uv_write_t,
status: c_int);
references:- 2370: buf_in: &[uv_buf_t],
371: cb: uv_write_cb) -> c_int {
372: extern {
--
374: buf_in: *uv_buf_t, buf_cnt: c_int,
375: cb: uv_write_cb) -> c_int;
376: }
librustuv/uvll.rs:166:1-166:1 -struct- definition:
pub struct uv_stat_t {
pub st_dev: libc::uint64_t,
pub st_mode: libc::uint64_t,
references:- 6187: pub fn new() -> uv_stat_t {
188: uv_stat_t {
189: st_dev: 0,
--
500: fn rust_uv_populate_uv_stat(req_in: *uv_fs_t, stat_out: *uv_stat_t);
501: fn rust_uv_get_result_from_fs_req(req: *uv_fs_t) -> ssize_t;
librustuv/file.rs:
255: pub fn get_stat(&self) -> uvll::uv_stat_t {
256: let stat = uvll::uv_stat_t::new();
librustuv/uvll.rs:140:1-140:1 -NK_AS_STR_TODO- definition:
pub type uv_handle_t = c_void;
pub type uv_req_t = c_void;
pub type uv_loop_t = c_void;
references:- 11228: flags: c_uint);
229: pub type uv_close_cb = extern "C" fn(handle: *uv_handle_t);
230: pub type uv_walk_cb = extern "C" fn(handle: *uv_handle_t,
231: arg: *c_void);
--
523: pub fn uv_loop_delete(l: *uv_loop_t);
524: pub fn uv_ref(t: *uv_handle_t);
525: pub fn uv_unref(t: *uv_handle_t);
--
528: pub fn uv_run(l: *uv_loop_t, mode: uv_run_mode) -> c_int;
529: pub fn uv_close(h: *uv_handle_t, cb: uv_close_cb);
530: pub fn uv_walk(l: *uv_loop_t, cb: uv_walk_cb, arg: *c_void);
librustuv/idle.rs:
59: extern fn close_cb(handle: *uvll::uv_handle_t) {
60: unsafe { uvll::free_handle(handle) }
librustuv/async.rs:
94: extern fn close_cb(handle: *uvll::uv_handle_t) {
95: // drop the payload
librustuv/lib.rs:
177: unsafe {
178: uvll::uv_close(self.uv_handle() as *uvll::uv_handle_t, close_cb);
179: uvll::set_data_for_uv_handle(self.uv_handle(), ptr::null::<()>());
--
186: extern fn close_cb(handle: *uvll::uv_handle_t) {
187: unsafe {
librustuv/uvll.rs:
524: pub fn uv_ref(t: *uv_handle_t);
525: pub fn uv_unref(t: *uv_handle_t);
526: pub fn uv_handle_size(ty: uv_handle_type) -> size_t;
librustuv/uvll.rs:338:1-338:1 -fn- definition:
pub unsafe fn malloc_req(req: uv_req_type) -> *c_void {
assert!(req != UV_UNKNOWN_REQ && req != UV_REQ_TYPE_MAX);
let size = uv_req_size(req);
references:- 3librustuv/file.rs:
403: unsafe {
404: let req = uvll::malloc_req(uvll::UV_FS);
405: assert_eq!(uvll::uv_fs_close(self.loop_.handle, req,
librustuv/lib.rs:
269: unsafe {
270: let handle = uvll::malloc_req(ty);
271: uvll::set_data_for_req(handle, null::<()>());
librustuv/uvll.rs:146:28-146:28 -NK_AS_STR_TODO- definition:
pub type uv_udp_t = c_void;
pub type uv_connect_t = c_void;
pub type uv_connection_t = c_void;
references:- 6443: }
444: pub unsafe fn get_stream_handle_from_connect_req(connect: *uv_connect_t) -> *uv_stream_t {
445: return rust_uv_get_stream_handle_from_connect_req(connect);
--
555: pub fn uv_tcp_init(l: *uv_loop_t, h: *uv_tcp_t) -> c_int;
556: pub fn uv_tcp_connect(c: *uv_connect_t, h: *uv_tcp_t,
557: addr: *sockaddr, cb: uv_connect_cb) -> c_int;
--
656: pub fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
657: pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
658: name: *c_char, cb: uv_connect_cb);
librustuv/timeout.rs:
276: extern fn connect_cb(req: *uvll::uv_connect_t, status: c_int) {
277: // This callback can be invoked with ECANCELED if the watcher is
librustuv/uvll.rs:
505: fn rust_uv_get_loop_from_getaddrinfo_req(req: *uv_fs_t) -> *uv_loop_t;
506: fn rust_uv_get_stream_handle_from_connect_req(req: *uv_connect_t) -> *uv_stream_t;
507: fn rust_uv_get_stream_handle_from_write_req(req: *uv_write_t) -> *uv_stream_t;
librustuv/uvll.rs:221:53-221:53 -NK_AS_STR_TODO- definition:
buf: *uv_buf_t);
pub type uv_udp_send_cb = extern "C" fn(req: *uv_udp_send_t,
status: c_int);
references:- 2390: buf_in: *uv_buf_t, buf_cnt: c_int, addr: *sockaddr,
391: cb: uv_udp_send_cb) -> c_int;
392: }
librustuv/uvll.rs:232:59-232:59 -NK_AS_STR_TODO- definition:
pub type uv_async_cb = extern "C" fn(handle: *uv_async_t);
pub type uv_connect_cb = extern "C" fn(handle: *uv_connect_t,
status: c_int);
references:- 3556: pub fn uv_tcp_connect(c: *uv_connect_t, h: *uv_tcp_t,
557: addr: *sockaddr, cb: uv_connect_cb) -> c_int;
558: pub fn uv_tcp_bind(t: *uv_tcp_t, addr: *sockaddr) -> c_int;
librustuv/timeout.rs:
227: mut self, obj: T, timeout: Option<u64>, io: &mut UvIoFactory,
228: f: |&Request, &T, uvll::uv_connect_cb| -> c_int
229: ) -> Result<T, UvError> {
librustuv/uvll.rs:
657: pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
658: name: *c_char, cb: uv_connect_cb);
librustuv/uvll.rs:101:13-101:13 -struct- definition:
pub struct uv_buf_t {
pub base: *u8,
pub len: uv_buf_len_t,
references:- 15librustuv/file.rs:
88: };
89: let uvbuf = uvll::uv_buf_t {
90: base: buf.slice_from(written as uint).as_ptr(),
--
106: execute(|req, cb| unsafe {
107: let uvbuf = uvll::uv_buf_t {
108: base: buf.as_ptr(),
librustuv/lib.rs:
445: pub fn empty_buf() -> Buf {
446: uvll::uv_buf_t {
447: base: null(),
--
454: let data = v.as_ptr();
455: uvll::uv_buf_t { base: data, len: v.len() as uvll::uv_buf_len_t }
456: }
librustuv/uvll.rs:
600: pub fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
601: bufs: *uv_buf_t, nbufs: c_uint,
602: offset: i64, cb: uv_fs_cb) -> c_int;
librustuv/lib.rs:
442: /// The uv buffer type
443: pub type Buf = uvll::uv_buf_t;
librustuv/uvll.rs:
220: nread: ssize_t,
221: buf: *uv_buf_t);
222: pub type uv_udp_send_cb = extern "C" fn(req: *uv_udp_send_t,
librustuv/uvll.rs:161:1-161:1 -struct- definition:
pub struct uv_timespec_t {
pub tv_sec: libc::c_long,
pub tv_nsec: libc::c_long
references:- 9200: st_gen: 0,
201: st_atim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
202: st_mtim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
203: st_ctim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
204: st_birthtim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 }
librustuv/file.rs:
268: let stat = self.get_stat();
269: fn to_msec(stat: uvll::uv_timespec_t) -> u64 {
270: // Be sure to cast to u64 first to prevent overflowing if the tv_sec
librustuv/uvll.rs:
203: st_ctim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
204: st_birthtim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 }
205: }
librustuv/uvll.rs:150:30-150:30 -NK_AS_STR_TODO- definition:
pub type uv_async_t = c_void;
pub type uv_timer_t = c_void;
pub type uv_stream_t = c_void;
references:- 11589: repeat: libc::uint64_t) -> c_int;
590: pub fn uv_timer_stop(handle: *uv_timer_t) -> c_int;
librustuv/timer.rs:
72: impl UvHandle<uvll::uv_timer_t> for TimerWatcher {
73: fn uv_handle(&self) -> *uvll::uv_timer_t { self.handle }
74: }
--
139: extern fn timer_cb(handle: *uvll::uv_timer_t) {
140: let _f = ForbidSwitch::new("timer callback can't switch");
librustuv/timeout.rs:
385: extern fn timer_cb(timer: *uvll::uv_timer_t) {
386: let acceptor: &mut AcceptTimeout = unsafe {
librustuv/timer.rs:
72: impl UvHandle<uvll::uv_timer_t> for TimerWatcher {
73: fn uv_handle(&self) -> *uvll::uv_timer_t { self.handle }
librustuv/uvll.rs:440:2-440:2 -fn- definition:
}
pub unsafe fn get_loop_for_uv_handle<T>(handle: *T) -> *c_void {
return rust_uv_get_loop_for_uv_handle(handle as *c_void);
references:- 6librustuv/net.rs:
416: let loop_ = Loop::wrap(unsafe {
417: uvll::get_loop_for_uv_handle(server)
418: });
librustuv/pipe.rs:
282: let loop_ = Loop::wrap(unsafe {
283: uvll::get_loop_for_uv_handle(server)
284: });
librustuv/stream.rs:
180: let loop_ = unsafe { uvll::get_loop_for_uv_handle(self.handle) };
181: wait_until_woken_after(&mut self.blocked_writer,
librustuv/lib.rs:
136: fn uv_loop(&self) -> Loop {
137: Loop::wrap(unsafe { uvll::get_loop_for_uv_handle(self.uv_handle()) })
138: }
librustuv/timeout.rs:
366: let loop_ = Loop::wrap(unsafe {
367: uvll::get_loop_for_uv_handle(t.uv_handle())
368: });
librustuv/uvll.rs:95:13-95:13 -NK_AS_STR_TODO- definition:
pub type uv_buf_len_t = libc::size_t;
pub type uv_buf_len_t = libc::c_ulong;
// see libuv/include/uv-unix.h
references:- 4librustuv/file.rs:
108: base: buf.as_ptr(),
109: len: buf.len() as uvll::uv_buf_len_t,
110: };
librustuv/lib.rs:
454: let data = v.as_ptr();
455: uvll::uv_buf_t { base: data, len: v.len() as uvll::uv_buf_len_t }
456: }
librustuv/uvll.rs:
103: pub base: *u8,
104: pub len: uv_buf_len_t,
105: }
librustuv/uvll.rs:252:13-252:13 -NK_AS_STR_TODO- definition:
pub enum uv_handle_type {
UV_UNKNOWN_HANDLE,
UV_ASYNC,
references:- 4130: pub uid: uv_uid_t,
131: pub gid: uv_gid_t,
132: }
--
633: pub fn uv_fs_chown(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
634: uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) -> c_int;
635: pub fn uv_fs_chmod(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
librustuv/process.rs:
85: uid: config.uid.unwrap_or(0) as uvll::uv_uid_t,
86: gid: config.gid.unwrap_or(0) as uvll::uv_gid_t,
87: };
librustuv/file.rs:
191: uid as uvll::uv_uid_t,
192: gid as uvll::uv_gid_t,
193: cb)
librustuv/uvll.rs:455:2-455:2 -fn- definition:
}
pub unsafe fn get_data_for_uv_handle<T>(handle: *T) -> *c_void {
return rust_uv_get_data_for_uv_handle(handle as *c_void);
references:- 17librustuv/net.rs:
588: let cx = unsafe {
589: &mut *(uvll::get_data_for_uv_handle(handle) as *mut UdpRecvCtx)
590: };
--
774: let data = unsafe {
775: let data = uvll::get_data_for_uv_handle(handle);
776: if data.is_null() { return None }
librustuv/idle.rs:
50: unsafe {
51: let data = uvll::get_data_for_uv_handle(handle);
52: let f: Box<proc()> = cast::transmute(data);
librustuv/async.rs:
96: let _payload: Box<Payload> = unsafe {
97: cast::transmute(uvll::get_data_for_uv_handle(handle))
98: };
librustuv/stream.rs:
245: let rcx: &mut ReadContext = unsafe {
246: cast::transmute(uvll::get_data_for_uv_handle(handle))
247: };
librustuv/lib.rs:
187: unsafe {
188: let data = uvll::get_data_for_uv_handle(handle);
189: uvll::free_handle(handle);
librustuv/timeout.rs:
386: let acceptor: &mut AcceptTimeout = unsafe {
387: &mut *(uvll::get_data_for_uv_handle(timer) as *mut AcceptTimeout)
388: };
librustuv/queue.rs:
59: let pool: &mut QueuePool = unsafe {
60: cast::transmute(uvll::get_data_for_uv_handle(handle))
61: };
librustuv/lib.rs:
149: unsafe fn from_uv_handle<'a>(h: &'a *T) -> &'a mut Self {
150: cast::transmute(uvll::get_data_for_uv_handle(*h))
151: }
librustuv/uvll.rs:334:1-334:1 -fn- definition:
pub unsafe fn free_handle(v: *c_void) {
free(v as *mut c_void)
}
references:- 6librustuv/idle.rs:
59: extern fn close_cb(handle: *uvll::uv_handle_t) {
60: unsafe { uvll::free_handle(handle) }
61: }
librustuv/async.rs:
99: // and then free the handle
100: unsafe { uvll::free_handle(handle) }
101: }
librustuv/tty.rs:
72: if cfg!(windows) {
73: unsafe { uvll::free_handle(handle); }
74: watcher.tty = ptr::null();
librustuv/lib.rs:
188: let data = uvll::get_data_for_uv_handle(handle);
189: uvll::free_handle(handle);
190: if data == ptr::null() { return }
librustuv/uvio.rs:
82: self.uvio.loop_.close();
83: unsafe { uvll::free_handle(handle) }
84: }
librustuv/lib.rs:
164: extern fn close_cb(handle: *uvll::uv_handle_t) {
165: unsafe { uvll::free_handle(handle) }
166: }
librustuv/uvll.rs:328:1-328:1 -fn- definition:
pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
assert!(handle != UV_UNKNOWN_HANDLE && handle != UV_HANDLE_TYPE_MAX);
let size = uv_handle_size(handle);
references:- 5librustuv/net.rs:
188: fn new_home(loop_: &Loop, home: HomeHandle) -> TcpWatcher {
189: let handle = unsafe { uvll::malloc_handle(uvll::UV_TCP) };
190: assert_eq!(unsafe {
--
507: let udp = UdpWatcher {
508: handle: unsafe { uvll::malloc_handle(uvll::UV_UDP) },
509: home: io.make_handle(),
librustuv/pipe.rs:
63: let handle = unsafe {
64: let handle = uvll::malloc_handle(uvll::UV_NAMED_PIPE);
65: assert!(!handle.is_null());
librustuv/lib.rs:
142: unsafe {
143: let handle = uvll::malloc_handle(ty);
144: assert!(!handle.is_null());
librustuv/net.rs:
354: -> Result<Box<TcpListener>, UvError> {
355: let handle = unsafe { uvll::malloc_handle(uvll::UV_TCP) };
356: assert_eq!(unsafe {
librustuv/uvll.rs:344:1-344:1 -fn- definition:
pub unsafe fn free_req(v: *c_void) {
free(v as *mut c_void)
}
references:- 3librustuv/file.rs:
313: }
314: uvll::free_req(self.req);
315: }
--
411: uvll::uv_fs_req_cleanup(req);
412: uvll::free_req(req);
413: }
librustuv/lib.rs:
305: if !self.defused {
306: unsafe { uvll::free_req(self.handle) }
307: }
librustuv/uvll.rs:236:58-236:58 -NK_AS_STR_TODO- definition:
status: c_int);
pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t);
pub type uv_write_cb = extern "C" fn(handle: *uv_write_t,
references:- 2586: pub fn uv_timer_init(l: *uv_loop_t, t: *uv_timer_t) -> c_int;
587: pub fn uv_timer_start(t: *uv_timer_t, cb: uv_timer_cb,
588: timeout: libc::uint64_t,
librustuv/timer.rs:
53: pub fn start(&mut self, f: uvll::uv_timer_cb, msecs: u64, period: u64) {
54: assert_eq!(unsafe {
librustuv/uvll.rs:135:20-135:20 -struct- definition:
// functions below.
pub struct uv_stdio_container_t {
flags: libc::c_int,
references:- 10420: pub unsafe fn set_stdio_container_stream(c: *uv_stdio_container_t,
421: stream: *uv_stream_t) {
--
514: fn rust_uv_set_data_for_req(req: *c_void, data: *c_void);
515: fn rust_set_stdio_container_flags(c: *uv_stdio_container_t, flags: c_int);
516: fn rust_set_stdio_container_fd(c: *uv_stdio_container_t, fd: c_int);
517: fn rust_set_stdio_container_stream(c: *uv_stdio_container_t,
librustuv/process.rs:
136: unsafe fn set_stdio(dst: *uvll::uv_stdio_container_t,
137: io: &process::StdioContainer,
librustuv/uvll.rs:
516: fn rust_set_stdio_container_fd(c: *uv_stdio_container_t, fd: c_int);
517: fn rust_set_stdio_container_stream(c: *uv_stdio_container_t,
518: stream: *uv_stream_t);
librustuv/uvll.rs:251:13-251:13 -NK_AS_STR_TODO- definition:
pub enum uv_handle_type {
UV_UNKNOWN_HANDLE,
UV_ASYNC,
references:- 4129: pub stdio: *uv_stdio_container_t,
130: pub uid: uv_uid_t,
131: pub gid: uv_gid_t,
--
633: pub fn uv_fs_chown(handle: *uv_loop_t, req: *uv_fs_t, src: *c_char,
634: uid: uv_uid_t, gid: uv_gid_t, cb: uv_fs_cb) -> c_int;
635: pub fn uv_fs_chmod(handle: *uv_loop_t, req: *uv_fs_t, path: *c_char,
librustuv/process.rs:
84: stdio: stdio.as_ptr(),
85: uid: config.uid.unwrap_or(0) as uvll::uv_uid_t,
86: gid: config.gid.unwrap_or(0) as uvll::uv_gid_t,
librustuv/file.rs:
190: req, path.with_ref(|p| p),
191: uid as uvll::uv_uid_t,
192: gid as uvll::uv_gid_t,
librustuv/uvll.rs:158:28-158:28 -NK_AS_STR_TODO- definition:
pub type uv_tty_t = c_void;
pub type uv_signal_t = c_void;
pub type uv_shutdown_t = c_void;
references:- 8667: // signals
668: pub fn uv_signal_init(loop_: *uv_loop_t, handle: *uv_signal_t) -> c_int;
669: pub fn uv_signal_start(h: *uv_signal_t, cb: uv_signal_cb,
670: signum: c_int) -> c_int;
671: pub fn uv_signal_stop(handle: *uv_signal_t) -> c_int;
672: }
librustuv/signal.rs:
51: extern fn signal_cb(handle: *uvll::uv_signal_t, signum: c_int) {
52: let s: &mut SignalWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
--
61: impl UvHandle<uvll::uv_signal_t> for SignalWatcher {
62: fn uv_handle(&self) -> *uvll::uv_signal_t { self.handle }
63: }
librustuv/uvll.rs:449:2-449:2 -fn- definition:
}
pub unsafe fn get_data_for_uv_loop(loop_ptr: *c_void) -> *c_void {
rust_uv_get_data_for_uv_loop(loop_ptr)
references:- 2librustuv/lib.rs:
339: unsafe {
340: let cur = uvll::get_data_for_uv_loop(self.handle) as uint;
341: uvll::set_data_for_uv_loop(self.handle, (cur + amt) as *c_void)
--
345: fn get_blockers(&self) -> uint {
346: unsafe { uvll::get_data_for_uv_loop(self.handle) as uint }
347: }
librustuv/uvll.rs:141:31-141:31 -NK_AS_STR_TODO- definition:
pub type uv_handle_t = c_void;
pub type uv_req_t = c_void;
pub type uv_loop_t = c_void;
references:- 2librustuv/lib.rs:
276: pub fn wrap(handle: *uvll::uv_req_t) -> Request {
277: Request { handle: handle, defused: false }
librustuv/uvll.rs:464:2-464:2 -fn- definition:
}
pub unsafe fn set_data_for_req<T, U>(req: *T, data: *U) {
rust_uv_set_data_for_req(req as *c_void, data as *c_void);
references:- 3librustuv/file.rs:
331: wait_until_woken_after(&mut slot, &Loop::wrap(loop_), || {
332: unsafe { uvll::set_data_for_req(req.req, &slot) }
333: });
librustuv/lib.rs:
280: pub fn set_data<T>(&self, t: *T) {
281: unsafe { uvll::set_data_for_req(self.handle, t) }
282: }
librustuv/uvll.rs:152:31-152:31 -NK_AS_STR_TODO- definition:
pub type uv_stream_t = c_void;
pub type uv_fs_t = c_void;
pub type uv_udp_send_t = c_void;
references:- 39librustuv/file.rs:
librustuv/uvll.rs:
librustuv/uvll.rs:323:16-323:16 -enum- definition:
pub enum uv_membership {
UV_LEAVE_GROUP,
UV_JOIN_GROUP
references:- 4324: pub enum uv_membership {
--
575: interface_addr: *c_char,
576: membership: uv_membership) -> c_int;
577: pub fn uv_udp_recv_stop(server: *uv_udp_t) -> c_int;
librustuv/uvll.rs:215:57-215:57 -NK_AS_STR_TODO- definition:
pub type uv_idle_cb = extern "C" fn(handle: *uv_idle_t);
pub type uv_alloc_cb = extern "C" fn(stream: *uv_stream_t,
suggested_size: size_t,
references:- 2537: pub fn uv_read_start(stream: *uv_stream_t,
538: on_alloc: uv_alloc_cb,
539: on_read: uv_read_cb) -> c_int;
--
571: pub fn uv_udp_recv_start(server: *uv_udp_t,
572: on_alloc: uv_alloc_cb,
573: on_recv: uv_udp_recv_cb) -> c_int;
librustuv/uvll.rs:120:1-120:1 -struct- definition:
pub struct uv_process_options_t {
pub exit_cb: uv_exit_cb,
pub file: *libc::c_char,
references:- 2librustuv/process.rs:
72: }
73: let options = uvll::uv_process_options_t {
74: exit_cb: on_exit,
librustuv/uvll.rs:
648: pub fn uv_spawn(loop_ptr: *uv_loop_t, outptr: *uv_process_t,
649: options: *uv_process_options_t) -> c_int;
650: pub fn uv_process_kill(p: *uv_process_t, signum: c_int) -> c_int;
librustuv/uvll.rs:154:33-154:33 -NK_AS_STR_TODO- definition:
pub type uv_udp_send_t = c_void;
pub type uv_getaddrinfo_t = c_void;
pub type uv_process_t = c_void;
references:- 4437: }
438: pub unsafe fn get_loop_from_getaddrinfo_req(req: *uv_getaddrinfo_t) -> *uv_loop_t {
439: rust_uv_get_loop_from_getaddrinfo_req(req)
librustuv/addrinfo.rs:
102: extern fn getaddrinfo_cb(req: *uvll::uv_getaddrinfo_t,
103: status: c_int,
librustuv/uvll.rs:
640: // getaddrinfo
641: pub fn uv_getaddrinfo(loop_: *uv_loop_t, req: *uv_getaddrinfo_t,
642: getaddrinfo_cb: uv_getaddrinfo_cb,
librustuv/uvll.rs:157:29-157:29 -NK_AS_STR_TODO- definition:
pub type uv_pipe_t = c_void;
pub type uv_tty_t = c_void;
pub type uv_signal_t = c_void;
references:- 6662: readable: c_int) -> c_int;
663: pub fn uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
664: pub fn uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
665: height: *c_int) -> c_int;
librustuv/tty.rs:
122: impl UvHandle<uvll::uv_tty_t> for TtyWatcher {
123: fn uv_handle(&self) -> *uvll::uv_tty_t { self.tty }
124: }
librustuv/uvll.rs:452:2-452:2 -fn- definition:
}
pub unsafe fn set_data_for_uv_loop(loop_ptr: *c_void, data: *c_void) {
rust_uv_set_data_for_uv_loop(loop_ptr, data);
references:- 2librustuv/lib.rs:
340: let cur = uvll::get_data_for_uv_loop(self.handle) as uint;
341: uvll::set_data_for_uv_loop(self.handle, (cur + amt) as *c_void)
342: }
librustuv/uvll.rs:151:30-151:30 -NK_AS_STR_TODO- definition:
pub type uv_timer_t = c_void;
pub type uv_stream_t = c_void;
pub type uv_fs_t = c_void;
references:- 25517: fn rust_set_stdio_container_stream(c: *uv_stdio_container_t,
518: stream: *uv_stream_t);
519: fn rust_uv_process_pid(p: *uv_process_t) -> c_int;
--
540: pub fn uv_read_stop(stream: *uv_stream_t) -> c_int;
541: pub fn uv_shutdown(req: *uv_shutdown_t, handle: *uv_stream_t,
542: cb: uv_shutdown_cb) -> c_int;
librustuv/net.rs:
812: pub fn shutdown(handle: *uvll::uv_stream_t, loop_: &Loop) -> Result<(), IoError> {
813: struct Ctx {
librustuv/pipe.rs:
276: extern fn listen_cb(server: *uvll::uv_stream_t, status: libc::c_int) {
277: assert!(status != uvll::ECANCELED);
librustuv/stream.rs:
61: // if they rely on the field to perform an action.
62: pub fn new(stream: *uvll::uv_stream_t) -> StreamWatcher {
63: unsafe { uvll::set_data_for_uv_handle(stream, 0 as *int) }
--
230: // will fail if it is called more than once.
231: extern fn alloc_cb(stream: *uvll::uv_stream_t, _hint: size_t, buf: *mut Buf) {
232: uvdebug!("alloc_cb");
--
241: // return all the data read (even if it didn't fill the whole buffer).
242: extern fn read_cb(handle: *uvll::uv_stream_t, nread: ssize_t, _buf: *Buf) {
243: uvdebug!("read_cb {}", nread);
librustuv/uvll.rs:
539: on_read: uv_read_cb) -> c_int;
540: pub fn uv_read_stop(stream: *uv_stream_t) -> c_int;
541: pub fn uv_shutdown(req: *uv_shutdown_t, handle: *uv_stream_t,
librustuv/uvll.rs:461:2-461:2 -fn- definition:
}
pub unsafe fn get_data_for_req<T>(req: *T) -> *c_void {
return rust_uv_get_data_for_req(req as *c_void);
references:- 3librustuv/file.rs:
343: let slot: &mut Option<BlockedTask> = unsafe {
344: cast::transmute(uvll::get_data_for_req(req))
345: };
librustuv/lib.rs:
284: pub unsafe fn get_data<T>(&self) -> &'static mut T {
285: let data = uvll::get_data_for_req(self.handle);
286: assert!(data != null());
librustuv/timeout.rs:
286: // and there's nothing we can do.
287: let data = unsafe { uvll::get_data_for_req(req.handle) };
288: if data.is_null() { return }
librustuv/uvll.rs:407:1-407:1 -fn- definition:
pub unsafe fn set_stdio_container_flags(c: *uv_stdio_container_t,
flags: libc::c_int) {
rust_set_stdio_container_flags(c, flags);
references:- 3librustuv/process.rs:
157: let pipe = PipeWatcher::new(io_loop, false);
158: uvll::set_stdio_container_flags(dst, flags);
159: uvll::set_stdio_container_stream(dst, pipe.handle());
librustuv/uvll.rs:144:29-144:29 -NK_AS_STR_TODO- definition:
pub type uv_idle_t = c_void;
pub type uv_tcp_t = c_void;
pub type uv_udp_t = c_void;
references:- 13562: pub fn uv_tcp_simultaneous_accepts(h: *uv_tcp_t, enable: c_int) -> c_int;
563: pub fn uv_tcp_getsockname(h: *uv_tcp_t, name: *mut sockaddr,
564: len: *mut c_int) -> c_int;
565: pub fn uv_tcp_getpeername(h: *uv_tcp_t, name: *mut sockaddr,
566: len: *mut c_int) -> c_int;
librustuv/net.rs:
383: impl UvHandle<uvll::uv_tcp_t> for TcpListener {
384: fn uv_handle(&self) -> *uvll::uv_tcp_t { self.handle }
385: }
librustuv/uvll.rs:
557: addr: *sockaddr, cb: uv_connect_cb) -> c_int;
558: pub fn uv_tcp_bind(t: *uv_tcp_t, addr: *sockaddr) -> c_int;
559: pub fn uv_tcp_nodelay(h: *uv_tcp_t, enable: c_int) -> c_int;
librustuv/uvll.rs:159:31-159:31 -NK_AS_STR_TODO- definition:
pub type uv_signal_t = c_void;
pub type uv_shutdown_t = c_void;
pub struct uv_timespec_t {
references:- 3248: pub type uv_fs_cb = extern "C" fn(req: *uv_fs_t);
249: pub type uv_shutdown_cb = extern "C" fn(req: *uv_shutdown_t, status: c_int);
librustuv/net.rs:
833: extern fn shutdown_cb(req: *uvll::uv_shutdown_t, status: libc::c_int) {
834: let req = Request::wrap(req);
librustuv/uvll.rs:
540: pub fn uv_read_stop(stream: *uv_stream_t) -> c_int;
541: pub fn uv_shutdown(req: *uv_shutdown_t, handle: *uv_stream_t,
542: cb: uv_shutdown_cb) -> c_int;
librustuv/uvll.rs:156:32-156:32 -NK_AS_STR_TODO- definition:
pub type uv_process_t = c_void;
pub type uv_pipe_t = c_void;
pub type uv_tty_t = c_void;
references:- 12653: // pipes
654: pub fn uv_pipe_init(l: *uv_loop_t, p: *uv_pipe_t, ipc: c_int) -> c_int;
655: pub fn uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
656: pub fn uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
657: pub fn uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
658: name: *c_char, cb: uv_connect_cb);
librustuv/net.rs:
168: home: HomeHandle,
169: handle: *uvll::uv_pipe_t,
170: closing_task: Option<BlockedTask>,
librustuv/pipe.rs:
210: impl UvHandle<uvll::uv_pipe_t> for PipeWatcher {
211: fn uv_handle(&self) -> *uvll::uv_pipe_t { self.stream.handle }
212: }
--
272: impl UvHandle<uvll::uv_pipe_t> for PipeListener {
273: fn uv_handle(&self) -> *uvll::uv_pipe_t { self.pipe }
274: }
librustuv/uvll.rs:282:16-282:16 -enum- definition:
pub enum uv_req_type {
UV_UNKNOWN_REQ,
UV_REQ,
references:- 6526: pub fn uv_handle_size(ty: uv_handle_type) -> size_t;
527: pub fn uv_req_size(ty: uv_req_type) -> size_t;
528: pub fn uv_run(l: *uv_loop_t, mode: uv_run_mode) -> c_int;
librustuv/lib.rs:
267: impl Request {
268: pub fn new(ty: uvll::uv_req_type) -> Request {
269: unsafe {
librustuv/uvll.rs:148:35-148:35 -NK_AS_STR_TODO- definition:
pub type uv_connection_t = c_void;
pub type uv_write_t = c_void;
pub type uv_async_t = c_void;
references:- 7388: extern {
389: fn uv_udp_send(req: *uv_write_t, stream: *uv_stream_t,
390: buf_in: *uv_buf_t, buf_cnt: c_int, addr: *sockaddr,
--
446: }
447: pub unsafe fn get_stream_handle_from_write_req(write_req: *uv_write_t) -> *uv_stream_t {
448: return rust_uv_get_stream_handle_from_write_req(write_req);
--
506: fn rust_uv_get_stream_handle_from_connect_req(req: *uv_connect_t) -> *uv_stream_t;
507: fn rust_uv_get_stream_handle_from_write_req(req: *uv_write_t) -> *uv_stream_t;
508: fn rust_uv_get_loop_for_uv_handle(handle: *c_void) -> *c_void;
librustuv/stream.rs:
260: // away the error code as a result.
261: extern fn write_cb(req: *uvll::uv_write_t, status: c_int) {
262: let mut req = Request::wrap(req);
librustuv/uvll.rs:
368: pub unsafe fn uv_write(req: *uv_write_t,
369: stream: *uv_stream_t,