diff options
| author | bors <bors@rust-lang.org> | 2014-01-24 14:51:36 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-24 14:51:36 -0800 |
| commit | 8de3fab82a44506be96c51183d488b1019f04cc3 (patch) | |
| tree | b6ee3dc0ee3234acd7146aa5f7d0e6f7e09a5861 /src/libstd | |
| parent | a1d9d9e6d2ca79ac0b157170a76e300acfdcf143 (diff) | |
| parent | adb512802057a89b4339651c90dca81e5dd96751 (diff) | |
| download | rust-8de3fab82a44506be96c51183d488b1019f04cc3.tar.gz rust-8de3fab82a44506be96c51183d488b1019f04cc3.zip | |
auto merge of #11732 : luqmana/rust/native-getaddrinfo, r=alexcrichton
The last bit I needed to be able to use libnative :P
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/net/addrinfo.rs | 16 | ||||
| -rw-r--r-- | src/libstd/libc.rs | 48 |
2 files changed, 55 insertions, 9 deletions
diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs index fe29a112262..4a8529d0a0a 100644 --- a/src/libstd/io/net/addrinfo.rs +++ b/src/libstd/io/net/addrinfo.rs @@ -98,15 +98,15 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>) LocalIo::maybe_raise(|io| io.get_host_addresses(hostname, servname, hint)) } -#[cfg(test)] +// Ignored on android since we cannot give tcp/ip +// permission without help of apk +#[cfg(test, not(target_os = "android"))] mod test { use io::net::ip::Ipv4Addr; use prelude::*; use super::*; - #[test] - #[ignore(cfg(target_os="android"))] // cannot give tcp/ip permission without help of apk - fn dns_smoke_test() { + iotest!(fn dns_smoke_test() { let ipaddrs = get_host_addresses("localhost").unwrap(); let mut found_local = false; let local_addr = &Ipv4Addr(127, 0, 0, 1); @@ -114,5 +114,11 @@ mod test { found_local = found_local || addr == local_addr; } assert!(found_local); - } + }) + + iotest!(fn issue_10663() { + // Something should happen here, but this certainly shouldn't cause + // everything to die. The actual outcome we don't care too much about. + get_host_addresses("example.com"); + } #[ignore]) } diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs index 6f2d64ff668..a398835824b 100644 --- a/src/libstd/libc.rs +++ b/src/libstd/libc.rs @@ -267,7 +267,7 @@ pub mod types { pub enum timezone {} } pub mod bsd44 { - use libc::types::os::arch::c95::c_uint; + use libc::types::os::arch::c95::{c_char, c_int, c_uint}; pub type socklen_t = u32; pub type sa_family_t = u16; @@ -309,6 +309,16 @@ pub mod types { ipv6mr_multiaddr: in6_addr, ipv6mr_interface: c_uint, } + pub struct addrinfo { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: socklen_t, + ai_addr: *sockaddr, + ai_canonname: *c_char, + ai_next: *addrinfo + } } } @@ -624,7 +634,7 @@ pub mod types { pub enum timezone {} } pub mod bsd44 { - use libc::types::os::arch::c95::c_uint; + use libc::types::os::arch::c95::{c_char, c_int, c_uint}; pub type socklen_t = u32; pub type sa_family_t = u8; @@ -671,6 +681,16 @@ pub mod types { ipv6mr_multiaddr: in6_addr, ipv6mr_interface: c_uint, } + pub struct addrinfo { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: socklen_t, + ai_canonname: *c_char, + ai_addr: *sockaddr, + ai_next: *addrinfo + } } } @@ -811,7 +831,7 @@ pub mod types { } pub mod bsd44 { - use libc::types::os::arch::c95::{c_int, c_uint}; + use libc::types::os::arch::c95::{c_char, c_int, c_uint, size_t}; pub type SOCKET = c_uint; pub type socklen_t = c_int; @@ -854,6 +874,16 @@ pub mod types { ipv6mr_multiaddr: in6_addr, ipv6mr_interface: c_uint, } + pub struct addrinfo { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: size_t, + ai_canonname: *c_char, + ai_addr: *sockaddr, + ai_next: *addrinfo + } } } @@ -1121,7 +1151,7 @@ pub mod types { } pub mod bsd44 { - use libc::types::os::arch::c95::{c_int, c_uint}; + use libc::types::os::arch::c95::{c_char, c_int, c_uint}; pub type socklen_t = c_int; pub type sa_family_t = u8; @@ -1168,6 +1198,16 @@ pub mod types { ipv6mr_multiaddr: in6_addr, ipv6mr_interface: c_uint, } + pub struct addrinfo { + ai_flags: c_int, + ai_family: c_int, + ai_socktype: c_int, + ai_protocol: c_int, + ai_addrlen: socklen_t, + ai_canonname: *c_char, + ai_addr: *sockaddr, + ai_next: *addrinfo + } } } |
