Fix android

This commit is contained in:
Alex Crichton 2015-09-16 16:27:23 -07:00
parent 316c367d1b
commit 094f44db79
5 changed files with 26 additions and 12 deletions

View File

@ -15,6 +15,12 @@ fn main() {
cfg.define("_WIN32_WINNT", Some("0x8000"));
}
// Android doesn't actually have in_port_t but it's much easier if we
// provide one for us to test against
if target.contains("android") {
cfg.define("in_port_t", Some("uint16_t"));
}
cfg.header("errno.h")
.header("fcntl.h")
.header("limits.h")
@ -136,8 +142,6 @@ fn main() {
// sighandler_t is crazy across platforms
"sighandler_t" => true,
// Not actually defined on android, but it's not hurting anyone
"in_port_t" if target2.contains("android") => true,
_ => false
}
});

View File

@ -27,6 +27,11 @@ s! {
pub sun_family: sa_family_t,
pub sun_path: [c_char; 104]
}
pub struct ipv6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: c_uint,
}
}
extern {

View File

@ -56,11 +56,6 @@ s! {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
pub struct ipv6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: c_uint,
}
}
cfg_if! {

View File

@ -30,18 +30,18 @@ s! {
__st_ino: ::ino_t,
pub st_mode: ::c_uint,
pub st_nlink: ::c_uint,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_uid: ::c_ulong,
pub st_gid: ::c_ulong,
pub st_rdev: ::c_ulonglong,
__pad3: [::c_uchar; 4],
pub st_size: ::c_longlong,
pub st_blksize: blksize_t,
pub st_blocks: ::c_ulonglong,
pub st_atime: ::time_t,
pub st_atime: ::c_ulong,
pub st_atime_nsec: ::c_ulong,
pub st_mtime: ::time_t,
pub st_mtime: ::c_ulong,
pub st_mtime_nsec: ::c_ulong,
pub st_ctime: ::time_t,
pub st_ctime: ::c_ulong,
pub st_ctime_nsec: ::c_ulong,
pub st_ino: ::c_ulonglong,
}
@ -54,6 +54,11 @@ s! {
pub sched_policy: ::int32_t,
pub sched_priority: ::int32_t,
}
pub struct ipv6_mreq {
pub ipv6mr_multiaddr: ::in6_addr,
pub ipv6mr_interface: ::c_int,
}
}
pub const BUFSIZ: ::c_uint = 1024;

View File

@ -28,6 +28,11 @@ s! {
pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
pub ifa_data: *mut ::c_void
}
pub struct ipv6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: c_uint,
}
}
pub const BUFSIZ: ::c_uint = 8192;