From 3a0193799362b885b610e0b6c25cfca5eec28e97 Mon Sep 17 00:00:00 2001 From: Paul Osborne Date: Mon, 14 Mar 2016 16:48:54 -0500 Subject: [PATCH] linux: add missing SOL_* constants SOL_SOCKET appears to be the only constant that is not the same across architectures and it was already present in libc. The constants provided match bionic and the Linux kernel but are a supseret of those provided by musl and glibc. They are just constants, so it should be fine (and avoids upstream from having to define/maintain them). Signed-off-by: Paul Osborne --- libc-test/build.rs | 27 +++++++++++++++++++++++++++ src/unix/notbsd/linux/mod.rs | 25 +++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 6475db5749c27..60d9a193cbf1d 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -155,6 +155,15 @@ fn main() { cfg.header("linux/netlink.h"); cfg.header("linux/magic.h"); + if !android { + cfg.header("netinet/udp.h"); + cfg.header("netipx/ipx.h"); + cfg.header("netax25/ax25.h"); + cfg.header("netatalk/at.h"); + cfg.header("netrose/rose.h"); + cfg.header("netrom/netrom.h"); + } + if !mips { cfg.header("linux/quota.h"); } @@ -289,6 +298,24 @@ fn main() { "FILE_ATTRIBUTE_INTEGRITY_STREAM" | "ERROR_NOTHING_TO_TERMINATE" if mingw => true, + // these are not in musl + "SOL_NETLINK" | + "SOL_UDP" | + "SOL_AX25" | + "SOL_ATALK" | + "SOL_NETROM" | + "SOL_IPX" | + "SOL_ROSE" if musl => true, + + // these are not in glibc or musl yet (but they are in android) + "SOL_SCTP" | + "SOL_UDPLITE" | + "SOL_NETBEUI" | + "SOL_LLC" | + "SOL_DCCP" | + "SOL_NETLINK" | + "SOL_TIPC" if linux => true, + "SIG_IGN" => true, // sighandler_t weirdness // types on musl are defined a little differently diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 82645ba0c3132..47540c8965ee1 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -308,6 +308,31 @@ pub const ST_IMMUTABLE: ::c_ulong = 512; pub const ST_NOATIME: ::c_ulong = 1024; pub const ST_NODIRATIME: ::c_ulong = 2048; +pub const SOL_IP: ::c_int = 0; +pub const SOL_TCP: ::c_int = 6; +pub const SOL_UDP: ::c_int = 17; +pub const SOL_IPV6: ::c_int = 41; +pub const SOL_ICMPV6: ::c_int = 58; +pub const SOL_SCTP: ::c_int = 132; +pub const SOL_UDPLITE: ::c_int = 136; +pub const SOL_RAW: ::c_int = 255; +pub const SOL_IPX: ::c_int = 256; +pub const SOL_AX25: ::c_int = 257; +pub const SOL_ATALK: ::c_int = 258; +pub const SOL_NETROM: ::c_int = 259; +pub const SOL_ROSE: ::c_int = 260; +pub const SOL_DECNET: ::c_int = 261; +pub const SOL_X25: ::c_int = 262; +pub const SOL_PACKET: ::c_int = 263; +pub const SOL_ATM: ::c_int = 264; +pub const SOL_AAL: ::c_int = 265; +pub const SOL_IRDA: ::c_int = 266; +pub const SOL_NETBEUI: ::c_int = 267; +pub const SOL_LLC: ::c_int = 268; +pub const SOL_DCCP: ::c_int = 269; +pub const SOL_NETLINK: ::c_int = 270; +pub const SOL_TIPC: ::c_int = 271; + pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; pub const RTLD_NODELETE: ::c_int = 0x1000;