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.
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.
12 * Low-level bindings to the libuv library.
14 * This module contains a set of direct, 'bare-metal' wrappers around
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.
23 * There are also a collection of helper functions to ease interacting
24 * with the low-level API.
26 * As new functionality, existent in uv.h, is added to the rust stdlib,
27 * the mappings should be added in this module.
30 #[allow(non_camel_case_types)]; // C types
32 use std::libc::{size_t, c_int, c_uint, c_void, c_char, uintptr_t};
33 use std::libc::ssize_t;
34 use std::libc::{malloc, free};
39 pub use self::errors::*;
41 pub static OK: c_int = 0;
42 pub static EOF: c_int = -4095;
43 pub static UNKNOWN: c_int = -4094;
45 // uv-errno.h redefines error codes for windows, but not for unix...
51 pub static EACCES: c_int = -4093;
52 pub static ECONNREFUSED: c_int = -4079;
53 pub static ECONNRESET: c_int = -4078;
54 pub static ENOTCONN: c_int = -4054;
55 pub static EPIPE: c_int = -4048;
56 pub static ECONNABORTED: c_int = -4080;
63 pub static EACCES: c_int = -libc::EACCES;
64 pub static ECONNREFUSED: c_int = -libc::ECONNREFUSED;
65 pub static ECONNRESET: c_int = -libc::ECONNRESET;
66 pub static ENOTCONN: c_int = -libc::ENOTCONN;
67 pub static EPIPE: c_int = -libc::EPIPE;
68 pub static ECONNABORTED: c_int = -libc::ECONNABORTED;
71 pub static PROCESS_SETUID: c_int = 1 << 0;
72 pub static PROCESS_SETGID: c_int = 1 << 1;
73 pub static PROCESS_WINDOWS_VERBATIM_ARGUMENTS: c_int = 1 << 2;
74 pub static PROCESS_DETACHED: c_int = 1 << 3;
75 pub static PROCESS_WINDOWS_HIDE: c_int = 1 << 4;
77 pub static STDIO_IGNORE: c_int = 0x00;
78 pub static STDIO_CREATE_PIPE: c_int = 0x01;
79 pub static STDIO_INHERIT_FD: c_int = 0x02;
80 pub static STDIO_INHERIT_STREAM: c_int = 0x04;
81 pub static STDIO_READABLE_PIPE: c_int = 0x10;
82 pub static STDIO_WRITABLE_PIPE: c_int = 0x20;
84 // see libuv/include/uv-unix.h
91 // see libuv/include/uv-win.h
98 pub struct uv_process_options_t {
101 args: **libc::c_char,
105 stdio_count: libc::c_int,
106 stdio: *uv_stdio_container_t,
111 // These fields are private because they must be interfaced with through the
113 pub struct uv_stdio_container_t {
114 priv flags: libc::c_int,
115 priv stream: *uv_stream_t,
118 pub type uv_handle_t = c_void;
119 pub type uv_loop_t = c_void;
120 pub type uv_idle_t = c_void;
121 pub type uv_tcp_t = c_void;
122 pub type uv_udp_t = c_void;
123 pub type uv_connect_t = c_void;
124 pub type uv_connection_t = c_void;
125 pub type uv_write_t = c_void;
126 pub type uv_async_t = c_void;
127 pub type uv_timer_t = c_void;
128 pub type uv_stream_t = c_void;
129 pub type uv_fs_t = c_void;
130 pub type uv_udp_send_t = c_void;
131 pub type uv_getaddrinfo_t = c_void;
132 pub type uv_process_t = c_void;
133 pub type uv_pipe_t = c_void;
134 pub type uv_tty_t = c_void;
135 pub type uv_signal_t = c_void;
137 pub struct uv_timespec_t {
138 tv_sec: libc::c_long,
139 tv_nsec: libc::c_long
142 pub struct uv_stat_t {
143 st_dev: libc::uint64_t,
144 st_mode: libc::uint64_t,
145 st_nlink: libc::uint64_t,
146 st_uid: libc::uint64_t,
147 st_gid: libc::uint64_t,
148 st_rdev: libc::uint64_t,
149 st_ino: libc::uint64_t,
150 st_size: libc::uint64_t,
151 st_blksize: libc::uint64_t,
152 st_blocks: libc::uint64_t,
153 st_flags: libc::uint64_t,
154 st_gen: libc::uint64_t,
155 st_atim: uv_timespec_t,
156 st_mtim: uv_timespec_t,
157 st_ctim: uv_timespec_t,
158 st_birthtim: uv_timespec_t
162 pub fn new() -> uv_stat_t {
176 st_atim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
177 st_mtim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
178 st_ctim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 },
179 st_birthtim: uv_timespec_t { tv_sec: 0, tv_nsec: 0 }
182 pub fn is_file(&self) -> bool {
183 ((self.st_mode) & libc::S_IFMT as libc::uint64_t) == libc::S_IFREG as libc::uint64_t
185 pub fn is_dir(&self) -> bool {
186 ((self.st_mode) & libc::S_IFMT as libc::uint64_t) == libc::S_IFDIR as libc::uint64_t
190 pub type uv_idle_cb = extern "C" fn(handle: *uv_idle_t,
192 pub type uv_alloc_cb = extern "C" fn(stream: *uv_stream_t,
193 suggested_size: size_t) -> uv_buf_t;
194 pub type uv_read_cb = extern "C" fn(stream: *uv_stream_t,
197 pub type uv_udp_send_cb = extern "C" fn(req: *uv_udp_send_t,
199 pub type uv_udp_recv_cb = extern "C" fn(handle: *uv_udp_t,
204 pub type uv_close_cb = extern "C" fn(handle: *uv_handle_t);
205 pub type uv_walk_cb = extern "C" fn(handle: *uv_handle_t,
207 pub type uv_async_cb = extern "C" fn(handle: *uv_async_t,
209 pub type uv_connect_cb = extern "C" fn(handle: *uv_connect_t,
211 pub type uv_connection_cb = extern "C" fn(handle: *uv_connection_t,
213 pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t,
215 pub type uv_write_cb = extern "C" fn(handle: *uv_write_t,
217 pub type uv_getaddrinfo_cb = extern "C" fn(req: *uv_getaddrinfo_t,
220 pub type uv_exit_cb = extern "C" fn(handle: *uv_process_t,
223 pub type uv_signal_cb = extern "C" fn(handle: *uv_signal_t,
226 pub type sockaddr = c_void;
227 pub type sockaddr_in = c_void;
228 pub type sockaddr_in6 = c_void;
229 pub type sockaddr_storage = c_void;
232 pub type socklen_t = c_int;
234 // XXX: This is a standard C type. Could probably be defined in libc
235 #[cfg(target_os = "android")]
236 #[cfg(target_os = "linux")]
237 pub struct addrinfo {
242 ai_addrlen: socklen_t,
248 #[cfg(target_os = "macos")]
249 #[cfg(target_os = "freebsd")]
250 pub struct addrinfo {
255 ai_addrlen: socklen_t,
262 pub struct addrinfo {
273 #[cfg(unix)] pub type uv_uid_t = libc::types::os::arch::posix88::uid_t;
274 #[cfg(unix)] pub type uv_gid_t = libc::types::os::arch::posix88::gid_t;
275 #[cfg(windows)] pub type uv_uid_t = libc::c_uchar;
276 #[cfg(windows)] pub type uv_gid_t = libc::c_uchar;
279 pub enum uv_handle_type {
303 pub enum uv_req_type {
316 // uv_req_type may have additional fields defined by UV_REQ_TYPE_PRIVATE.
317 // See UV_REQ_TYPE_PRIVATE at libuv/include/uv-win.h
320 pub enum uv_req_type {
342 pub enum uv_membership {
347 pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
348 #[fixed_stack_segment]; #[inline(never)];
350 assert!(handle != UV_UNKNOWN_HANDLE && handle != UV_HANDLE_TYPE_MAX);
351 let size = rust_uv_handle_size(handle as uint);
352 let p = malloc(size);
353 assert!(p.is_not_null());
357 pub unsafe fn free_handle(v: *c_void) {
358 #[fixed_stack_segment]; #[inline(never)];
363 pub unsafe fn malloc_req(req: uv_req_type) -> *c_void {
364 #[fixed_stack_segment]; #[inline(never)];
366 assert!(req != UV_UNKNOWN_REQ && req != UV_REQ_TYPE_MAX);
367 let size = rust_uv_req_size(req as uint);
368 let p = malloc(size);
369 assert!(p.is_not_null());
373 pub unsafe fn free_req(v: *c_void) {
374 #[fixed_stack_segment]; #[inline(never)];
380 fn handle_sanity_check() {
381 #[fixed_stack_segment]; #[inline(never)];
383 assert_eq!(UV_HANDLE_TYPE_MAX as uint, rust_uv_handle_type_max());
388 fn request_sanity_check() {
389 #[fixed_stack_segment]; #[inline(never)];
391 assert_eq!(UV_REQ_TYPE_MAX as uint, rust_uv_req_type_max());
395 // XXX Event loops ignore SIGPIPE by default.
396 pub unsafe fn loop_new() -> *c_void {
397 #[fixed_stack_segment]; #[inline(never)];
399 return rust_uv_loop_new();
402 pub unsafe fn loop_delete(loop_handle: *c_void) {
403 #[fixed_stack_segment]; #[inline(never)];
405 rust_uv_loop_delete(loop_handle);
408 pub unsafe fn run(loop_handle: *c_void) {
409 #[fixed_stack_segment]; #[inline(never)];
411 rust_uv_run(loop_handle);
414 pub unsafe fn close<T>(handle: *T, cb: uv_close_cb) {
415 #[fixed_stack_segment]; #[inline(never)];
417 rust_uv_close(handle as *c_void, cb);
420 pub unsafe fn walk(loop_handle: *c_void, cb: uv_walk_cb, arg: *c_void) {
421 #[fixed_stack_segment]; #[inline(never)];
423 rust_uv_walk(loop_handle, cb, arg);
426 pub unsafe fn idle_init(loop_handle: *uv_loop_t, handle: *uv_idle_t) -> c_int {
427 #[fixed_stack_segment]; #[inline(never)];
429 rust_uv_idle_init(loop_handle, handle)
432 pub unsafe fn idle_start(handle: *uv_idle_t, cb: uv_idle_cb) -> c_int {
433 #[fixed_stack_segment]; #[inline(never)];
435 rust_uv_idle_start(handle, cb)
438 pub unsafe fn idle_stop(handle: *uv_idle_t) -> c_int {
439 #[fixed_stack_segment]; #[inline(never)];
441 rust_uv_idle_stop(handle)
444 pub unsafe fn udp_init(loop_handle: *uv_loop_t, handle: *uv_udp_t) -> c_int {
445 #[fixed_stack_segment]; #[inline(never)];
447 return rust_uv_udp_init(loop_handle, handle);
450 pub unsafe fn udp_bind(server: *uv_udp_t, addr: *sockaddr_in, flags: c_uint) -> c_int {
451 #[fixed_stack_segment]; #[inline(never)];
453 return rust_uv_udp_bind(server, addr, flags);
456 pub unsafe fn udp_bind6(server: *uv_udp_t, addr: *sockaddr_in6, flags: c_uint) -> c_int {
457 #[fixed_stack_segment]; #[inline(never)];
459 return rust_uv_udp_bind6(server, addr, flags);
462 pub unsafe fn udp_send<T>(req: *uv_udp_send_t, handle: *T, buf_in: &[uv_buf_t],
463 addr: *sockaddr_in, cb: uv_udp_send_cb) -> c_int {
464 #[fixed_stack_segment]; #[inline(never)];
466 let buf_ptr = vec::raw::to_ptr(buf_in);
467 let buf_cnt = buf_in.len() as i32;
468 return rust_uv_udp_send(req, handle as *c_void, buf_ptr, buf_cnt, addr, cb);
471 pub unsafe fn udp_send6<T>(req: *uv_udp_send_t, handle: *T, buf_in: &[uv_buf_t],
472 addr: *sockaddr_in6, cb: uv_udp_send_cb) -> c_int {
473 #[fixed_stack_segment]; #[inline(never)];
475 let buf_ptr = vec::raw::to_ptr(buf_in);
476 let buf_cnt = buf_in.len() as i32;
477 return rust_uv_udp_send6(req, handle as *c_void, buf_ptr, buf_cnt, addr, cb);
480 pub unsafe fn udp_recv_start(server: *uv_udp_t, on_alloc: uv_alloc_cb,
481 on_recv: uv_udp_recv_cb) -> c_int {
482 #[fixed_stack_segment]; #[inline(never)];
484 return rust_uv_udp_recv_start(server, on_alloc, on_recv);
487 pub unsafe fn udp_recv_stop(server: *uv_udp_t) -> c_int {
488 #[fixed_stack_segment]; #[inline(never)];
490 return rust_uv_udp_recv_stop(server);
493 pub unsafe fn get_udp_handle_from_send_req(send_req: *uv_udp_send_t) -> *uv_udp_t {
494 #[fixed_stack_segment]; #[inline(never)];
496 return rust_uv_get_udp_handle_from_send_req(send_req);
499 pub unsafe fn udp_getsockname(handle: *uv_udp_t, name: *sockaddr_storage) -> c_int {
500 #[fixed_stack_segment]; #[inline(never)];
502 return rust_uv_udp_getsockname(handle, name);
505 pub unsafe fn udp_set_membership(handle: *uv_udp_t, multicast_addr: *c_char,
506 interface_addr: *c_char, membership: uv_membership) -> c_int {
507 #[fixed_stack_segment]; #[inline(never)];
509 return rust_uv_udp_set_membership(handle, multicast_addr, interface_addr, membership as c_int);
512 pub unsafe fn udp_set_multicast_loop(handle: *uv_udp_t, on: c_int) -> c_int {
513 #[fixed_stack_segment]; #[inline(never)];
515 return rust_uv_udp_set_multicast_loop(handle, on);
518 pub unsafe fn udp_set_multicast_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int {
519 #[fixed_stack_segment]; #[inline(never)];
521 return rust_uv_udp_set_multicast_ttl(handle, ttl);
524 pub unsafe fn udp_set_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int {
525 #[fixed_stack_segment]; #[inline(never)];
527 return rust_uv_udp_set_ttl(handle, ttl);
530 pub unsafe fn udp_set_broadcast(handle: *uv_udp_t, on: c_int) -> c_int {
531 #[fixed_stack_segment]; #[inline(never)];
533 return rust_uv_udp_set_broadcast(handle, on);
536 pub unsafe fn tcp_init(loop_handle: *c_void, handle: *uv_tcp_t) -> c_int {
537 #[fixed_stack_segment]; #[inline(never)];
539 return rust_uv_tcp_init(loop_handle, handle);
542 pub unsafe fn tcp_connect(connect_ptr: *uv_connect_t, tcp_handle_ptr: *uv_tcp_t,
543 addr_ptr: *sockaddr_in, after_connect_cb: uv_connect_cb) -> c_int {
544 #[fixed_stack_segment]; #[inline(never)];
546 return rust_uv_tcp_connect(connect_ptr, tcp_handle_ptr, after_connect_cb, addr_ptr);
549 pub unsafe fn tcp_connect6(connect_ptr: *uv_connect_t, tcp_handle_ptr: *uv_tcp_t,
550 addr_ptr: *sockaddr_in6, after_connect_cb: uv_connect_cb) -> c_int {
551 #[fixed_stack_segment]; #[inline(never)];
553 return rust_uv_tcp_connect6(connect_ptr, tcp_handle_ptr, after_connect_cb, addr_ptr);
556 pub unsafe fn tcp_bind(tcp_server_ptr: *uv_tcp_t, addr_ptr: *sockaddr_in) -> c_int {
557 #[fixed_stack_segment]; #[inline(never)];
559 return rust_uv_tcp_bind(tcp_server_ptr, addr_ptr);
562 pub unsafe fn tcp_bind6(tcp_server_ptr: *uv_tcp_t, addr_ptr: *sockaddr_in6) -> c_int {
563 #[fixed_stack_segment]; #[inline(never)];
565 return rust_uv_tcp_bind6(tcp_server_ptr, addr_ptr);
568 pub unsafe fn tcp_getpeername(tcp_handle_ptr: *uv_tcp_t, name: *sockaddr_storage) -> c_int {
569 #[fixed_stack_segment]; #[inline(never)];
571 return rust_uv_tcp_getpeername(tcp_handle_ptr, name);
574 pub unsafe fn tcp_getsockname(handle: *uv_tcp_t, name: *sockaddr_storage) -> c_int {
575 #[fixed_stack_segment]; #[inline(never)];
577 return rust_uv_tcp_getsockname(handle, name);
580 pub unsafe fn tcp_nodelay(handle: *uv_tcp_t, enable: c_int) -> c_int {
581 #[fixed_stack_segment]; #[inline(never)];
583 return rust_uv_tcp_nodelay(handle, enable);
586 pub unsafe fn tcp_keepalive(handle: *uv_tcp_t, enable: c_int, delay: c_uint) -> c_int {
587 #[fixed_stack_segment]; #[inline(never)];
589 return rust_uv_tcp_keepalive(handle, enable, delay);
592 pub unsafe fn tcp_simultaneous_accepts(handle: *uv_tcp_t, enable: c_int) -> c_int {
593 #[fixed_stack_segment]; #[inline(never)];
595 return rust_uv_tcp_simultaneous_accepts(handle, enable);
598 pub unsafe fn listen<T>(stream: *T, backlog: c_int,
599 cb: uv_connection_cb) -> c_int {
600 #[fixed_stack_segment]; #[inline(never)];
602 return rust_uv_listen(stream as *c_void, backlog, cb);
605 pub unsafe fn accept(server: *c_void, client: *c_void) -> c_int {
606 #[fixed_stack_segment]; #[inline(never)];
608 return rust_uv_accept(server as *c_void, client as *c_void);
611 pub unsafe fn write<T>(req: *uv_write_t,
614 cb: uv_write_cb) -> c_int {
615 #[fixed_stack_segment]; #[inline(never)];
617 let buf_ptr = vec::raw::to_ptr(buf_in);
618 let buf_cnt = buf_in.len() as i32;
619 return rust_uv_write(req as *c_void, stream as *c_void, buf_ptr, buf_cnt, cb);
621 pub unsafe fn read_start(stream: *uv_stream_t,
622 on_alloc: uv_alloc_cb,
623 on_read: uv_read_cb) -> c_int {
624 #[fixed_stack_segment]; #[inline(never)];
626 return rust_uv_read_start(stream as *c_void, on_alloc, on_read);
629 pub unsafe fn read_stop(stream: *uv_stream_t) -> c_int {
630 #[fixed_stack_segment]; #[inline(never)];
632 return rust_uv_read_stop(stream as *c_void);
635 pub unsafe fn strerror(err: c_int) -> *c_char {
636 #[fixed_stack_segment]; #[inline(never)];
637 return rust_uv_strerror(err);
639 pub unsafe fn err_name(err: c_int) -> *c_char {
640 #[fixed_stack_segment]; #[inline(never)];
641 return rust_uv_err_name(err);
644 pub unsafe fn async_init(loop_handle: *c_void,
645 async_handle: *uv_async_t,
646 cb: uv_async_cb) -> c_int {
647 #[fixed_stack_segment]; #[inline(never)];
649 return rust_uv_async_init(loop_handle, async_handle, cb);
652 pub unsafe fn async_send(async_handle: *uv_async_t) {
653 #[fixed_stack_segment]; #[inline(never)];
655 return rust_uv_async_send(async_handle);
657 pub unsafe fn buf_init(input: *u8, len: uint) -> uv_buf_t {
658 #[fixed_stack_segment]; #[inline(never)];
660 let out_buf = uv_buf_t { base: ptr::null(), len: 0 as size_t };
661 let out_buf_ptr = ptr::to_unsafe_ptr(&out_buf);
662 rust_uv_buf_init(out_buf_ptr, input, len as size_t);
666 pub unsafe fn timer_init(loop_ptr: *c_void, timer_ptr: *uv_timer_t) -> c_int {
667 #[fixed_stack_segment]; #[inline(never)];
669 return rust_uv_timer_init(loop_ptr, timer_ptr);
671 pub unsafe fn timer_start(timer_ptr: *uv_timer_t,
672 cb: uv_timer_cb, timeout: u64,
673 repeat: u64) -> c_int {
674 #[fixed_stack_segment]; #[inline(never)];
676 return rust_uv_timer_start(timer_ptr, cb, timeout, repeat);
678 pub unsafe fn timer_stop(timer_ptr: *uv_timer_t) -> c_int {
679 #[fixed_stack_segment]; #[inline(never)];
681 return rust_uv_timer_stop(timer_ptr);
684 pub unsafe fn is_ip4_addr(addr: *sockaddr) -> bool {
685 #[fixed_stack_segment]; #[inline(never)];
687 match rust_uv_is_ipv4_sockaddr(addr) { 0 => false, _ => true }
690 pub unsafe fn is_ip6_addr(addr: *sockaddr) -> bool {
691 #[fixed_stack_segment]; #[inline(never)];
693 match rust_uv_is_ipv6_sockaddr(addr) { 0 => false, _ => true }
696 pub unsafe fn malloc_ip4_addr(ip: &str, port: int) -> *sockaddr_in {
697 #[fixed_stack_segment]; #[inline(never)];
698 do ip.with_c_str |ip_buf| {
699 rust_uv_ip4_addrp(ip_buf as *u8, port as libc::c_int)
702 pub unsafe fn malloc_ip6_addr(ip: &str, port: int) -> *sockaddr_in6 {
703 #[fixed_stack_segment]; #[inline(never)];
704 do ip.with_c_str |ip_buf| {
705 rust_uv_ip6_addrp(ip_buf as *u8, port as libc::c_int)
709 pub unsafe fn malloc_sockaddr_storage() -> *sockaddr_storage {
710 #[fixed_stack_segment]; #[inline(never)];
712 rust_uv_malloc_sockaddr_storage()
715 pub unsafe fn free_sockaddr_storage(ss: *sockaddr_storage) {
716 #[fixed_stack_segment]; #[inline(never)];
718 rust_uv_free_sockaddr_storage(ss);
721 pub unsafe fn free_ip4_addr(addr: *sockaddr_in) {
722 #[fixed_stack_segment]; #[inline(never)];
724 rust_uv_free_ip4_addr(addr);
727 pub unsafe fn free_ip6_addr(addr: *sockaddr_in6) {
728 #[fixed_stack_segment]; #[inline(never)];
730 rust_uv_free_ip6_addr(addr);
733 pub unsafe fn ip4_name(addr: *sockaddr_in, dst: *u8, size: size_t) -> c_int {
734 #[fixed_stack_segment]; #[inline(never)];
736 return rust_uv_ip4_name(addr, dst, size);
739 pub unsafe fn ip6_name(addr: *sockaddr_in6, dst: *u8, size: size_t) -> c_int {
740 #[fixed_stack_segment]; #[inline(never)];
742 return rust_uv_ip6_name(addr, dst, size);
745 pub unsafe fn ip4_port(addr: *sockaddr_in) -> c_uint {
746 #[fixed_stack_segment]; #[inline(never)];
748 return rust_uv_ip4_port(addr);
751 pub unsafe fn ip6_port(addr: *sockaddr_in6) -> c_uint {
752 #[fixed_stack_segment]; #[inline(never)];
754 return rust_uv_ip6_port(addr);
757 pub unsafe fn fs_open(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char, flags: int, mode: int,
759 #[fixed_stack_segment]; #[inline(never)];
761 rust_uv_fs_open(loop_ptr, req, path, flags as c_int, mode as c_int, cb)
764 pub unsafe fn fs_unlink(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
766 #[fixed_stack_segment]; #[inline(never)];
768 rust_uv_fs_unlink(loop_ptr, req, path, cb)
770 pub unsafe fn fs_write(loop_ptr: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
771 len: uint, offset: i64, cb: *u8) -> c_int {
772 #[fixed_stack_segment]; #[inline(never)];
774 rust_uv_fs_write(loop_ptr, req, fd, buf, len as c_uint, offset, cb)
776 pub unsafe fn fs_read(loop_ptr: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
777 len: uint, offset: i64, cb: *u8) -> c_int {
778 #[fixed_stack_segment]; #[inline(never)];
780 rust_uv_fs_read(loop_ptr, req, fd, buf, len as c_uint, offset, cb)
782 pub unsafe fn fs_close(loop_ptr: *uv_loop_t, req: *uv_fs_t, fd: c_int,
784 #[fixed_stack_segment]; #[inline(never)];
786 rust_uv_fs_close(loop_ptr, req, fd, cb)
788 pub unsafe fn fs_stat(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char, cb: *u8) -> c_int {
789 #[fixed_stack_segment]; #[inline(never)];
791 rust_uv_fs_stat(loop_ptr, req, path, cb)
793 pub unsafe fn fs_fstat(loop_ptr: *uv_loop_t, req: *uv_fs_t, fd: c_int, cb: *u8) -> c_int {
794 #[fixed_stack_segment]; #[inline(never)];
796 rust_uv_fs_fstat(loop_ptr, req, fd, cb)
798 pub unsafe fn fs_mkdir(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char, mode: int,
800 #[fixed_stack_segment]; #[inline(never)];
802 rust_uv_fs_mkdir(loop_ptr, req, path, mode as c_int, cb)
804 pub unsafe fn fs_rmdir(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
806 #[fixed_stack_segment]; #[inline(never)];
808 rust_uv_fs_rmdir(loop_ptr, req, path, cb)
810 pub unsafe fn fs_rename(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
811 to: *c_char, cb: *u8) -> c_int {
812 #[fixed_stack_segment]; #[inline(never)];
814 rust_uv_fs_rename(loop_ptr, req, path, to, cb)
816 pub unsafe fn fs_readdir(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
817 flags: c_int, cb: *u8) -> c_int {
818 #[fixed_stack_segment]; #[inline(never)];
820 rust_uv_fs_readdir(loop_ptr, req, path, flags, cb)
822 pub unsafe fn populate_stat(req_in: *uv_fs_t, stat_out: *uv_stat_t) {
823 #[fixed_stack_segment]; #[inline(never)];
825 rust_uv_populate_uv_stat(req_in, stat_out)
827 pub unsafe fn fs_req_cleanup(req: *uv_fs_t) {
828 #[fixed_stack_segment]; #[inline(never)];
830 rust_uv_fs_req_cleanup(req);
833 pub unsafe fn spawn(loop_ptr: *c_void, result: *uv_process_t,
834 options: uv_process_options_t) -> c_int {
835 #[fixed_stack_segment]; #[inline(never)];
836 return rust_uv_spawn(loop_ptr, result, options);
839 pub unsafe fn process_kill(p: *uv_process_t, signum: c_int) -> c_int {
840 #[fixed_stack_segment]; #[inline(never)];
841 return rust_uv_process_kill(p, signum);
844 pub unsafe fn process_pid(p: *uv_process_t) -> c_int {
845 #[fixed_stack_segment]; #[inline(never)];
846 return rust_uv_process_pid(p);
849 pub unsafe fn set_stdio_container_flags(c: *uv_stdio_container_t,
850 flags: libc::c_int) {
851 #[fixed_stack_segment]; #[inline(never)];
852 rust_set_stdio_container_flags(c, flags);
855 pub unsafe fn set_stdio_container_fd(c: *uv_stdio_container_t,
857 #[fixed_stack_segment]; #[inline(never)];
858 rust_set_stdio_container_fd(c, fd);
861 pub unsafe fn set_stdio_container_stream(c: *uv_stdio_container_t,
862 stream: *uv_stream_t) {
863 #[fixed_stack_segment]; #[inline(never)];
864 rust_set_stdio_container_stream(c, stream);
867 pub unsafe fn pipe_init(loop_ptr: *c_void, p: *uv_pipe_t, ipc: c_int) -> c_int {
868 #[fixed_stack_segment]; #[inline(never)];
869 rust_uv_pipe_init(loop_ptr, p, ipc)
872 // data access helpers
873 pub unsafe fn get_result_from_fs_req(req: *uv_fs_t) -> c_int {
874 #[fixed_stack_segment]; #[inline(never)];
876 rust_uv_get_result_from_fs_req(req)
878 pub unsafe fn get_ptr_from_fs_req(req: *uv_fs_t) -> *libc::c_void {
879 #[fixed_stack_segment]; #[inline(never)];
881 rust_uv_get_ptr_from_fs_req(req)
883 pub unsafe fn get_loop_from_fs_req(req: *uv_fs_t) -> *uv_loop_t {
884 #[fixed_stack_segment]; #[inline(never)];
886 rust_uv_get_loop_from_fs_req(req)
888 pub unsafe fn get_loop_from_getaddrinfo_req(req: *uv_getaddrinfo_t) -> *uv_loop_t {
889 #[fixed_stack_segment]; #[inline(never)];
891 rust_uv_get_loop_from_getaddrinfo_req(req)
893 pub unsafe fn get_loop_for_uv_handle<T>(handle: *T) -> *c_void {
894 #[fixed_stack_segment]; #[inline(never)];
896 return rust_uv_get_loop_for_uv_handle(handle as *c_void);
898 pub unsafe fn get_stream_handle_from_connect_req(connect: *uv_connect_t) -> *uv_stream_t {
899 #[fixed_stack_segment]; #[inline(never)];
901 return rust_uv_get_stream_handle_from_connect_req(connect);
903 pub unsafe fn get_stream_handle_from_write_req(write_req: *uv_write_t) -> *uv_stream_t {
904 #[fixed_stack_segment]; #[inline(never)];
906 return rust_uv_get_stream_handle_from_write_req(write_req);
908 pub unsafe fn get_data_for_uv_loop(loop_ptr: *c_void) -> *c_void {
909 #[fixed_stack_segment]; #[inline(never)];
911 rust_uv_get_data_for_uv_loop(loop_ptr)
913 pub unsafe fn set_data_for_uv_loop(loop_ptr: *c_void, data: *c_void) {
914 #[fixed_stack_segment]; #[inline(never)];
916 rust_uv_set_data_for_uv_loop(loop_ptr, data);
918 pub unsafe fn get_data_for_uv_handle<T>(handle: *T) -> *c_void {
919 #[fixed_stack_segment]; #[inline(never)];
921 return rust_uv_get_data_for_uv_handle(handle as *c_void);
923 pub unsafe fn set_data_for_uv_handle<T, U>(handle: *T, data: *U) {
924 #[fixed_stack_segment]; #[inline(never)];
926 rust_uv_set_data_for_uv_handle(handle as *c_void, data as *c_void);
928 pub unsafe fn get_data_for_req<T>(req: *T) -> *c_void {
929 #[fixed_stack_segment]; #[inline(never)];
931 return rust_uv_get_data_for_req(req as *c_void);
933 pub unsafe fn set_data_for_req<T, U>(req: *T, data: *U) {
934 #[fixed_stack_segment]; #[inline(never)];
936 rust_uv_set_data_for_req(req as *c_void, data as *c_void);
938 pub unsafe fn get_base_from_buf(buf: uv_buf_t) -> *u8 {
939 #[fixed_stack_segment]; #[inline(never)];
941 return rust_uv_get_base_from_buf(buf);
943 pub unsafe fn get_len_from_buf(buf: uv_buf_t) -> size_t {
944 #[fixed_stack_segment]; #[inline(never)];
946 return rust_uv_get_len_from_buf(buf);
948 pub unsafe fn getaddrinfo(loop_: *uv_loop_t, req: *uv_getaddrinfo_t,
949 getaddrinfo_cb: uv_getaddrinfo_cb,
950 node: *c_char, service: *c_char,
951 hints: *addrinfo) -> c_int {
952 #[fixed_stack_segment]; #[inline(never)];
953 return rust_uv_getaddrinfo(loop_, req, getaddrinfo_cb, node, service, hints);
955 pub unsafe fn freeaddrinfo(ai: *addrinfo) {
956 #[fixed_stack_segment]; #[inline(never)];
957 rust_uv_freeaddrinfo(ai);
959 pub unsafe fn pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int {
960 #[fixed_stack_segment]; #[inline(never)];
961 rust_uv_pipe_open(pipe, file)
963 pub unsafe fn pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int {
964 #[fixed_stack_segment]; #[inline(never)];
965 rust_uv_pipe_bind(pipe, name)
967 pub unsafe fn pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
968 name: *c_char, cb: uv_connect_cb) {
969 #[fixed_stack_segment]; #[inline(never)];
970 rust_uv_pipe_connect(req, handle, name, cb)
972 pub unsafe fn tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
973 readable: c_int) -> c_int {
974 #[fixed_stack_segment]; #[inline(never)];
975 rust_uv_tty_init(loop_ptr, tty, fd, readable)
977 pub unsafe fn tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int {
978 #[fixed_stack_segment]; #[inline(never)];
979 rust_uv_tty_set_mode(tty, mode)
981 pub unsafe fn tty_get_winsize(tty: *uv_tty_t, width: *c_int,
982 height: *c_int) -> c_int {
983 #[fixed_stack_segment]; #[inline(never)];
984 rust_uv_tty_get_winsize(tty, width, height)
986 // FIXME(#9613) this should return uv_handle_type, not a c_int
987 pub unsafe fn guess_handle(fd: c_int) -> c_int {
988 #[fixed_stack_segment]; #[inline(never)];
989 rust_uv_guess_handle(fd)
992 pub unsafe fn signal_init(loop_: *uv_loop_t, handle: *uv_signal_t) -> c_int {
993 #[fixed_stack_segment]; #[inline(never)];
994 return rust_uv_signal_init(loop_, handle);
996 pub unsafe fn signal_start(handle: *uv_signal_t,
997 signal_cb: uv_signal_cb,
998 signum: c_int) -> c_int {
999 #[fixed_stack_segment]; #[inline(never)];
1000 return rust_uv_signal_start(handle, signal_cb, signum);
1002 pub unsafe fn signal_stop(handle: *uv_signal_t) -> c_int {
1003 #[fixed_stack_segment]; #[inline(never)];
1004 return rust_uv_signal_stop(handle);
1007 pub struct uv_err_data {
1012 // uv_support is the result of compiling rust_uv.cpp
1013 #[link_args = "-luv_support -luv"]
1016 fn rust_uv_handle_size(type_: uintptr_t) -> size_t;
1017 fn rust_uv_req_size(type_: uintptr_t) -> size_t;
1018 fn rust_uv_handle_type_max() -> uintptr_t;
1019 fn rust_uv_req_type_max() -> uintptr_t;
1022 fn rust_uv_loop_new() -> *c_void;
1023 fn rust_uv_loop_delete(lp: *c_void);
1024 fn rust_uv_run(loop_handle: *c_void);
1025 fn rust_uv_close(handle: *c_void, cb: uv_close_cb);
1026 fn rust_uv_walk(loop_handle: *c_void, cb: uv_walk_cb, arg: *c_void);
1028 fn rust_uv_idle_init(loop_handle: *uv_loop_t, handle: *uv_idle_t) -> c_int;
1029 fn rust_uv_idle_start(handle: *uv_idle_t, cb: uv_idle_cb) -> c_int;
1030 fn rust_uv_idle_stop(handle: *uv_idle_t) -> c_int;
1032 fn rust_uv_async_send(handle: *uv_async_t);
1033 fn rust_uv_async_init(loop_handle: *c_void,
1034 async_handle: *uv_async_t,
1035 cb: uv_async_cb) -> c_int;
1036 fn rust_uv_tcp_init(loop_handle: *c_void, handle_ptr: *uv_tcp_t) -> c_int;
1037 fn rust_uv_buf_init(out_buf: *uv_buf_t, base: *u8, len: size_t);
1038 fn rust_uv_strerror(err: c_int) -> *c_char;
1039 fn rust_uv_err_name(err: c_int) -> *c_char;
1040 fn rust_uv_ip4_addrp(ip: *u8, port: c_int) -> *sockaddr_in;
1041 fn rust_uv_ip6_addrp(ip: *u8, port: c_int) -> *sockaddr_in6;
1042 fn rust_uv_free_ip4_addr(addr: *sockaddr_in);
1043 fn rust_uv_free_ip6_addr(addr: *sockaddr_in6);
1044 fn rust_uv_ip4_name(src: *sockaddr_in, dst: *u8, size: size_t) -> c_int;
1045 fn rust_uv_ip6_name(src: *sockaddr_in6, dst: *u8, size: size_t) -> c_int;
1046 fn rust_uv_ip4_port(src: *sockaddr_in) -> c_uint;
1047 fn rust_uv_ip6_port(src: *sockaddr_in6) -> c_uint;
1048 fn rust_uv_tcp_connect(req: *uv_connect_t, handle: *uv_tcp_t,
1050 addr: *sockaddr_in) -> c_int;
1051 fn rust_uv_tcp_bind(tcp_server: *uv_tcp_t, addr: *sockaddr_in) -> c_int;
1052 fn rust_uv_tcp_connect6(req: *uv_connect_t, handle: *uv_tcp_t,
1054 addr: *sockaddr_in6) -> c_int;
1055 fn rust_uv_tcp_bind6(tcp_server: *uv_tcp_t, addr: *sockaddr_in6) -> c_int;
1056 fn rust_uv_tcp_getpeername(tcp_handle_ptr: *uv_tcp_t, name: *sockaddr_storage) -> c_int;
1057 fn rust_uv_tcp_getsockname(handle: *uv_tcp_t, name: *sockaddr_storage) -> c_int;
1058 fn rust_uv_tcp_nodelay(handle: *uv_tcp_t, enable: c_int) -> c_int;
1059 fn rust_uv_tcp_keepalive(handle: *uv_tcp_t, enable: c_int, delay: c_uint) -> c_int;
1060 fn rust_uv_tcp_simultaneous_accepts(handle: *uv_tcp_t, enable: c_int) -> c_int;
1062 fn rust_uv_udp_init(loop_handle: *uv_loop_t, handle_ptr: *uv_udp_t) -> c_int;
1063 fn rust_uv_udp_bind(server: *uv_udp_t, addr: *sockaddr_in, flags: c_uint) -> c_int;
1064 fn rust_uv_udp_bind6(server: *uv_udp_t, addr: *sockaddr_in6, flags: c_uint) -> c_int;
1065 fn rust_uv_udp_send(req: *uv_udp_send_t, handle: *uv_udp_t, buf_in: *uv_buf_t,
1066 buf_cnt: c_int, addr: *sockaddr_in, cb: uv_udp_send_cb) -> c_int;
1067 fn rust_uv_udp_send6(req: *uv_udp_send_t, handle: *uv_udp_t, buf_in: *uv_buf_t,
1068 buf_cnt: c_int, addr: *sockaddr_in6, cb: uv_udp_send_cb) -> c_int;
1069 fn rust_uv_udp_recv_start(server: *uv_udp_t,
1070 on_alloc: uv_alloc_cb,
1071 on_recv: uv_udp_recv_cb) -> c_int;
1072 fn rust_uv_udp_recv_stop(server: *uv_udp_t) -> c_int;
1073 fn rust_uv_get_udp_handle_from_send_req(req: *uv_udp_send_t) -> *uv_udp_t;
1074 fn rust_uv_udp_getsockname(handle: *uv_udp_t, name: *sockaddr_storage) -> c_int;
1075 fn rust_uv_udp_set_membership(handle: *uv_udp_t, multicast_addr: *c_char,
1076 interface_addr: *c_char, membership: c_int) -> c_int;
1077 fn rust_uv_udp_set_multicast_loop(handle: *uv_udp_t, on: c_int) -> c_int;
1078 fn rust_uv_udp_set_multicast_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
1079 fn rust_uv_udp_set_ttl(handle: *uv_udp_t, ttl: c_int) -> c_int;
1080 fn rust_uv_udp_set_broadcast(handle: *uv_udp_t, on: c_int) -> c_int;
1082 fn rust_uv_is_ipv4_sockaddr(addr: *sockaddr) -> c_int;
1083 fn rust_uv_is_ipv6_sockaddr(addr: *sockaddr) -> c_int;
1084 fn rust_uv_malloc_sockaddr_storage() -> *sockaddr_storage;
1085 fn rust_uv_free_sockaddr_storage(ss: *sockaddr_storage);
1087 fn rust_uv_listen(stream: *c_void, backlog: c_int,
1088 cb: uv_connection_cb) -> c_int;
1089 fn rust_uv_accept(server: *c_void, client: *c_void) -> c_int;
1090 fn rust_uv_write(req: *c_void, stream: *c_void, buf_in: *uv_buf_t, buf_cnt: c_int,
1091 cb: uv_write_cb) -> c_int;
1092 fn rust_uv_read_start(stream: *c_void,
1093 on_alloc: uv_alloc_cb,
1094 on_read: uv_read_cb) -> c_int;
1095 fn rust_uv_read_stop(stream: *c_void) -> c_int;
1096 fn rust_uv_timer_init(loop_handle: *c_void, timer_handle: *uv_timer_t) -> c_int;
1097 fn rust_uv_timer_start(timer_handle: *uv_timer_t, cb: uv_timer_cb, timeout: libc::uint64_t,
1098 repeat: libc::uint64_t) -> c_int;
1099 fn rust_uv_timer_stop(handle: *uv_timer_t) -> c_int;
1100 fn rust_uv_fs_open(loop_ptr: *c_void, req: *uv_fs_t, path: *c_char,
1101 flags: c_int, mode: c_int, cb: *u8) -> c_int;
1102 fn rust_uv_fs_unlink(loop_ptr: *c_void, req: *uv_fs_t, path: *c_char,
1104 fn rust_uv_fs_write(loop_ptr: *c_void, req: *uv_fs_t, fd: c_int,
1105 buf: *c_void, len: c_uint, offset: i64, cb: *u8) -> c_int;
1106 fn rust_uv_fs_read(loop_ptr: *c_void, req: *uv_fs_t, fd: c_int,
1107 buf: *c_void, len: c_uint, offset: i64, cb: *u8) -> c_int;
1108 fn rust_uv_fs_close(loop_ptr: *c_void, req: *uv_fs_t, fd: c_int,
1110 fn rust_uv_fs_stat(loop_ptr: *c_void, req: *uv_fs_t, path: *c_char, cb: *u8) -> c_int;
1111 fn rust_uv_fs_fstat(loop_ptr: *c_void, req: *uv_fs_t, fd: c_int, cb: *u8) -> c_int;
1112 fn rust_uv_fs_mkdir(loop_ptr: *c_void, req: *uv_fs_t, path: *c_char,
1113 mode: c_int, cb: *u8) -> c_int;
1114 fn rust_uv_fs_rmdir(loop_ptr: *c_void, req: *uv_fs_t, path: *c_char,
1116 fn rust_uv_fs_rename(loop_ptr: *c_void, req: *uv_fs_t, path: *c_char,
1117 to: *c_char, cb: *u8) -> c_int;
1118 fn rust_uv_fs_readdir(loop_ptr: *c_void, req: *uv_fs_t, path: *c_char,
1119 flags: c_int, cb: *u8) -> c_int;
1120 fn rust_uv_fs_req_cleanup(req: *uv_fs_t);
1121 fn rust_uv_populate_uv_stat(req_in: *uv_fs_t, stat_out: *uv_stat_t);
1122 fn rust_uv_get_result_from_fs_req(req: *uv_fs_t) -> c_int;
1123 fn rust_uv_get_ptr_from_fs_req(req: *uv_fs_t) -> *libc::c_void;
1124 fn rust_uv_get_loop_from_fs_req(req: *uv_fs_t) -> *uv_loop_t;
1125 fn rust_uv_get_loop_from_getaddrinfo_req(req: *uv_fs_t) -> *uv_loop_t;
1127 fn rust_uv_get_stream_handle_from_connect_req(connect_req: *uv_connect_t) -> *uv_stream_t;
1128 fn rust_uv_get_stream_handle_from_write_req(write_req: *uv_write_t) -> *uv_stream_t;
1129 fn rust_uv_get_loop_for_uv_handle(handle: *c_void) -> *c_void;
1130 fn rust_uv_get_data_for_uv_loop(loop_ptr: *c_void) -> *c_void;
1131 fn rust_uv_set_data_for_uv_loop(loop_ptr: *c_void, data: *c_void);
1132 fn rust_uv_get_data_for_uv_handle(handle: *c_void) -> *c_void;
1133 fn rust_uv_set_data_for_uv_handle(handle: *c_void, data: *c_void);
1134 fn rust_uv_get_data_for_req(req: *c_void) -> *c_void;
1135 fn rust_uv_set_data_for_req(req: *c_void, data: *c_void);
1136 fn rust_uv_get_base_from_buf(buf: uv_buf_t) -> *u8;
1137 fn rust_uv_get_len_from_buf(buf: uv_buf_t) -> size_t;
1138 fn rust_uv_getaddrinfo(loop_: *uv_loop_t, req: *uv_getaddrinfo_t,
1139 getaddrinfo_cb: uv_getaddrinfo_cb,
1140 node: *c_char, service: *c_char,
1141 hints: *addrinfo) -> c_int;
1142 fn rust_uv_freeaddrinfo(ai: *addrinfo);
1143 fn rust_uv_spawn(loop_ptr: *c_void, outptr: *uv_process_t,
1144 options: uv_process_options_t) -> c_int;
1145 fn rust_uv_process_kill(p: *uv_process_t, signum: c_int) -> c_int;
1146 fn rust_uv_process_pid(p: *uv_process_t) -> c_int;
1147 fn rust_set_stdio_container_flags(c: *uv_stdio_container_t, flags: c_int);
1148 fn rust_set_stdio_container_fd(c: *uv_stdio_container_t, fd: c_int);
1149 fn rust_set_stdio_container_stream(c: *uv_stdio_container_t,
1150 stream: *uv_stream_t);
1151 fn rust_uv_pipe_init(loop_ptr: *c_void, p: *uv_pipe_t, ipc: c_int) -> c_int;
1153 fn rust_uv_pipe_open(pipe: *uv_pipe_t, file: c_int) -> c_int;
1154 fn rust_uv_pipe_bind(pipe: *uv_pipe_t, name: *c_char) -> c_int;
1155 fn rust_uv_pipe_connect(req: *uv_connect_t, handle: *uv_pipe_t,
1156 name: *c_char, cb: uv_connect_cb);
1157 fn rust_uv_tty_init(loop_ptr: *uv_loop_t, tty: *uv_tty_t, fd: c_int,
1158 readable: c_int) -> c_int;
1159 fn rust_uv_tty_set_mode(tty: *uv_tty_t, mode: c_int) -> c_int;
1160 fn rust_uv_tty_get_winsize(tty: *uv_tty_t, width: *c_int,
1161 height: *c_int) -> c_int;
1162 fn rust_uv_guess_handle(fd: c_int) -> c_int;
1164 // XXX: see comments in addrinfo.rs
1165 // These should all really be constants...
1166 //#[rust_stack] pub fn rust_SOCK_STREAM() -> c_int;
1167 //#[rust_stack] pub fn rust_SOCK_DGRAM() -> c_int;
1168 //#[rust_stack] pub fn rust_SOCK_RAW() -> c_int;
1169 //#[rust_stack] pub fn rust_IPPROTO_UDP() -> c_int;
1170 //#[rust_stack] pub fn rust_IPPROTO_TCP() -> c_int;
1171 //#[rust_stack] pub fn rust_AI_ADDRCONFIG() -> c_int;
1172 //#[rust_stack] pub fn rust_AI_ALL() -> c_int;
1173 //#[rust_stack] pub fn rust_AI_CANONNAME() -> c_int;
1174 //#[rust_stack] pub fn rust_AI_NUMERICHOST() -> c_int;
1175 //#[rust_stack] pub fn rust_AI_NUMERICSERV() -> c_int;
1176 //#[rust_stack] pub fn rust_AI_PASSIVE() -> c_int;
1177 //#[rust_stack] pub fn rust_AI_V4MAPPED() -> c_int;
1179 fn rust_uv_signal_init(loop_: *uv_loop_t, handle: *uv_signal_t) -> c_int;
1180 fn rust_uv_signal_start(handle: *uv_signal_t,
1181 signal_cb: uv_signal_cb,
1182 signum: c_int) -> c_int;
1183 fn rust_uv_signal_stop(handle: *uv_signal_t) -> c_int;
1186 // libuv requires various system libraries to successfully link on some
1188 #[cfg(target_os = "linux")]
1189 #[link_args = "-lpthread"]
1192 #[cfg(target_os = "win32")]
1193 #[link_args = "-lWs2_32 -lpsapi -liphlpapi"]