Auto merge of #1005 - Susurrus:s390x_fix, r=alexcrichton
Fix sparc64 builds
Partially fixes #987.
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 327b920..a39e317 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -84,6 +84,7 @@
cfg.header("sys/socket.h");
}
cfg.header("net/if.h");
+ cfg.header("net/route.h");
cfg.header("netdb.h");
cfg.header("netinet/in.h");
cfg.header("netinet/ip.h");
diff --git a/src/redox/mod.rs b/src/redox/mod.rs
index fb3c3f6..793fd32 100644
--- a/src/redox/mod.rs
+++ b/src/redox/mod.rs
@@ -118,6 +118,7 @@
pub const SIGSYS: ::c_int = 31;
extern {
+ pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
-> ::ssize_t;
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index a6ac3b5..60e0d8e 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -1410,6 +1410,63 @@
pub const IPTOS_TOS_MASK: u8 = 0x1E;
pub const IPTOS_PREC_MASK: u8 = 0xE0;
+pub const RTF_UP: ::c_ushort = 0x0001;
+pub const RTF_GATEWAY: ::c_ushort = 0x0002;
+
+pub const RTF_HOST: ::c_ushort = 0x0004;
+pub const RTF_REINSTATE: ::c_ushort = 0x0008;
+pub const RTF_DYNAMIC: ::c_ushort = 0x0010;
+pub const RTF_MODIFIED: ::c_ushort = 0x0020;
+pub const RTF_MTU: ::c_ushort = 0x0040;
+pub const RTF_MSS: ::c_ushort = RTF_MTU;
+pub const RTF_WINDOW: ::c_ushort = 0x0080;
+pub const RTF_IRTT: ::c_ushort = 0x0100;
+pub const RTF_REJECT: ::c_ushort = 0x0200;
+pub const RTF_STATIC: ::c_ushort = 0x0400;
+pub const RTF_XRESOLVE: ::c_ushort = 0x0800;
+pub const RTF_NOFORWARD: ::c_ushort = 0x1000;
+pub const RTF_THROW: ::c_ushort = 0x2000;
+pub const RTF_NOPMTUDISC: ::c_ushort = 0x4000;
+
+pub const RTF_DEFAULT: u32 = 0x00010000;
+pub const RTF_ALLONLINK: u32 = 0x00020000;
+pub const RTF_ADDRCONF: u32 = 0x00040000;
+pub const RTF_LINKRT: u32 = 0x00100000;
+pub const RTF_NONEXTHOP: u32 = 0x00200000;
+pub const RTF_CACHE: u32 = 0x01000000;
+pub const RTF_FLOW: u32 = 0x02000000;
+pub const RTF_POLICY: u32 = 0x04000000;
+
+pub const RTCF_VALVE: u32 = 0x00200000;
+pub const RTCF_MASQ: u32 = 0x00400000;
+pub const RTCF_NAT: u32 = 0x00800000;
+pub const RTCF_DOREDIRECT: u32 = 0x01000000;
+pub const RTCF_LOG: u32 = 0x02000000;
+pub const RTCF_DIRECTSRC: u32 = 0x04000000;
+
+pub const RTF_LOCAL: u32 = 0x80000000;
+pub const RTF_INTERFACE: u32 = 0x40000000;
+pub const RTF_MULTICAST: u32 = 0x20000000;
+pub const RTF_BROADCAST: u32 = 0x10000000;
+pub const RTF_NAT: u32 = 0x08000000;
+pub const RTF_ADDRCLASSMASK: u32 = 0xF8000000;
+
+pub const RT_CLASS_UNSPEC: u8 = 0;
+pub const RT_CLASS_DEFAULT: u8 = 253;
+pub const RT_CLASS_MAIN: u8 = 254;
+pub const RT_CLASS_LOCAL: u8 = 255;
+pub const RT_CLASS_MAX: u8 = 255;
+
+pub const RTMSG_OVERRUN: u32 = ::NLMSG_OVERRUN as u32;
+pub const RTMSG_NEWDEVICE: u32 = 0x11;
+pub const RTMSG_DELDEVICE: u32 = 0x12;
+pub const RTMSG_NEWROUTE: u32 = 0x21;
+pub const RTMSG_DELROUTE: u32 = 0x22;
+pub const RTMSG_NEWRULE: u32 = 0x31;
+pub const RTMSG_DELRULE: u32 = 0x32;
+pub const RTMSG_CONTROL: u32 = 0x40;
+pub const RTMSG_AR_FAILED: u32 = 0x51;
+
f! {
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
for slot in cpuset.bits.iter_mut() {
@@ -1473,6 +1530,18 @@
pub fn IPTOS_PREC(tos: u8) -> u8 {
tos & IPTOS_PREC_MASK
}
+
+ pub fn RT_TOS(tos: u8) -> u8 {
+ tos & ::IPTOS_TOS_MASK
+ }
+
+ pub fn RT_ADDRCLASS(flags: u32) -> u32 {
+ flags >> 23
+ }
+
+ pub fn RT_LOCALADDR(flags: u32) -> bool {
+ (flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE)
+ }
}
extern {
diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs
index a953592..6a326dd 100644
--- a/src/unix/notbsd/linux/other/mod.rs
+++ b/src/unix/notbsd/linux/other/mod.rs
@@ -216,6 +216,27 @@
pub nla_len: u16,
pub nla_type: u16,
}
+
+ pub struct rtentry {
+ pub rt_pad1: ::c_ulong,
+ pub rt_dst: ::sockaddr,
+ pub rt_gateway: ::sockaddr,
+ pub rt_genmask: ::sockaddr,
+ pub rt_flags: ::c_ushort,
+ pub rt_pad2: ::c_short,
+ pub rt_pad3: ::c_ulong,
+ pub rt_tos: ::c_uchar,
+ pub rt_class: ::c_uchar,
+ #[cfg(target_pointer_width = "64")]
+ pub rt_pad4: [::c_short; 3usize],
+ #[cfg(not(target_pointer_width = "64"))]
+ pub rt_pad4: ::c_short,
+ pub rt_metric: ::c_short,
+ pub rt_dev: *mut ::c_char,
+ pub rt_mtu: ::c_ulong,
+ pub rt_window: ::c_ulong,
+ pub rt_irtt: ::c_ushort,
+ }
}
pub const __UT_LINESIZE: usize = 32;
diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs
index 2a6d616..2de3ac8 100644
--- a/src/unix/notbsd/mod.rs
+++ b/src/unix/notbsd/mod.rs
@@ -193,6 +193,19 @@
pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
pub ifa_data: *mut ::c_void
}
+
+ pub struct in6_rtmsg {
+ rtmsg_dst: ::in6_addr,
+ rtmsg_src: ::in6_addr,
+ rtmsg_gateway: ::in6_addr,
+ rtmsg_type: u32,
+ rtmsg_dst_len: u16,
+ rtmsg_src_len: u16,
+ rtmsg_metric: u32,
+ rtmsg_info: ::c_ulong,
+ rtmsg_flags: u32,
+ rtmsg_ifindex: ::c_int,
+ }
}
// intentionally not public, only used for fd_set